Home Directory Plugins Network Protocols DHCP and BOOTP DHCP server Responses to discover / inform requests through nmap

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

DHCP server Responses to discover / inform requests through nmap

Rating
0 votes
Favoured:
0
Current Version
0.3
Last Release Date
2019-09-01
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
License
GPL
Hits
222
Files:
FileDescription
check_dhcp_extShell Script
check_dhcp_ext_README.txtReadme file with description and installation instructions
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
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)
requires nmap passwordless access by nagios
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)


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