Page 2 of 2
Re: DHCP Monitoring
Posted: Thu Mar 02, 2017 7:28 am
by CJIndustries
Tried using the interface name with the command and I got the same results. I just don't get it. DHCP is running and if I activate the second nic, it gets an ip address from the dhcp server.
Re: DHCP Monitoring
Posted: Thu Mar 02, 2017 12:10 pm
by tgriep
Lets take the check_dhcp plugin out of the loop and try using dhclient to see if the server can contact the DNCP server.
Ron this as root substituting eth0 with your ethernet interface.
You should see something like the following if the nagios server can connect to your dhcp server.
Code: Select all
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:0c:29:ca:53:6d
Sending on LPF/eth0/00:0c:29:ca:53:6d
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4 (xid=0x74af030a)
DHCPOFFER from 192.168.112.254
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x74af030a)
DHCPACK from 192.168.112.254 (xid=0x74af030a)
bound to 192.168.112.134 -- renewal in 2431296 seconds.
Please post the output.
When the above command runs, it creates a secondary interface on the server with the IP address from the DHCP server.
Run this as root and post the output.
To remove the secondary interface, you will have to restart the network on the server by running.
This may cause an outage on your Nagios server.
Re: DHCP Monitoring
Posted: Thu Mar 02, 2017 12:46 pm
by CJIndustries
Correct me if I'm wrong, but it looks like it worked.
[root@NAGIOS ~]# dhclient eth0 -n -v
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit
https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:60:56:89:5a:5c
Sending on LPF/eth0/00:60:56:89:5b:5c
Sending on Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x57f4a80f)
DHCPACK from 10.1.1.100 (xid=0x57f5a80f)
bound to 10.1.2.23 -- renewal in 285656 seconds.
[root@NAGIOS ~]#
Re: DHCP Monitoring
Posted: Thu Mar 02, 2017 1:46 pm
by tgriep
Yes, that looks like it worked.
Can you run the following and post the output?
Code: Select all
/usr/local/nagios/libexec/check_dhcp -V
/usr/local/nagios/libexec/check_dhcp
Re: DHCP Monitoring
Posted: Thu Mar 02, 2017 2:16 pm
by CJIndustries
[root@NAGIOS ~]# /usr/local/nagios/libexec/check_dhcp -V
check_dhcp v2.0.3 (nagios-plugins 2.0.3)
[root@NAGIOS ~]# /usr/local/nagios/libexec/check_dhcp -V
CRITICAL: No DHCPOFFERs were received.
[root@NAGIOS ~]#
Re: DHCP Monitoring
Posted: Thu Mar 02, 2017 3:47 pm
by tgriep
The version of the check_dhcp plugin is the same one I tested with.
You can try and update the plugins on the system and see if that works. They can be downloaded from this link
Code: Select all
https://www.nagios.org/downloads/nagios-plugins/
Or you can add the -u option to minic a DHCP Relay and see if that works.
Please provide the full output when you run the plugin.
Re: DHCP Monitoring
Posted: Fri Mar 03, 2017 7:09 am
by CJIndustries
Looks like adding the "-u" gets it to work. Do you think because the interface already has an ip address, the dhcp server does not want to give an address to the same mac? Acting as a relay tricks the dhcp server to give out an address. I checked the dhcp leases and there is no name for the address, but it does have the same mac as eth0. What do you think?
[root@NAGIOS libexec]# ./check_dhcp -u -s 10.1.1.100 -v
DHCP socket: 3
Hardware address: 00:50:56:89:5c:4b
Pretending to be relay client 10.1.1.125
DHCPDISCOVER to 10.1.1.100 port 67
DHCPDISCOVER XID: 1759410499 (0x68DD79A7)
DHCDISCOVER ciaddr: 0.0.0.0
DHCDISCOVER yiaddr: 0.0.0.0
DHCDISCOVER siaddr: 0.0.0.0
DHCDISCOVER giaddr: 10.1.1.125
send_dhcp_packet result: 548
recv_result_1: 300
recv_result_2: 300
receive_dhcp_packet() result: 300
receive_dhcp_packet() source: 10.1.1.100
Result=OK
DHCPOFFER from IP address 10.1.1.100 via 10.1.1.100
DHCPOFFER XID: 1759414599 (0x68DD79A7)
DHCPOFFER chaddr: 005056895C5B
DHCPOFFER ciaddr: 0.0.0.0
DHCPOFFER yiaddr: 10.1.1.23
DHCPOFFER siaddr: 10.1.1.100
DHCPOFFER giaddr: 10.1.1.125
Option: 53 (0x01)
Option: 1 (0x04)
Option: 58 (0x04)
Option: 59 (0x04)
Option: 51 (0x04)
Option: 54 (0x04)
Lease Time: 691200 seconds
Renewal Time: 345600 seconds
Rebinding Time: 604800 seconds
Added offer from server @ 10.1.1.100 of IP address 10.1.1.23
No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 1
Valid responses for this machine: 1
DHCP Server Match: Offerer=10.1.1.100 Requested=10.1.1.100
OK: Received 1 DHCPOFFER(s), 1 of 1 requested servers responded, max lease time = 691200 sec.
[root@NAGIOS libexec]#
Re: DHCP Monitoring
Posted: Fri Mar 03, 2017 10:45 am
by tgriep
What it could be is a option setting on your DHCP server that is keeping the default check_dhcp command from working but the unicast "-u" setting works in your environment.
Re: DHCP Monitoring
Posted: Fri Mar 03, 2017 11:20 am
by CJIndustries
Something to keep in mind. Thanks for the help.
Re: DHCP Monitoring
Posted: Fri Mar 03, 2017 11:26 am
by dwhitfield
It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!