Page 1 of 2

critical: No DHCPOFFERs were received

Posted: Thu Jan 23, 2020 12:56 pm
by vinmansbrew
So, as you can see, the error seems somewhat common here, but after searching through old posts, I haven't found anything overly helpful.

Background information.
nagios core 4.4.1, I know, there is an updated core, and maybe it would help, but I'd like to fix the issue, before updating.
The host and clients are running rhel 6.10.
They are NOT on the same subnet. Host would be on 192.168.100, and the clients would be on 192.168.40, for example.
All other checks work on the clients, only check_dhcp fails.
The firewall on both clients is OFF, but since the other checks work, I am assuming the hardware firewall has ports 67/68 open.
The ethernet adaptor names on the clients are NOT eth0, but instead em1. Why, I am not sure. Previous admin set them up and left no info regarding why the different names.
The 2 clients are both dhcp servers, set up identical, running basically as load balancers.

So, as things stand, the check_dhcp command fails, all other checks work. I checked the second dhcp server(I'll use dhcp1 and dhcp2), and it had a different check_dhcp command created. It is a much simpler command as it doesn't check for anything but if dhcpd is running, so nagios shows green for that 1, but that isn't really a fix.

I've checked permissions and currently they are rwxr-x-r-x root root. I have tried changing it to rwsrwxr-x nagios root, but it didn't make a difference.
If I run check_dhcp -i em1, I receive:
DHCP socket: 3
Hardware address: xxxxx
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 1090392876 (0x40FE132C)
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.

Keep in mind that both servers are functioning as intended, so they are working.

So, I am not sure what else to check. Most of the other topics on this, I have checked. I suppose I could install wireshark, but I've never used it, and since the other checks work, would it reveal anything?
I saw 1 person say the host and clients needed to be on the same subnet, but I am not sure why that would be.
Maybe the ethernet name is an issue? However, in nrpe, the adaptor name is specified.

Anyone have other ideas? Just know that I've done very little in nagios, so you might need to dumb it down some! :D

Re: critical: No DHCPOFFERs were received

Posted: Thu Jan 23, 2020 1:55 pm
by mbellerue
Is that the entirety of the check command? We can add some switches for additional troubleshooting. Also, is this check_dhcp being run from just the Nagios server, or are you running it through one of the client machines via like NRPE or NCPA?

Here are the flags we'll add for additional troubleshooting:

-v for verbose output
-s <DHCP Server IP Address> This might help if we're running the check from Nagios against a DHCP server that is on another subnet. I imagine this is only a problem if you have a dedicated DHCP server per subnet. Which seems overkill, but every environment has its own unique requirements.

Also no worries on updating to 4.4.5. I wouldn't see that helping here. The plugins are a project unto themselves. If you wanted to update the plugins, maybe that would help if they were significantly out of date. To that end, could you also give the output of check_dhcp --help The very first line should be the plugins version number.
https://github.com/nagios-plugins

Re: critical: No DHCPOFFERs were received

Posted: Thu Jan 23, 2020 2:06 pm
by vinmansbrew
Well, I did add to the command: check_dhcp -v -s "ip" -i em1 -u
Now, as root, it runs and succeeds. When run as an automatic check, it fails, possible permissions. So, the error is now different.
Permissions are now rwxrwxr-w nagios nagios.
So, I am guessing I have something off in permissions for the check_dhcp command.

Re: critical: No DHCPOFFERs were received

Posted: Thu Jan 23, 2020 2:16 pm
by mbellerue
Try setting the command to be owned by the apache user and nagios group. So in Debian/Ubuntu it would be chown www-data:nagios

Also you can try running it as the nagios user and see if it gives you a better errors. su - nagios Make sure you have the - in there. Also what's the output of grep "nagios" /etc/group

Re: critical: No DHCPOFFERs were received

Posted: Thu Jan 23, 2020 2:37 pm
by vinmansbrew
So, I changed perms to rwsrwxr-x root root and now it is running as it should be. At least so far! Using the un-modified check_dhcp command, so it is checking dhcpoffers and coming back green!

Thanks mbellerue!

Re: critical: No DHCPOFFERs were received

Posted: Thu Jan 23, 2020 4:40 pm
by vinmansbrew
So, I am going to piggyback on this.
Now that things looks to be working, if I turn off the dhcpd service, should I receive an notification about that? If so, how long would it take?
Right now, I can turn of dhcpd, and run the check_dhcp command manually, and it is still successful. Maybe that is how it works? Seems odd, but then I wouldn't really know!

If the check_dhcp doesn't watch for the dhcpd service, is there a plugin that does?

Re: critical: No DHCPOFFERs were received

Posted: Thu Jan 23, 2020 8:06 pm
by Box293
So you are talking about different topics here.
vinmansbrew wrote:If the check_dhcp doesn't watch for the dhcpd service, is there a plugin that does?
NCPA will be able to be used as an agent to check if a service is running or not.
vinmansbrew wrote:Right now, I can turn of dhcpd, and run the check_dhcp command manually, and it is still successful. Maybe that is how it works? Seems odd, but then I wouldn't really know!
If the check still succeeds then something is not right. When you use the -s argument, if a DHCP offer is not received from the server then the plugin should fail.

Perhaps there is another machine on the network answering DHCP requests?

To diagnose deeper you'll need to use some packet capture software to see what is actually going on.

Re: critical: No DHCPOFFERs were received

Posted: Fri Jan 24, 2020 9:33 am
by vinmansbrew
Yeah, I thought I'd just ride my original post, since I was still partly on the same subject with the check_dhcp command.

Looks like ncpa is a different nagios tool? I'd prefer to stay with core, since it's already on all my other servers. I am checking some other plugins to see what there is.

I figured the plugin should fail, I do have to dhcp servers on the same subnet. I'm pretty sure I tried stopping the dhcpd service on both, and then running the manual command. Pretty sure, I think!

Re: critical: No DHCPOFFERs were received

Posted: Fri Jan 24, 2020 3:59 pm
by scottwilkerson
vinmansbrew wrote:Looks like ncpa is a different nagios tool?
NCPA is an agent that works with Nagios on remote servers

Re: critical: No DHCPOFFERs were received

Posted: Tue Jan 28, 2020 10:59 am
by vinmansbrew
So, for continuity of this thread.
I found a different command I could use. I named it check_dhcp_m and it is a simple check:
#!/bin/bash
if [ `/bin/ps -ef | /bin/grep dhcpd | /usr/bin/wc -l` -ge 2 ]; then
echo "DHCP OK"
exit 0
else
echo "Warning - DHCP is NOT running"
exit 2

fi
And it just checks for the dhcpd service, nothing more.
So, if the dhcpd service stops, I get notified of that.

However, I still have the issue that if I stop the dhcpd service, the regular check_dhcp command still passes. I am under the impression that if dhcpd stopped, the server could not do dhcpd offers anymore. So, that should mean that this command should fail.
However, that is not the case. I DO have another dhcp server on linux, and I think there are a couple dhcp windows servers, but I don't do windows. Is it possible that 1 of those servers is somehow allowing the check_dhcp command to still pass?

Or does it just pass as long as configurations are correct?

If this is the case, is there a check that can be done for when the dhcpd service is running, but not fuctioning properly, such as if there are no free leases?