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

How to make Indirect checks

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: How to make Indirect checks

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post by ziedmahjoub »

Host B and Host C must have NSClient++ 0.4.1 also ?
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post 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
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: How to make Indirect checks

Post 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.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: How to make Indirect checks

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: How to make Indirect checks

Post 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
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to make Indirect checks

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

Re: How to make Indirect checks

Post 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
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to make Indirect checks

Post 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.
Locked