Hi,
Am 05.09.2014 09:09, schrieb
[email protected]<mailto:[email protected]>:
Hi,
i’m struggeling a little with the check command definitions.
Trying to set up some check commands for check_nt I’m wondering if it is
possible to negate unused vars instead of creating a bunch of separate commands.
For example:
I have defined:
object CheckCommand "check_nt" {
import "plugin-check-command"
command = [ PluginDir + "/check_nt",
"-H", "$address$",
"-v", "$nt_check_variable$",
"-p", "$nt_port$",
"-l", "$nt_partition$",
"-w", "$nt_warn$",
"-c", "$nt_crit$",
"-s", "$nt_pass$"
]
vars = {
"nt_port" = "12489"
"nt_pass" = "secret"
}
That's not using the command arguments where key-value pairs could be made
optional, or conditional. Where did you copy/get that CheckCommand from?
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#command-arguments
You would want something like this using
1) command arguments
2) vars.nt_address to be able to override the address by the service in a
readable way
3) not using keys with double quotes in the var dictionary, and rather use the
index operator
object CheckCommand "check_nt" {
import "plugin-check-command"
command = [ PluginDir + "/check_nt" ]
arguments = {
"-H" = "$nt_address$"
"-v" = "$nt_check_variable$"
"-p" = "$nt_port$"
"-l" = "$nt_partition$"
"-w" = "$nt_warn$"
"-c" = "$nt_crit$"
"-s" = "$nt_pass$"
}
vars.nt_address = "$address"
vars.nt_port = "12489"
vars.nt_pass = "secret"
}
Kind regards,
Michael
Now I use this to check the UPTIME like:
object Service "check_nt_uptime" {
import "generic-service"
host_name = "myHost"
check_command = "check_nt"
vars.sla = "24x7"
vars += {
nt_check_variable = "UPTIME"
}
Now in icinga2.log it complaints:
[2014-09-05 09:03:12 +0200] warning/MacroProcessor: Macro 'nt_partition' is not
defined.
Context:
(0) Resolving macros for string '$nt_partition$'
(1) Executing check for object 'myHost!check_nt_uptime'
[2014-09-05 09:03:12 +0200] warning/MacroProcessor: Macro 'nt_warn' is not
defined.
Context:
(0) Resolving macros for string '$nt_warn$'
(1) Executing check for object 'myHost!check_nt_uptime'
[2014-09-05 09:03:12 +0200] warning/MacroProcessor: Macro 'nt_crit' is not
defined.
Context:
(0) Resolving macros for string '$nt_crit$'
(1) Executing check for object 'myHost!check_nt_uptime'
What is clear, because not used here.
Question is now, do I have to define another check command like:
}
object CheckCommand "check_nt_uptime" {
import "plugin-check-command"
command = [ PluginDir + "/check_nt",
"-H", "$address$",
"-v", "$nt_check_variable$",
"-p", "$nt_port$",
"-s", "$nt_pass$"
]
vars = {
"nt_port" = "12489"
"nt_pass" = "secret"
}
}
Or is it possible the negate some of the unused stuff from the check command
above?
Viele Gruesse,
Kind regards,
Rico Spiesberger
System Engineer
IT-SR-IR-2
MANN+HUMMEL GMBH
Grönerstr. 50
71636 Ludwigsburg, Germany
Phone +49 7141 98 2362
Fax +49 7141 98 182362
[email protected]<mailto:[email protected]>
www.mann-hummel.com<http://www.mann-hummel.com/>
MANN+HUMMEL GmbH, Hindenburgstr. 45, 71638 Ludwigsburg, Sitz der Gesellschaft:
Ludwigsburg, Registergericht Stuttgart HRB 200155.
Geschäftsführer: Alfred Weber, Manfred Wolf, Frank Jehle. Vorsitzender des
Aufsichtsrats: Thomas Fischer.
_______________________________________________
icinga-users mailing list
[email protected]<mailto:[email protected]>
https://lists.icinga.org/mailman/listinfo/icinga-users
--
Michael Friedrich, DI (FH)
Application Developer
NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | [email protected]
** Open Source Backup Conference 2014 - September - osbconf.org **
** Puppet Camp Duesseldorf 2014 - Oktober - netways.de/puppetcamp **
** OSMC 2014 - November - netways.de/osmc **
** OpenNebula Conf 2014 - Dezember - opennebulaconf.com **
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users