Comments (10)
Hi!
Yes, I have set the correct ruby version in the first line in the script. After that change it should work.
BR/JO!
from docker-telegraf-netatmo.
First of all, thank you for supporting me!
I don't understand what is going on here. I read, that you changed the latest image to ruby 2.3 and you changed shabang line to default ruby
instead of ruby2.0
. I double checked it:
# ruby --version
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
I am also able to connect to my influxdb and telegraf default data has been written:
2020/01/16 18:12:00 I! Using config file: /etc/telegraf/telegraf.conf
2020-01-16T18:12:00Z I! Starting Telegraf v1.6.1
2020-01-16T18:12:00Z I! Loaded outputs: influxdb
2020-01-16T18:12:00Z I! Loaded inputs: inputs.processes inputs.swap inputs.system inputs.cpu inputs.disk inputs.diskio inputs.kernel inputs.mem
2020-01-16T18:12:00Z I! Tags enabled: host=telegraf-netatmo
2020-01-16T18:12:00Z I! Agent Config: Interval:10s, Quiet:false, Hostname:"telegraf-netatmo", Flush Interval:10s
And then, even if I start it with ruby ./netatmo
from within /usr/local/bin/
it throws me this:
# ruby ./netatmo
./netatmo:81:in `filter_data': private method `select' called for nil:NilClass (NoMethodError)
from ./netatmo:75:in `process_data'
from ./netatmo:104:in `block in measurements'
from ./netatmo:103:in `each'
from ./netatmo:103:in `measurements'
from ./netatmo:120:in `<main>'
I don't think there is a mistake in my configs, but please check below.
Docker
docker run \
--name telegraf-netatmo \
-e 'NETATMO_CLIENT_ID=xxx' \
-e 'NETATMO_CLIENT_SECRET=xxx' \
-e '[email protected]' \
-e 'NETATMO_PASSWORD=1234' \
-e 'NETATMO_DEVICE_ID=xx:xx:xx:xx:xx:xx' \
--link influxdb \
benningm/telegraf-netatmo:latest
telegraf.conf
[[outputs.influxdb]]
urls = ["http://10.10.0.6:32784"]
database = "telegraf"
username = "telegraf"
password = "telegraf"
[[inputs.exec]]
commands = ["/usr/local/bin/netatmo"]
interval = "10m"
timeout = "15s"
data_format = "json"
name_suffix = "_netatmo"
Any help is much apprechiated!
Best,
AlfaJackal
from docker-telegraf-netatmo.
My container is running:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
I have set the following as first line in the netatmo script:
#!/usr/bin/env ruby2.5
telegraf.conf
DB-section:
[[outputs.influxdb]]
## The full HTTP or UDP URL for your InfluxDB instance.
##
## Multiple urls can be specified as part of the same cluster,
## this means that only ONE of the urls will be written to each interval.
# urls = ["udp://127.0.0.1:8089"] # UDP endpoint example
urls = ["http://localhost:8086"] # required
## The target database for metrics (telegraf will create it if not exists).
database = "netatmodb" # required
NETATMO-section:
[[inputs.exec]]
# ## Commands array
commands = ["/etc/telegraf/netatmo/netatmo"]
interval = "10m"
# "/tmp/test.sh",
# "/usr/bin/mycollector --foo=bar",
# "/tmp/collect_*.sh"
# ]
#
# ## Timeout for each command to complete.
timeout = "15s"
#
# ## measurement name suffix (for separating different commands)
name_suffix = "_netatmo"
#
# ## Data format to consume.
# ## Each data format has its own unique set of configuration options, read
# ## more about them here:
# ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
data_format = "json"
Since that changes all works great.
Is this a fresh install or do you have upgraded ruby and since that you get issues?
BR/JO!
from docker-telegraf-netatmo.
I started from the scratch, made only changes to the config (See first post) which all seem to be correct:
- Ruby 2.3.3 is running
- influxdb has been connected
- Netatmo Script has been found and used by telegraf. Double checked credentials, also no auth error - so this must be ok.
- Default Container Data has been written to InfluxDB.
Changing first line of netatmo
to
#!/usr/bin/env ruby2.3
doesnโt solve it. Also tried an upgrade of ruby on a clean install like you did - no luck either. Now I am back on a fresh docker install and still not working.
from docker-telegraf-netatmo.
You have to change the first line in the netatmo script, not in the telegraf.conf file.
I have only changed the first line to match the correct installed ruby version.
A few weeks ago I have migrated from an ubuntu 16.04 to an fresh installed ubuntu 18.04 container without any issues.
BR/JO!
from docker-telegraf-netatmo.
You have to change the first line in the netatmo script, not in the telegraf.conf file.
I have only changed the first line to match the correct installed ruby version.
Sure, did that. Just wrote in wrong in my last post.
Any more ideas, @benningm?
from docker-telegraf-netatmo.
You can leave out the whole telegraf and influx configuration and run the script standalone.
Everything ruby >= 2.0 should work.
Currently it will use the ruby
from the PATH
:
#!/usr/bin/env ruby
The means the ruby
you see when you run which ruby
.
The nil
error reported is after the data has been retrieved from API:
./netatmo:81:in `filter_data': private method `select' called for nil:NilClass (NoMethodError)
Try adding this debug statement after line 59 (res = Net::HTTP.get_response(uri)
) in the script:
puts res.body
That should output the response body from the API to your terminal.
Please check the output for secrets or credentials before pasting it here.
from docker-telegraf-netatmo.
Thanks for replying and trying to fix that error!
I started the script with ruby ./netatmo
with the debug statement after line 59. Data has been retrieved from API, here is the JSON: https://pastebin.com/7D9LuRbr
from docker-telegraf-netatmo.
The script iterates over all station modules and uses 'dashboard_data'.
Seems like 2 of your attached modules have no 'dashboard_data' attached in the API.
I just added a guard clause to skip these modules. Please try the latest revision in git.
from docker-telegraf-netatmo.
BAM! That was it!
Many thanks for your help, added that line and everything works as expected now!
I am pretty happy now! :)
from docker-telegraf-netatmo.
Related Issues (8)
- Error in plugin [inputs.exec]: exec: exit status 1 HOT 3
- error (NoMethodError) HOT 1
- Editing telegraf.conf results in a crashing docker HOT 3
- [enhancement] Moving Average HOT 1
- Rain values are not accurate enough HOT 2
- data no more imported in influxdb HOT 3
- Netatmo API changes: new auth method - customization needed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-telegraf-netatmo.