Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Perl check dhcp
$ ./check_dhcp.pl -h
Copyright (C) 2006 Carlos Vicente. University of Oregon.
This plugin tests the availability of a given DHCP server using unicast delivery. This is necessary if the monitoring host is on a different subnet. Using broadcast and a DHCP relay would also prevent the check from probing individual servers.
Usage: check_dhcp -H|--host -i|--interface --timeout
-H, --host=ADDRESS
IP address of DHCP server that we must hear from
-i, --interface=STRING
Interface to to use for listening (i.e. eth0)
-t, --timeout=INTEGER
Seconds to wait for DHCPOFFER before timeout occurs (default: 5)
-h, --help
Print detailed help screen
Note: This plugin will need to run with root permissions in order to access priviledged ports 67 & 68. Since Nagios by default runs its plugins under unpriviledged user 'nagios', you will need to setuid root like:
% chown root:root check_dhcp.pl
% chmod 4755 check_dhcp.pl
Copyright (C) 2006 Carlos Vicente. University of Oregon.
This plugin tests the availability of a given DHCP server using unicast delivery. This is necessary if the monitoring host is on a different subnet. Using broadcast and a DHCP relay would also prevent the check from probing individual servers.
Usage: check_dhcp -H|--host -i|--interface --timeout
-H, --host=ADDRESS
IP address of DHCP server that we must hear from
-i, --interface=STRING
Interface to to use for listening (i.e. eth0)
-t, --timeout=INTEGER
Seconds to wait for DHCPOFFER before timeout occurs (default: 5)
-h, --help
Print detailed help screen
Note: This plugin will need to run with root permissions in order to access priviledged ports 67 & 68. Since Nagios by default runs its plugins under unpriviledged user 'nagios', you will need to setuid root like:
% chown root:root check_dhcp.pl
% chmod 4755 check_dhcp.pl
Reviews (4)
If you get the error "No response from server", make sure your Nagios server is registered in DHCP (hopefully as a reservation). Even if your linux box is static, you still need to make a reservation for this plugin to work.
Besides that, this plugin works good. You may only request 1 DHCP at a time, so you need to call this plugin multiple times, which means multiple services in Nagios.
This is because this plugin uses perl module Net::DHCP::Watch. A limitation of this module is that the requesting mac address already be in the DHCP server. Module info: https://metacpan.org/pod/Net::DHCP::Watch
Besides that, this plugin works good. You may only request 1 DHCP at a time, so you need to call this plugin multiple times, which means multiple services in Nagios.
This is because this plugin uses perl module Net::DHCP::Watch. A limitation of this module is that the requesting mac address already be in the DHCP server. Module info: https://metacpan.org/pod/Net::DHCP::Watch
bycayfer, November 29, 2012
Mmmm.. check_dhcp command didn't work for me. I specified a remote DHCP server ( a server sitting on a different subnet than my Nagios server) with the -s option and set the -u flag but couldn't get a response (offering).
bygrittyminder, June 1, 2010
This plugin requires that IO::Interface (among other things) be installed. If you do not want to install a bunch of perl modules on your monitoring server then this could be problematic.
The check_dhcp plugin that comes with Nagios Plugins package allows you to do unicast DHCP checking. Try the following:
check_dhcp -u -s
The check_dhcp plugin that comes with Nagios Plugins package allows you to do unicast DHCP checking. Try the following:
check_dhcp -u -s