Page 1 of 6

How to make Indirect checks

Posted: Sat Mar 07, 2015 3:06 am
by ziedmahjoub
Hi nagios team,

i want to monitor a company which got several windows machines and a windows server ,

so i get the idea that the windows server will make the direct checks and get me the informations from the other machines and then i get these checks to my nagios server in our company .
FYI i'm already monitoring another company but with direct checks and i think it costs much resources to our nagios server in our company and also the configuration files are so merged with host definitions

1-is it a good idea to do the indirect checks ?

2- How i gonna modify the NSC.ini file so the server can do the direct checks ?

thanks

Re: How to make Indirect checks

Posted: Sat Mar 07, 2015 7:04 pm
by Box293
ziedmahjoub wrote:1-is it a good idea to do the indirect checks ?
There's nothing wrong, you just need to make sure that windows server is always up.
ziedmahjoub wrote:2- How i gonna modify the NSC.ini file so the server can do the direct checks ?
Here's a guide I wrote that shows you how to do it (NOTE this is for NSClient++ 0.4.1.105):
http://sites.box293.com/nagios/guides/n ... g/nsclient

Re: How to make Indirect checks

Posted: Mon Mar 09, 2015 5:43 am
by ziedmahjoub
Host B and Host C must have NSClient++ 0.4.1 also ?

Re: How to make Indirect checks

Posted: Mon Mar 09, 2015 6:21 am
by ziedmahjoub
why it doens't work with NSClient++ 0.3.9 ?
i can't do indirect checks with 0.3 NSClient++ ?
I installed the 0.4.1.105 version , but and i'm not familiar with the config file of the 0.4.1 version

Re: How to make Indirect checks

Posted: Mon Mar 09, 2015 3:56 pm
by jolson
Have you attempted this procedure with NSClient++ 0.3.9? What were your results? According to what I've read, there should be no problems performing this procedure on NSClient++ 0.3.9.

Re: How to make Indirect checks

Posted: Mon Mar 09, 2015 4:50 pm
by Box293
ziedmahjoub wrote:Host B and Host C must have NSClient++ 0.4.1 also ?
I just tested this against NSClient 0.3.9 and it didn't work for me. But perhaps I haven't configured it correctly.
ziedmahjoub wrote:why it doens't work with NSClient++ 0.3.9 ?
I don't know and it's becoming increasingly harder to find information on 0.3.9. I know the developer just ignores support requests for it now.

Specifically, only Host B needs to be NSClient++ 0.4.1.
ziedmahjoub wrote:I installed the 0.4.1.105 version , but and i'm not familiar with the config file of the 0.4.1 version
Here's an install guide and tips on how to configure it:

http://sites.box293.com/nagios/guides/n ... dows/0-4-x

Re: How to make Indirect checks

Posted: Mon Mar 30, 2015 5:14 am
by ziedmahjoub
Hi all
thanks Box293 for the tutorial,
the checks are OK and work successfully with the check_nrpe command .

Now i want to see the state of the hosts in the nagios interface that i'm cheking them indirectly.

Any idea how can i do it ?

thanks a lot

Re: How to make Indirect checks

Posted: Mon Mar 30, 2015 2:05 pm
by jdalrymple
To make the hosts appear as real hosts you'll have to create new host definitions for them.

In the new host definitions give them the name you want, but the address of the first-hop nsclient++ server.

The other thing you'll need to make a little hairy is the check_command. You'll use something like:

Code: Select all

check_nrpe -H $HOSTADDRESS$ -c check_ping_2ndhop
Then in your nsclient.ini You'll have something like this in the section [settings/external scripts/scripts]:

Code: Select all

check_ping_2ndhop=scripts\check_ping.bat <IP of 2nd hop>
Then you can define all the services you're monitoring under that host instead of the first-hop host.

Make sense?

Re: How to make Indirect checks

Posted: Tue Mar 31, 2015 9:49 am
by ziedmahjoub
thanks jdalrymple ,
it makes sense what you said , but i got 2 questions :
1- the new command definition will be like this ?

Code: Select all

# 'indirect-check' command definition
define command{
        command_name    indirect-check
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c <script_name>
        }
2- for this
Then you can define all the services you're monitoring under that host instead of the first-hop host.
the services are defined like in direct checks or what ?

thanks so much jdalrymple

Re: How to make Indirect checks

Posted: Tue Mar 31, 2015 10:54 am
by jdalrymple
ziedmahjoub,

1) Your command definition looks correct. Don't forget this command is then applied to the host definition, not a service definition. Then your <script_name> would be the command that the nsclient++ server is executing to verify that the indirect host is alive, so like check_ping.bat.

2) All services have to be associated with a host, but it doesn't have to be the host in question. Your configuration will end up being a bit confusing, but the output in the Nagios window will be proper.

Code: Select all

                    ##################################################
|-------------|     #     |-----------|                  |---------| #
| Nagios      |     #     | NSclient++|                  | Indirect| #
| Linux       |-FW EXCEPT-| Windows   |                  | Windows | #
| 192.168.0.1 |     #     | 10.1.1.1  |                  | 10.1.1.2| #
|-------------|     #     |-----------|                  |---------| #
                    ##################################################

Code: Select all

define command{
        command_name    indirect_check_ping
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_ping.bat
        }
		
define command {
       command_name     check_nrpe
       command_line     $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
		}


define host{
		host_name       indirect
		address         10.1.1.1
		check_command   inderect_check_ping
		}
   
define service{
		host_name       indirect
		service_description  disk_usage
		check_command   check_nrpe!check_disk_indirect
		}

You can likely understand the confusion, but this is the way to make it look "proper" in the Nagios UI.

--edit--
Added some clarity to the code by fully defining commands.