librenms / librenms-agent

LibreNMS Agent & Scripts
GNU General Public License v2.0
118 stars 188 forks source link

Pi-Hole script: `DHCP_ACTIVE` can generate an error if its not defined #366

Closed Chewie9999 closed 1 year ago

Chewie9999 commented 3 years ago

DHCP_ACTIVE can generate an error if its not defined

root@dockerserver:~# /etc/snmp/pi-hole
0
48342
2
0.004137
11953
41139
6993
68.57
0.58
2.67
0.13
/etc/snmp/pi-hole: line 101: DHCP_ACTIVE: unbound variable
root@dockerserver:~#

my example: i run pi-hole in a docker container so the docker-host connects to the container ip itself to get stats, so it doesnt know anything about the config file or how to read it, only way around this is to set DHCP_ACTIVE='false' inside the pi-hole script itself

Originally posted by @si458 in https://github.com/librenms/librenms-agent/issues/351#issuecomment-826080192

Chewie9999 commented 3 years ago

PR will be generated to add a test for existence of DHCP_ACTIVE environment variable