Hello,
I want to generate separate procs values instead of default values at the procs service. At the procs service with by_ssh I was successful.
apply Service “procs VM” {
check_command = “by_ssh”
vars.by_ssh_command = [ "/usr/lib/nagios/plugins/check_procs" ]
vars.by_ssh_command_endpoint = host.name
assign where host.vars.os == "LinuxVM" && host.vars.agent_type == "ssh"
ignore where host.vars.os == "LinuxKVM"
vars.notification["mail"] = {
groups = [ "icingaadmins" ]
}
}
with
object CheckCommand "by_ssh_procs" {
import "procs"
vars.by_ssh_arguments = arguments
arguments = {
"-w" = "$wload$"
"-c" = "$cload$"
}
vars.by_ssh_command ="/usr/lib/nagios/plugins/check_procs"
vars.wload = "2048"
vars.cload = "2560"
import "by_ssh"
}
The same I want build in the procs Service for the KVM host where I don’t need a special CheckCommnad with by_ssh.
apply Service “procs root” {
import “generic-service”
check_command = "procs"
vars.arguments = arguments
arguments = {
"-w" = "$wproc$"
"-c" = "$cproc$"
}
vars.wload = "2048"
vars.cload = "2560"
vars.notification["mail"] = {
groups = [ "icingaadmins" ]
}
ignore where host.vars.os == "LinuxVM"
assign where (host.address || host.address6) && host.vars.os == "LinuxKVM"
assign where host.vars.os == "LinuxKVM"
}
But this generate a failure:
# icinga2 daemon --validate
[2019-11-04 08:34:05 +0100] information/cli: Icinga application loader (version: r2.11.0-1)
[2019-11-04 08:34:05 +0100] information/cli: Loading configuration file(s).
[2019-11-04 08:34:05 +0100] information/ConfigItem: Committing config item(s).
[2019-11-04 08:34:05 +0100] information/ApiListener: My API identity: neckar.bw.local
[2019-11-04 08:34:06 +0100] critical/config: Error: Error while evaluating expression: Tried to access undefined script variable 'arguments'
Location: in /etc/icinga2/conf.d/services.conf: 138:20-138:28
/etc/icinga2/conf.d/services.conf(136): check_command = "procs"
/etc/icinga2/conf.d/services.conf(137):
/etc/icinga2/conf.d/services.conf(138): vars.arguments = arguments
^^^^^^^^^
/etc/icinga2/conf.d/services.conf(139): arguments = {
/etc/icinga2/conf.d/services.conf(140): "-w" = "$wproc$"
[2019-11-04 08:34:06 +0100] critical/config: 1 error
[2019-11-04 08:34:06 +0100] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.
How I can change the default values of a plugin like procs here?
Thanks for your answers
BrotherA