2

I have working instance of Nagios, and I would like to run Icinga2 on other machine. Nagios is using NRPE so I would like to use it too.

I have following configuration in files:

object Service "NRPE check load" {
    import "generic-service"
    host_name = "agrippina"
    check_command = "nrpe-check-2arg"
    vars.host = "agrippina.domain.net"
    vars.check = "check_load"
    vars.loads = "'10' '20'"
    }

and

object CheckCommand "nrpe-check-2arg" {
    import "plugin-check-command"
    command = [PluginDir + "/check_nrpe" ]
    arguments = {
    "-H" = "$host$"
    "-c" = "$check$"
    "-a" = "$loads$"
    }
}

When I'm issuing command by hand:

/usr/lib/nagios/plugins/check_nrpe -H agrippina.domain.net -c 'check_load' -a '10' '20'

I receive

OK - load average: 0.98, 1.39, 3.79|load1=0.980;10.000;20.000;0; load5=1.390;10.000;20.000;0; load15=3.790;10.000;20.000;0;

Icinga2 logs:

CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs for error messages.

Where should I look for that messages?

Since when I run this check by hand and it works, how to fix it in Icinga2?

4

Change vars.loads = "'10' '20'" to vars.loads = "10!20" because NRPE is not able to read the arguments the way you have declared them in object Service.

  • 3
    Why? How? Please elaborate. – peterh Jul 2 '15 at 4:41
  • 1
    Because NRPE is not able to read the arguments the way you have declared them in object Service. Put vars.loads = "10!20" instead of vars.loads = "'10' '20'" reload icinga2 and verify the result. – Rohit Jul 2 '15 at 10:13
  • 1
    Enter this in the answer, as a comment it will be soon deleted. – peterh Jul 2 '15 at 20:39
0

I wouldn't create custom CheckCommand definitions for multiple use cases. We've wrapped our heads into making CheckCommand objects more re-usable during our development cycles, and one thing you'll get - optional and also conditional arguments.

http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#command-arguments

Furthermore, icinga2 already ships the 'nrpe' plugin check command definition, also allowing you do add multiple additional arguments -a) passed as array.

http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/plugin-check-commands#plugin-check-command-nrpe

Your example:

vars.nrpe_arguments = [ 10, 20 ]

Better go that way, and in case you'll have more CheckCommand definitions to share, please send them upstream - it certainly helps to not care about CheckCommand definitions but only hosts/servics and their custom attributes used as comnand parameters :)

https://wiki.icinga.org/display/community/Contribute+Icinga+2+ITL+Plugin+Check+Command+Definitions

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.