Open madmann26 opened 3 years ago
Hi @madmann26, thanks for your feedback!
first, you can check within the container if the telegraf.conf
is mounted, just to be sure and check if the file has the changes you expect. If not, then obviously telegraf uses the default config.
About the permissions you posted: telegraf.conf
in the container belongs to root. Maybe that indeed causes issues. So you can try to configure the config through ENV, for example enable debug mode to see what metrics are actually collected or if telegraf complains about permissions. This method allows you to dynamically configure your telegraf.conf
with any number of ENV variables.
CONF_UPDATE=/etc/telegraf/telegraf.conf
CONF_PREFIX=TEL
TEL_AGENT_DEBUG=agent.debug=true
I hope this helps.
So I think I found my issue and I don't know how to fix it within docker. I copied my .conf files from my previous machine build to use them in docker (why re-event the wheel?).
I went into the container, ran telegraf and specified the .conf file and --test and it spit back the error about not having my Ubiquiti SNMP files -
bash-5.1# telegraf --config /etc/telegraf/telegraf.d/ap.conf --test 2021-10-12T13:48:24Z I! Starting Telegraf 1.20.2 2021-10-12T13:48:25Z E! [inputs.snmp] Error in plugin: initializing table : translating: MIB search path: /root/.snmp/mibs:/usr/share/snmp/mibs Cannot find module (UBNT-UniFi-MIB): At line 1 in (none) UBNT-UniFi-MIB::unifiRadioTable: Unknown Object Identifier: exit status 2 2021-10-12T13:48:25Z E! [telegraf] Error running agent: input plugins recorded 1 errors
Well, you basically have 2 options:
Ok, there is option 3: if the size of those ubiquity files is small and I can get them with apt
, let me know which package to add and I'll release an update. However I would not want to add tens of MB to the docker, because that would affect every user including the majority probably not using SNMP with Ubiquity.
So I've gotten past my own stupidity. I forgot to uncomment the url line in the telegraf.conf under outputs.influxdb config. Telegraf logs show data is being written but I cannot find it.
today at 5:20:59 PM 2021-10-12T21:20:59Z D! [outputs.influxdb] Wrote batch of 25 metrics in 4.888294ms today at 5:20:59 PM 2021-10-12T21:20:59Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
@DrPsychick -
Thanks for the help. The data I was seeing written wasn't of my network gear. So, fast forward another 12 hours, more reading/researching and I ended up with this:
docker-compose.yml volume modifications -
Added related SNMP files to /usr/share/snmp/mibs.
Added my .conf files for my gear into the telegraf.conf file. (not ideal)
I never could get docker telegraf to read from /etc/telegraf/telegraf.d directory to pick up my .conf files.
But I have data. That was the goal.
FYI: the new base image uses telegraf
as user. Or maybe I've missed that transition earlier. So the files belong to user ID 100.
/ $ ls -lan /etc/telegraf/
total 340
drwxr-xr-x 3 100 101 4096 Oct 29 01:32 .
drwxr-xr-x 1 0 0 4096 Oct 30 15:46 ..
-rw-r--r-- 1 100 101 334752 Oct 27 23:06 telegraf.conf
drwxr-xr-x 2 100 101 4096 Oct 29 01:32 telegraf.d
Hi,
So, I'm new to this and I'm probably doing it wrong.
I used your docker-compose file, added the volume '- "/etc/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro"'.
For the life of me, I cannot figure out why telegraf doesn't read my .conf files. Telegraf appears to be polling the localhost as intended, as I can see measurements in influx. I've added the .conf files to /etc/telegraf/telegraf.d directory, just as I did on my regular build machine.
I can initiate a poll manually from the container itself, specifying the .conf file and it will do the snmp walk, as expected.
I also cannot edit the telegraf.conf file in the container itself. When I look at the file permissions, it shows:
-rw-r--r-- 1 989 983 334096 Oct 12 09:30 telegraf.conf
The container does run successfully:
today at 5:46:58 AM Container started today at 5:45:34 AM 2021-10-12T09:45:34Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"localhost.localdomain", Flush Interval:10s today at 5:46:58 AM 2021-10-12T09:46:58Z I! Starting Telegraf 1.20.2 today at 5:46:58 AM 2021-10-12T09:46:58Z I! Using config file: /etc/telegraf/telegraf.conf today at 5:46:58 AM 2021-10-12T09:46:58Z I! Loaded inputs: cpu disk diskio kernel mem processes swap system today at 5:46:58 AM 2021-10-12T09:46:58Z I! Loaded aggregators: today at 5:46:58 AM 2021-10-12T09:46:58Z I! Loaded processors: today at 5:46:58 AM 2021-10-12T09:46:58Z I! Loaded outputs: influxdb today at 5:46:58 AM 2021-10-12T09:46:58Z I! Tags enabled: host=localhost.localdomain today at 5:46:58 AM 2021-10-12T09:46:58Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"localhost.localdomain", Flush Interval:10s
Any ideas?
Thanks for the help in advance.