check_dhcp on DHCP servers on balanced mode

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
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

check_dhcp on DHCP servers on balanced mode

Post by nlabardi »

I've 2 windows 2012 server with DHCP server in balanced mode,
I'd like to check the status by check_dhcp but the resut of slave dhcp server in unreliable.( the Status Information is always of the master)

I'v this scenario...
Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-42-generic x86_64)
Nagios® Core™ 4.3.4
nagios-plugins-2.2.1

follow my test...
2 server 10.18.2.20 and 10.20.2.20 (DHCP SERVER BALANCED)

I've disabled the scope on secondary server...

these checks from the cli:
./check_dhcp -s 10.18.2.20 -m 123456789012 -r 10.18.2.254 -u -i eth0
OK: Received 1 DHCPOFFER(s), 1 of 1 requested servers responded, requested address (10.18.2.254) was offered, max lease time = 3600 sec.

./check_dhcp -s 10.20.2.20 -m 123456789012 -r 10.18.2.254 -u -i eth0
CRITICAL: No DHCPOFFERs were received.


but on service page the status is:
Status Information: OK: Received 2 DHCPOFFER(s), max lease time = 3600 sec

cli check Nagios page
SRV MASTER SCOPE ON ok ok
SRV SLAVE SCOPE ON ok ok

SRV MASTER SCOPE ON ok ok
SRV SLAVE SCOPE OFF ERR ok

SRV MASTER SCOPE OFF ERR err
SRV SLAVE SCOPE ON ok err
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_dhcp on DHCP servers on balanced mode

Post by npolovenko »

Hello, @nlabardi. So when you ran these checks from the command line you got the correct output, but in the Nagios web interface, you're seeing a different status. Correct?
Please upload the service check definitions from the Core server as well as the command definition.
Please upload the nagios.log file that can be found here: /usr/local/nagios/var/nagios.log
Please sign in as the nagios user, run these commands and show me the output:
su - nagios
cd /usr/local/nagios/libexec/
./check_dhcp -s 10.18.2.20 -m 123456789012 -r 10.18.2.254 -u -i eth0
./check_dhcp -s 10.20.2.20 -m 123456789012 -r 10.18.2.254 -u -i eth0
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

Re: check_dhcp on DHCP servers on balanced mode

Post by nlabardi »

Here is it....
(I don't know the password for nagios user, is there a default one?)

define host{
use windows-server ; Inherit default values from a template
host_name fcwinsrv1 ; The name we're giving to this host
alias FCWINSRV1 ; A longer name associated with the host
address 10.18.2.20 ; IP address of the host
}

define host{
use cloud-server ; Inherit default values from a template
host_name fcwinsrv10 ; The name we're giving to this host
alias FCWINSRV10 ; A longer name associated with the host
address 10.20.2.20 ; IP address of the host
}

define service{
use generic-service
host_name fcwinsrv1
service_description DHCP Service
check_command check_dhcp!DHCPOFFER -s 10.18.2.20 -m 123456789012 -r 10.18.2.254 -i eth0 -u
}

define service{
use generic-service
host_name fcwinsrv10
service_description DHCP Service
check_command check_dhcp!DHCPOFFER -s 10.20.2.20 -m 123456789012 -r 10.18.2.254 -i eth0 -u
}

root@:/usr/local/nagios/libexec# ./check_dhcp -s 10.18.2.20 -m 123456789012 -r 10.18.2.254 -u -i eth0
OK: Received 1 DHCPOFFER(s), 1 of 1 requested servers responded, requested address (10.18.2.254) was offered, max lease time = 3600 sec.
root@:/usr/local/nagios/libexec# ./check_dhcp -s 10.20.2.20 -m 123456789012 -r 10.18.2.254 -u -i eth0
CRITICAL: No DHCPOFFERs were received.

[1545054812] Event broker module 'NERD' deinitialized successfully.
[1545054824] Nagios 4.3.4 starting... (PID=24364)
[1545054824] Local time is Mon Dec 17 14:53:44 CET 2018
[1545054824] LOG VERSION: 2.0
[1545054824] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1545054824] qh: core query handler registered
[1545054824] nerd: Channel hostchecks registered successfully
[1545054824] nerd: Channel servicechecks registered successfully
[1545054824] nerd: Channel opathchecks registered successfully
[1545054824] nerd: Fully initialized and ready to rock!
[1545054824] wproc: Successfully registered manager as @wproc with query handler
[1545054824] wproc: Registry request: name=Core Worker 24366;pid=24366
[1545054824] wproc: Registry request: name=Core Worker 24367;pid=24367
[1545054824] wproc: Registry request: name=Core Worker 24368;pid=24368
[1545054824] wproc: Registry request: name=Core Worker 24370;pid=24370
[1545054824] wproc: Registry request: name=Core Worker 24371;pid=24371
[1545054824] wproc: Registry request: name=Core Worker 24369;pid=24369
[1545054824] Successfully launched command file worker with pid 24373
[1545054857] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;fcwinsrv1;DHCP Service;1545054856
[1545054860] SERVICE ALERT: fcwinsrv1;DHCP Service;OK;SOFT;2;OK: Received 1 DHCPOFFER(s), max lease time = 3600 sec.
[1545054911] SERVICE ALERT: fcwinsrv10;DHCP Service;OK;SOFT;2;OK: Received 2 DHCPOFFER(s), max lease time = 3600 sec.
[1545055089] EXTERNAL COMMAND: SCHEDULE_FORCED_SVC_CHECK;fcwinsrv10;DHCP Service;1545055088
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_dhcp on DHCP servers on balanced mode

Post by npolovenko »

@nlabardi, There should be no password on the nagios user in order for it to work properly.
Can you upload a service status screenshot of the DHCP Service --> host fcwinsrv1(from the web interface)? Also, please upload the status.dat file:
/usr/local/nagios/var/status.dat
Thank you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

Re: check_dhcp on DHCP servers on balanced mode

Post by nlabardi »

in attach the screenshot
Attachments
nag_dhcp03.PNG
nag_dhcp02.PNG
nag_dhcp01.PNG
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

Re: check_dhcp on DHCP servers on balanced mode

Post by nlabardi »

...and the status.data
Attachments
status.dat.txt
(73.07 KiB) Downloaded 254 times
nag_dhcp04.PNG
nag_dhcp04.PNG (3.72 KiB) Viewed 4497 times
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_dhcp on DHCP servers on balanced mode

Post by npolovenko »

@nlabardi, Is your check_dhcp command defined like this?
$USER1$/check_dhcp $ARG1$
I noticed that both of your service check commands have this argument - "DHCPOFFER".
check_dhcp!DHCPOFFER -s 10.18.2.20 -m 123456789012 -r 10.18.2.254 -i eth0 -u
check_dhcp!DHCPOFFER -s 10.20.2.20 -m 123456789012 -r 10.18.2.254 -i eth0 -u
But when you ran commands from the command line you did not use this argument. I suggest deleting DHCPOFFER from both command definitions and restarting the nagios service:
service nagios restart
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
nlabardi
Posts: 8
Joined: Fri Dec 14, 2018 8:50 am

Re: check_dhcp on DHCP servers on balanced mode

Post by nlabardi »

YESSSSSSSSSS

everything works well

thank you!!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: check_dhcp on DHCP servers on balanced mode

Post by npolovenko »

@nlabardi, Awesome! Closing the thread as resolved.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked