Very basic Bash script to check dhcp server through DHCPDISCOVER or DHCPINFORM querys. Results are parsed and returned to nagios. requires nmap and dhcp-discover.nse (nmap script) parameters: check_dhcp_ext [DHCPDISCOVER] hostname if dhcpdiscover is not specified, it defaults to dhcpinform eg (reply to a discover) Status information : DHCP OK: DHCP Message Type: DHCPOFFER Performance Data : Server Identifier: 10.0.0.1 - IP Offered: 10.0.0.31 - IP Address Lease Time: 2h00m00s - Subnet Mask: 255.255.255.0 - Router: 10.0.0.1 - Domain Name Server: 10.0.0.1 - Domain Name: homenetwork - NetBIOS Name Server: 10.0.0.1 - MAC Address: 00:CC:66:E6:99:CC (Sitecom Europe BV) (reply to an inform) Status Information: DHCP OK: DHCP Message Type: DHCPACK Performance Data: Server Identifier: 10.0.0.1 - Router: 10.0.0.1 - Domain Name Server: 10.0.0.1 - Domain Name: homenetwork - NetBIOS Name Server: 10.0.0.1 - MAC Address: 00:0C:F6:E6:59:CC (Sitecom Europe BV) Installation Instructions : Install the script in nagios plugin directory (eg. /usr/local/nagios/libexec Check the script for binary locations (sudo and nmap) make root/nagios owned chown root:nagios check_dhcp_ext make it executable sudo chmod ug+x check_dhcp_ext let nagios run nmap as root passwordless : add nagios ALL=(root) NOPASSWD:/usr/bin/nmap to /etc/sudoers.d/010_nagios-nopasswd add nagios commands : define command { command_name check_dhcp_inform command_line $USER1$/check_dhcp_ext $HOSTADDRESS$ } define command { command_name check_dhcp_discover command_line $USER1$/check_dhcp_ext DHCPDISCOVER $HOSTADDRESS$ } add nagios services define service { use local-service host_name gateway service_description DHCP-discover check_command check_dhcp_discover } Enjoy the plugin, feedback always welcome! kalanikta@gmail.com