Check_nrpe CheckServiceState Error

(Fadel) #1

hey,

i want to monitor with Check_nrpe and the NSClient the McAfee service on my server.

my command:

    object CheckCommand "windows" {
        import "plugin-check-command"
        command = [ PluginDir + "/check_nrpe" ]
        arguments = {
                "-H" = "$host$"
                "-c" = "$command$"
                "-a" = "$argument$"
        }
        vars.snmp_perf = true
}

Service:

    object Service "McAfee Server"{
        import "generic-service"
        host_name = "RANDOM"
        check_command = "windows"
        vars.host = "RANDOM"
        vars.command = "CheckServiceState"
        vars.argument =  "McAfee ePolicy Orchestrator 4.5.0-Server"
}

but i always get this error on Icingaweb2:

"Failed to open service -c: 424: Der angegebene Dienst ist kein installierter Dienst."

but on the Bash he accepts the command:

sudo ./check_nrpe -H *RANDOM* -c CheckServiceState -a "McAfee ePolicy Orchestrator 4.5.0-Server"

answer:

OK: All 1 service(s) are ok.|'McAfee ePolicy Orchestrator 4.5.0-Server'=4;0;0

i think I already know what the problem is… i think icinga cant handle the spaces between the Service name, but i dont know how to fix it :confused: i tryed to add these ’ ’ in the config to solve it but i do not work :sob:

i also tryed to add _ into the servicename but it doesnt work, because he wouldnt find the service after that.

Check_disk only on services
(Michael Friedrich) #2

Why don’t you just use the ITL provided “nrpe” CheckCommand? This is bulletproof already and should help with a simple service definition.

 vars.nrpe_command = "CheckServiceState"
 vars.nrpe_arguments = [ "McAfee ePolicy Orchestrator 4.5.0-Server" ] 

On a more related note, the error message sounds like that the service name is different to what its identifier is. You should see that inside the details of the service in services.msc

PS: Markdown config block formatting is explained in the FAQ.

1 Like
(Fadel) #3

hey dnsmichi,

i changed it to:

object Service "McAfee Server"{
    import "generic-service"
    host_name = "RANDOM"
    check_command = "windows"
    vars.host = "RANDOM"
    vars.nrpe_command = "CheckServiceState"
    vars.nrpe_arguments = [ "McAfee ePolicy Orchestrator 4.5.0-Server" ]
}

but now i get this error:

Unknown command(s): /usr/lib/nagios/plugins/check_nrpe

I think I do not really understood you :S ?

sry for that kind of stupid question, i’m a newbie

PS: Nevermind its working, i changed the check_command to “nrpe” lmao thanks for your help :smiley:

(Michael Friedrich) #4

You can drop that as well. The “nrpe” CheckCommand automagically uses the host’s address attribute if not explicitly overridden. That magic helps keeping your configuration clean and small :slight_smile:

One thing I’d like to suggest too - use apply rules and put this service onto all hosts which e.g. are windows clients.

apply Service "McAfee Server"{
   import "generic-service"
   host_name = "RANDOM"
   check_command = "nrpe"
   vars.nrpe_command = "CheckServiceState"
   vars.nrpe_arguments = [ "McAfee ePolicy Orchestrator 4.5.0-Server" ]

  assign where host.vars.os == "Windows"
}