Search code examples
nagiosnrpeicinga

Icinga2: how to configure to get value from the host configuration to monitoring load average per servers?


How to configure to get value from the host configuration to monitoring load average per servers?

I would like to pass different LA values to different hosts. I use NRPE agent on a host. My current configuration is:

On the a server nrpe.conf

command[check_load]=/usr/lib/nagios/plugins/check_load -r -w $ARG1$ -c $ARG2$

on the Icinga server

    object CheckCommand "nrpe-load" {
    import "nrpe-common"
    vars.nrpe_args = [ "$load_wgreater$", "$load_cgreater$" ]
    vars.nrpe_command = "check_load"
    vars.load_wgreater = 2
    vars.load_cgreater = 5
}

apply Service "load-nrpe-linux" {
import "generic-service"
display_name = "load"
check_command = "nrpe-load"
assign where (host.vars.os == "Linux" || host.vars.os == "awslinux") && host.vars.is_nrpe
}

object Host "domain.be-PHP-FPM" {
import "generic-host"
...

    vars.nrpe_load["6"] = {
    load_cgreater = 0.01
    }
    vars.nrpe_load["12"] = {
    load_cgreater = 12
    }
...

Help me, please, how to properly pass values in the host sections? Servers has different number of cores by this reason needs to use different values.

P.S. Currently used values from vars.load_wgreater = 2 vars.load_cgreater = 5.

Regards, Rostyslav


Solution

  • Instead of this:

    vars.nrpe_load["6"] = {
    load_cgreater = 0.01
    }
    vars.nrpe_load["12"] = {
    load_cgreater = 12
    }
    

    Try this in each host definition where you need different values for load_wgreater and load_cgreater :

    vars.load_wgreater = <v1>
    vars.load_cgreater = <v2>
    

    You don't need to use dict to assign values to load_wgreater and load_cgreater.