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

Directory Tree

Perl check dhcp

Rating
4 votes
Favoured:
0
Hits
119573
Files:
FileDescription
check_dhcp.plcheck_dhcp.pl
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This simplified plugin tests the availability of a given DHCP server using unicast delivery.
$ ./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
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
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).
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
bybehemju, May 16, 2010
1 of 1 people found this review helpful
Works great, even with DHCP servers on other networks thanks to unicast. But the timeout parameter seems to be ignored. Whatever the value is, the effective timeout is always less than 1 sec...
Any idea ?