ISC DHCP Stats
A small python3 script that reports current DHCP leases stats and pool usage of ISC DHCP Server.
Also you have to install the dhcpd-pools and the required Perl modules.
Install prerequisites
apt install cpanminus libmime-base64-perl libfile-slurp-perl
cpanm Net::ISC::DHCPd::Leases
pkg install p5-JSON p5-MIME-Base64 p5-App-cpanminus p5-File-Slurp
cpanm Net::ISC::DHCPd::Leases
cpanm Net::ISC::DHCPd::Leases MIME::Base64 File::Slurp
SNMP Extend
-
Copy the shell script to the desired host.
wget https://github.com/librenms/librenms-agent/raw/master/snmp/dhcp -O /etc/snmp/dhcp -
Make the script executable
chmod +x /etc/snmp/dhcp -
Edit your snmpd.conf file On a slow system, run the script from cron.
edit (usually
/etc/snmp/snmpd.conf) and add:extend dhcpstats /etc/snmp/dhcp -zedit (usually
/etc/snmp/snmpd.conf) and add:extend dhcpstats /etc/snmp/dhcp -Z -w /var/cache/dhcp_extendSetup cronjob to run every 5 minutes. add the following to cron
\etc/crontab.d/librenms_dhcp:*/5 * * * * /etc/snmp/dhcp -Z -w /var/cache/dhcp_extendThe following options are also supported.
Option Description -c $filePath to dhcpd.conf. -l $filePath to lease file. -ZEnable GZip+Base64 compression. -dDo not de-dup. -w $fileFile to write it out to. -
Restart snmpd on your host
LibreNMS discovers the application automatically, as described at the top of the page. If the discovery fails, do the steps under the
SNMP Extendheading at the top of the page.