0

I'm trying to configure Nagios to monitor our network which is all Windows based. I'm totally new to it, so please forgive my naiveness. Fact is: I'm banging my head over a task.

What I want to achieve is having Nagios tell me whether a remote service/process is running or not. I have NSClilent++ installed and working on a client machine. In fact, if I execute the following code from command line in the Nagios server it works:

check_nrpe -H [ip_of_NSClient++] -c check_service -a 'service=[service_name]' "critical=state = 'stopped'"

My question is: how can I define aservice in the [host].cfg file to invoke the command above?

Right now I have this defined in my commands.cfg file:

   define command {
   $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG1$
    }

Which works to invoke simple services like [check_cpu] or [check_disk] but no more than that.

All the attempts I've done so far always led to(I think) erratic error messages, like:

  • (No output on stdout) stderr: Could not resolve hostname $: Name or service not known. or
  • CHECK_NRPE: Invalid packet type received from server.
  • Thank you all for the answers. In the end, I downgraded the NSClient to a previous version and it worked. Now my cfg file looks like: define service{ [...] check_command check_nrpe!alias_service!"[service desc] CRITICAL = OK" } and it works. – arf Mar 4 '16 at 9:18
0

There's a specific check buit in nrpe client for Windows service

It is:

check_command        check_windows_service!"<display name of the service>"

You have to enter the display name of the service as it appears in windows service manager.

0

I usually use the Old Skool

define service{
        use                             generic-service         ; Name of service
        host_name                       YourServer
        service_description             YourService
        check_command                   check_nt!SERVICESTATE!-d SHOWALL -l YourService
        }

That said, I hauled out my check_nrpe definitions and found:

# this command runs a program $ARG1$ with arguments $ARG2$
define command {
        command_name    check_nrpe
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}

# this command runs a program $ARG1$ with no arguments
define command {
        command_name    check_nrpe_1arg
        command_line    /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

I honestly don't remember if I created the second one or not (I probably did, though). However, yours has ARG1 specified twice, while you have two arguments:

  define command {
   $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG1$
    }

It should probably be

  define command {
   $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.