How to make Indirect checks

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.
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post by ziedmahjoub »

ok you're explanation is awsome,
so now i need to make the script file check_ping.bat , but i don't know what to write in that script
( sorry because i still newbie )

1- i made a command :

Code: Select all

# 'indirect_check_ping' command definition
define command{
        command_name    indirect_check_ping
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_ping.bat
        }
when i verify with : /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

i got error that told me :

Code: Select all

Error: Host check command 'check_nrpe -c indirect_check_ping' specified for host 'KTD_Server' is not defined anywhere!
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to make Indirect checks

Post by jdalrymple »

ziedmahjoub wrote:ok you're explanation is awsome,
so now i need to make the script file check_ping.bat , but i don't know what to write in that script
nsclient++ includes that script, no need to create it, although you will have to add a definition to your nsclient.ini
ziedmahjoub wrote: i got error that told me :

Code: Select all

Error: Host check command 'check_nrpe -c indirect_check_ping' specified for host 'KTD_Server' is not defined anywhere!
Looks to me like you added all that rubbish to your check_command in your host definition (no doubt because I told you to, I will go back and revise what I jotted down). Your check_command references the "command_name" in the command definition, so it will just be indirect_check_ping based upon the fact that you created a new command definition.

Follow?
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post by ziedmahjoub »

jdalrymple i didn't add that rubbish , i just created a command based on what you told me , but i think i forgot something , anyway i will try to see your edited post .

thanks
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to make Indirect checks

Post by jdalrymple »

ziedmahjoub - I'm sorry, I didn't mean to imply you did anything wrong. I should have been more clear with my earlier definitions, I got sloppy and I apologize for confusing you. I have updated them though and it should definitely be more clear now.

The important thing is to understand that you're defining a new host, but your new host is going to have the address of the host that is running the NRPE service and you'll be changing the command that you use to verify that it's alive. The default ping check would indicate the state of the NRPE host and that's why we're changing it to the NRPE check so you get a realistic view of whether the host is up or down.

Of course if the NRPE host goes down you could potentially get false positives, so you may want to make your inderect machine's parent the NRPE host so that the state goes to "unreachable" if the NRPE host goes down.

I apologize again for the earlier confusion. Hopefully though - the goal is not necessarily just to show you how to set it up but rather so that you understand exactly how it works so that you can set it up again in the future if you need to for more hosts :)

Let me know if you don't get it figured out.
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post by ziedmahjoub »

jdalrymple no problem its ok , thanks a lot for your explanation .

i have made what you told and i can give you the definitions if you want , and no error in it .

Look at the message i get in the interface :
No handler for command: check_ping.bat
and for the disk
No handler for command: check_disk_indirect
i think he can't find the script in the nsclient.ini !!

i've added in the NSClient.ini of the nsclient++ server this line :
[settings/external scripts/scripts]:
indirect_check_ping=scripts\check_ping.bat <IP of 2nd hop>
but for the check_disk i didn't add the script because i wanna test the ping before .
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to make Indirect checks

Post by jdalrymple »

Can you double check your version of nsclient++? The syntax of the file changes a lot from version to version so before I give you exact syntax I'd like to verify that I know what version you're using.

Thanks ziedmahjoub
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post by ziedmahjoub »

jdalrymple wrote:Can you double check your version of nsclient++? The syntax of the file changes a lot from version to version so before I give you exact syntax I'd like to verify that I know what version you're using.

Thanks ziedmahjoub
i'm using NSClient++ 0.4.1.105
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to make Indirect checks

Post by jdalrymple »

ziedmahjoub wrote:No handler for command: check_ping.bat
ziedmahjoub wrote:No handler for command: check_disk_indirect
ziedmahjoub wrote:

Code: Select all

[settings/external scripts/scripts]:
indirect_check_ping=scripts\check_ping.bat <IP of 2nd hop>
Your syntax is proper for this version of nsclient++

You're going to want to verify that you have this line in the [/modules] section of your file:

Code: Select all

CheckExternalScripts = 1
The the other problem that you're definitely having is that the command run from the Nagios server needs to be as follows:

Code: Select all

check_nrpe -H nsclientHost -t 60 -c indirect_check_ping
whereas it looks like you're trying to use:

Code: Select all

check_nrpe -H nsclientHost -t 60 -c check_ping.bat
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post by ziedmahjoub »

You're going to want to verify that you have this line in the [/modules] section of your file:

Code: Select all

    CheckExternalScripts = 1
For this its ok i've put it already .

for others i will see and tell you

thanks jdalrymple
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post by ziedmahjoub »

The the other problem that you're definitely having is that the command run from the Nagios server needs to be as follows:

Code: Select all

check_nrpe -H nsclientHost -t 60 -c indirect_check_ping
IT WORKS FINE !!!

jdalrymple you are da best :D !!
Locked