Check_DHCP

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mattyra
Posts: 11
Joined: Sun Jan 05, 2014 5:32 pm

Check_DHCP

Post by mattyra »

Hi All,

I am sure this has been asked thousands of times (in fact I know it has because I have read them all) but I am still unable to get this plugin to work.

Our current network has 2 sites that have a WAN link connecting the sites. I have 2 routers in the middle as you would expect. First off the box Nagios is installed on is also the DHCP server for one of the sites which returns "No DHCPOFFERs were received." This exact same message was given for when monitoring the second DHCP server which is on the other site. Because of this I decided to try and setup NRPE to monitor DHCP. I get exactly the same error.

just wondering what I am doing wrong. I have changed the permissions on the check_dhcp file (which is what a lot generally suggest), I have also turned off iptables to test but I am not having any luck.

Thanks,
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Check_DHCP

Post by Box293 »

I think iptables is causing your issue.

In the Nagios host, the following iptables commands are required:

Code: Select all

iptables -I INPUT -i eth0 -p udp --dport 68 -j ACCEPT
service iptables save

When you execute the check_dhcp request, the Nagios host must be on the same physical network segment as the DHCP server.

Code: Select all

./check_dhcp
OK: Received 1 DHCPOFFER(s), max lease time = 600 sec.

If you want to ensure that a specific DHCP server is working, you can target it.

Code: Select all

./check_dhcp -s xxx.xxx.xxx.xxx
OK: Received 1 DHCPOFFER(s), 1 of 1 requested servers responded, max lease time = 600 sec.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mattyra
Posts: 11
Joined: Sun Jan 05, 2014 5:32 pm

Re: Check_DHCP

Post by mattyra »

Thanks for the reply. I have tried to run without IPTables but it still doesn't work. I was thinking it could be that the Nagios box is also the DHCP server with a static IP Address so shouldn't receive an Offer. Could this be my issue?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Check_DHCP

Post by Box293 »

What happens when you run with vebosity?:

Code: Select all

check_dhcp -vvv
Also, do the DHCP server logs show anything?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mattyra
Posts: 11
Joined: Sun Jan 05, 2014 5:32 pm

Re: Check_DHCP

Post by mattyra »

DHCP socket: 3
Hardware address: 00:25:90:e0:2d:86
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 486887484 (0x1D05503C)
DHCDISCOVER ciaddr: 0.0.0.0
DHCDISCOVER yiaddr: 0.0.0.0
DHCDISCOVER siaddr: 0.0.0.0
DHCDISCOVER giaddr: 0.0.0.0
send_dhcp_packet result: 548




No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 0
Valid responses for this machine: 0
CRITICAL: No DHCPOFFERs were received.
mattyra
Posts: 11
Joined: Sun Jan 05, 2014 5:32 pm

Re: Check_DHCP

Post by mattyra »

Sorry, forgot to post that the DHCP server logs are not showing anything.

Thanks,
mattyra
Posts: 11
Joined: Sun Jan 05, 2014 5:32 pm

Re: Check_DHCP

Post by mattyra »

I have just tried from another linux install (I built to test this) and it worked.

I am thinking that it has something to do with not being able to run the check_dhcp command from the server the DHCP server is run.

A bit of a bugger but possibly not the end of the world.

Thanks,
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Check_DHCP

Post by abrist »

mattyra wrote: I am thinking that it has something to do with not being able to run the check_dhcp command from the server the DHCP server is run.
Possibly. check_dhcp connects to the sever and asks for a lease. There is a chance that the dhcp server was not configured to offer itself a lease.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
mattyra
Posts: 11
Joined: Sun Jan 05, 2014 5:32 pm

Re: Check_DHCP

Post by mattyra »

Thanks Abrist. That was the conclusion I had come to. Was a little bit of a problem being that I don't have two Linux servers in the office. I have just finished a VM which I moved some conferencing software to which I was able to run the check_DHCP command from. No new hardware and no more costs keeps the bosses happy.

I also altered the check_nrpe command so that I was able to make the check appear as if it was from the server hosting DHCP on the web interface and email notifications. A bit of a long way around the issue but it works extremely well.

I will now have to move onto my next Nagios request. I will hopefully solve it on my own so I don't need to open more tickets but we will see.

Thanks Box293 for all of your help :D
Locked