[Nagios-devel] Important check_command functionality
Posted: Tue May 19, 2009 9:43 pm
--Apple-Mail-430-325291688
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit
Hi!,
One neat trick that we've done in Opsview for configuring in a
distributed environment is an "important check command".
The documentation change says:
---
Service templates can make use of a special rule which gives
precedence to their check_command value. If the check_command is
prefixed with an exclamation mark (!), then the template's
check_command is marked as important and will be used over the
check_command defined for the service.
Why is this useful? Mainly when setting a different check_command for
distributed systems. You may want to set a freshness threshold and a
check_command that forces the service into a failed state, but this
doesn't work with the normal templating system. Using this
important flag allows the custom check_command to be written,
but a general distributed template can be used to overrule the
check_command when used on a central Nagios server.
For instance:
# On master
define host{
name service-distributed
register 0
active_checks_enabled 0
check_freshness 1
check_command !set_to_stale
}
# On slave
define host{
name service-distributed
register 0
active_checks_enabled 1
}
# Server configuration, used by master and slave
define host{
host_name host1
check_command check_http...
use service-distributed
...
}
----
The patch is attached. Would this be desired in core Nagios?
Ton
--Apple-Mail-430-325291688
Content-Disposition: attachment; filename=nagios_important_check_command.patch
Content-Type: application/octet-stream; x-unix-mode=0644;
name="nagios_important_check_command.patch"
Content-Transfer-Encoding: 7bit
diff -ur nagios-3.0.6/html/docs/objectinheritance.html nagios-3.0.6.with_check_command_override/html/docs/objectinheritance.html
--- nagios-3.0.6/html/docs/objectinheritance.html 2008-12-17 01:19:55.000000000 +0800
+++ nagios-3.0.6.with_check_command_override/html/docs/objectinheritance.html 2009-01-09 10:10:41.000000000 +0800
@@ -445,6 +445,47 @@
+
+
+Important values
+
+
+
+Service templates can make use of a special rule which gives precedence to their check_command value. If the check_command is prefixed with an exclamation mark (!), then the template's check_command is marked as important and will be used over the check_command defined for the service.
+
+
+
+Why is this useful? Mainly when setting a different check_command for distributed systems. You may want to set a freshness threshold and a check_command that forces the service into a failed state, but this doesn't work with the normal templating system. Using this important flag allows the custom check_command to be written, but a general distributed template can be used to overrule the check_command when used on a central Nagios server.
+
+
+
+For instance:
+
+
+
+# On master
+define host{
+ name service-distributed
+ register 0
+ active_checks_enabled 0
+ check_freshness 1
+ check_command !set_to_stale
+ }
+# On slave
+define host{
+ name service-distributed
+ register 0
+ active_checks_enabled 1
+ }
+# Server configuration, used by master and slave
+define host{
+ host_name host1
+ check_command check_http...
+ use service-distributed
+ ...
+ }
+
+
Multiple Inheritance Sources
diff -ur nagios-3.0.6/xdata/xodtemplate.c nagios-3.0.6.with_check_command_override/xdata/xodtemplate.c
--- nagios-3.0.6/xdata/xodtemplate.c 2008-12-17 01:20:05.000000000 +0800
+++ nagios-3.0.6.with_check_command_override/xdata/xodtemplate.c 2009-01-09 09:46:30.000000000 +0800
@@ -1607,6 +1607,7 @@
new_service->have_service_groups=FALSE;
new_service->check_command=NULL;
new_service->have_check_command=FALSE;
+ new_service->have_important_check_command=FALSE;
ne
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]