Download the dhcpd
Extend script
wget https://raw.githubusercontent.com/librenms/librenms-agent/refs/heads/master/snmp/dhcp.py -O /etc/snmp/dhcp.py
Create a config file for the script. This is only to tell the script where the dhcpd
leases file is located.
bash -c "cat > /etc/snmp/dhcp.json"<<'EOF'
{"leasefile": "/var/lib/dhcp/dhcpd.leases"}
EOF
Change the script's mode
chmod +x /etc/snmp/dhcp.py
Extend the snmpd
config with the new script
echo -e "\nextend dhcpstats /etc/snmp/dhcp.py" >> /etc/snmp/snmpd.conf
Restart snmpd
systemctl restart snmpd.service
With snmpd already installed, download the SNMP Extend script for PDNS
wget https://github.com/librenms/librenms-agent/raw/master/snmp/powerdns.py -O /etc/snmp/powerdns.py
Make the script executable
chmod +x /etc/snmp/powerdns.py
Allow the Debian-snmp
user to execute the script using sudo without a password
echo "Debian-snmp ALL = NOPASSWD: /etc/snmp/powerdns.py" >> /etc/sudoers.d/snmp-extend
Configure the script in the main snmpd config. Add the following line to /etc/snmp/snmpd.conf
echo -e "\n#PDNS Authoratative Server\nextend powerdns /usr/bin/sudo /etc/snmp/powerdns.py" >> /etc/snmp/snmpd.conf
Restart snmpd
systemctl restart snmpd.service
Everything together
wget https://github.com/librenms/librenms-agent/raw/master/snmp/powerdns.py -O /etc/snmp/powerdns.py
chmod +x /etc/snmp/powerdns.py
echo "Debian-snmp ALL = NOPASSWD: /etc/snmp/powerdns.py" >> /etc/sudoers.d/snmp-extend
echo -e "\n#PDNS Authoratative Server\nextend powerdns /usr/bin/sudo /etc/snmp/powerdns.py" >> /etc/snmp/snmpd.conf
systemctl restart snmpd.service
With snmpd already installed, download the SNMP Extend script for PDNS
wget https://github.com/librenms/librenms-agent/raw/master/snmp/powerdns-recursor -O /etc/snmp/powerdns-recursor
Make the script executable
chmod +x /etc/snmp/powerdns-recursor
Allow the Debian-snmp
user to execute the script using sudo without a password
echo "Debian-snmp ALL = NOPASSWD: /etc/snmp/powerdns-recursor" >> /etc/sudoers.d/snmp-extend
Configure the script in the main snmpd config. Add the following line to /etc/snmp/snmpd.conf
echo -e "\n#PDNS Recursive Server\nextend powerdns-recursor /usr/bin/sudo /etc/snmp/powerdns-recursor" >> /etc/snmp/snmpd.conf
Restart snmpd
systemctl restart snmpd.service