Just to update on my issue, since Telegraf is polling SNMP I don’t actually need ports to be mapped on the host.
I found out that I had the issue here: https://github.com/influxdata/telegraf/issues/4896 with that “apt install snmp snmp-mibs-downloader” I downloaded more MIB’s and then used the solution here: https://github.com/influxdata/telegraf/issues/5837 to copy in the MIB’s, then it started working for me.
However, you need to copy the iana and ietf folder separately in to the container and then restart.
Now I only have this error from Telegraf left in the log:
2020-05-06T16:08:00Z E! [inputs.sensors] Error in plugin: failed to run command /usr/bin/sensors -A -u: exit status 1 - No sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.
@Lajo can you explain what you did exactly please? Did you do the apt get snmp-mibs-downloader, and then copy from your host computer? if so i don’t think there is a way to automatically do this. I am happy to put a hacky workaround in the readme but maybe i’ve missed something? like the mibs downloader does it automatically?
@Sabuto
I think you have to include it in the actual docker image so if you are using an existing docker image for Telegraf you/we need to request that whoever builds that adds these in.
apt install snmp snmp-mibs-downloader - This will install and download more MIB's to /usr/share/snmp/mibs/.
sudo docker exec -it <dockerid for telegraf add-on>ls /usr/share/snmp/mibs/ - This is just to see what MIBs are present in the docker container.
sudo docker cp /usr/share/snmp/mibs/. <dockerid for telegraf add-on>:/usr/share/snmp/mibs/ - This will copy the contents of mib in to the docker container.
sudo docker exec -it <dockerid for telegraf add-on> rm -r /usr/share/snmp/mibs/iana - For some reason it will copy iana and ietf directory as files in to the docker container so I have to remove them before copying the right dir.
sudo docker exec -it <dockerid for telegraf add-on> rm -r /usr/share/snmp/mibs/ietf
sudo docker cp /usr/share/snmp/mibs/iana/. <dockerid for telegraf add-on>:/usr/share/snmp/mibs/iana
sudo docker cp /usr/share/snmp/mibs/ietf/. <dockerid for telegraf add-on>:/usr/share/snmp/mibs/ietf
The problem with hassio addons is that we cant add files from every point on the computer I will put this in the readme as a workaround. I will look at maybe putting it in the share folder then symlinking let me have a think
Also will you do me a favour and start a brand new hassio telegraf instance and try doing the apt get inside the container and see if it installs all the required mibs inside the container without having to copy them?
@Sabuto I tried running the “apt install snmp snmp-mibs-downloader” inside the container but it seems that the repo is not there for it.
I get this output:
lars@HA:~$ sudo docker exec -it 3ed763cd06a6 apt install snmp snmp-mibs-downloader
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package snmp-mibs-downloader is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘snmp-mibs-downloader’ has no installation candidate
To my understanding if you add this in the Dockerfile:
RUN echo “deb Index of /ubuntu/ bionic main multiverse” > /etc/apt/sources.list
The important part being the that the repo is for bionic main mutliverse.
And then add “snmp snmp-mibs-downloader” to your existing apt install section it should work.
If that cannot be done, finding a way to map the hosts local MIB directory is a good solution as well.
@Sabuto I would like to use mqtt instead of the influxDB, is it possible? If so, could you give me steps to follow or point me in the direction to some docs to read. Also when I enable the custom_conf i get an error: cp: cannot stat ‘/share/telegraf.con’: No such file or directoy. One more thing, is it possible to edit the conf file that’s located at /etc/telegraf/telegraf.conf? Thank you for the addon, hope to be able to use it.
Based on the error message you’re pasting it looks like you’ve deleted the last “f” in “/share/telegraf.conf” somewhere, presumably in the hassio config page.
I don’t use SNMP, but I have a full telegraf monitor running on my Synology NAS (DS218+) using docker-composer (cli):
telegraf:
image: telegraf
container_name: telegraf
privileged: true
hostname: telegraf.synology.lan
command:
- /bin/bash
- -c
- | # This is so I can run smart tools
apt update
apt install -y smartmontools
telegraf
environment:
- HOST_MOUNT_PREFIX=/hostfs
- HOST_ETC=/hostfs/etc
- HOST_PROC=/hostfs/proc
- HOST_SYS=/hostfs/sys
- HOST_VAR=/hostfs/var
- HOST_RUN=/hostfs/run
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /run/udev:/run/udev:ro # for `diskio` - not sure if I need it on synology...
- /volume1/docker/influxdb/telegraf.conf:/etc/telegraf/telegraf.conf:ro
- /:/hostfs:ro
My configuration is pretty bare. I started from a blank file, and just added things until the (default) dashboards started filling out, plus a couple extras (e.g. pihole):
[[inputs.docker]]
endpoint = "unix:///var/run/docker.sock"
[[inputs.disk]]
mount_points = ["/hostfs/volume1"]
[[inputs.filecount]]
directories = ["/hostfs/var/log","/hostfs/volume1/downloads","/hostfs/volume1/homes" ]
[[inputs.smart]]
[[inputs.diskio]]
[[inputs.processes]]
[[inputs.net]]
# [[inputs.procstat]] # This requires glob patters for matching, and I don't know the details (yet) for synology
[[inputs.netstat]]
[[inputs.system]]
[[inputs.mem]]
[[inputs.kernel]]
[[inputs.cpu]]
percpu = false
report_active = true
[[inputs.influxdb]]
urls = ["http://influxdb:8086/debug/vars"]
[[inputs.httpjson]]
name = "diskless_pihole_stats"
servers = [
"http://pi.hole/admin/api.php",
]
response_timeout = "5s"
method = "GET"
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
@Sabuto, I’m getting an error trying to save the config. Could something have changed in HA 0.117 that broke this?
Failed to save addon configuration, not a valid value for dictionary value @ data['options']. Got {'custom_conf': {'enabled': True, 'location': '/config/telegraf.conf'}}
I am trying to add this to Home Assistant OS 2020.12.2 (current release, pi disk image). I am seeing this with several repositories I’ve tried to add. I can open an issue on github if you like.
2021-01-02T16:39:20Z E! [outputs.influxdb] When writing to [http://a0d7b954-influxdb:8086]: 500 Internal Server Error: retention policy not found: 7d
2021-01-02T16:39:20Z E! [agent] Error writing to outputs.influxdb: could not write any address
same error here:
2021-01-17T21:23:50Z E! [agent] Error writing to outputs.influxdb: could not write any address
2021-01-17T21:24:00Z E! [outputs.influxdb] When writing to [http://a0d7b954-influxdb:8086]: 500 Internal Server Error: retention policy not found: null