]> granicus.if.org Git - icinga2/commitdiff
Add macro "check_source" for hosts and services to use them in notification mails
authorStephan Platz <github@paalsteek.de>
Sun, 25 Jan 2015 13:30:05 +0000 (14:30 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Sun, 25 Jan 2015 15:04:36 +0000 (16:04 +0100)
fixes #8277

Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
doc/3-monitoring-basics.md
lib/icinga/host.cpp
lib/icinga/service.cpp

index 461ca6604d49c0d945d2a7c059fc8ac09731efde..6059cf6600fe7d27b59b2363d20d9fb1659ca66b 100644 (file)
@@ -2045,6 +2045,7 @@ hosts or services:
   host.output                  | The last check's output.
   host.perfdata                | The last check's performance data.
   host.last_check              | The timestamp when the last check was executed.
+  host.check_source            | The monitoring instance that performed the last check.
   host.num_services            | Number of services associated with the host.
   host.num_services_ok         | Number of services associated with the host which are in an `OK` state.
   host.num_services_warning    | Number of services associated with the host which are in a `WARNING` state.
@@ -2076,6 +2077,7 @@ services:
   service.output             | The last check's output.
   service.perfdata           | The last check's performance data.
   service.last_check         | The timestamp when the last check was executed.
+  service.check_source       | The monitoring instance that performed the last check.
 
 ### <a id="command-runtime-macros"></a> Command Runtime Macros
 
index d6813e5f005ba7d4633de374ff3433943bb5bb56..05c73f7310c646933880361e00e22cbf0be8b8b5 100644 (file)
@@ -280,6 +280,9 @@ bool Host::ResolveMacro(const String& macro, const CheckResult::Ptr&, Value *res
                } else if (macro == "last_check") {
                        *result = Convert::ToString((long)cr->GetScheduleStart());
                        return true;
+               } else if (macro == "check_source") {
+                       *result = cr->GetCheckSource();
+                       return true;
                }
        }
 
index e698309a0e4a5aa1a69836d8c812a1565d3eae2b..4b526a4f62bfba78e2610b2fb08c26cbbbdf18ba 100644 (file)
@@ -178,6 +178,9 @@ bool Service::ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Valu
                } else if (macro == "last_check") {
                        *result = Convert::ToString((long)cr->GetExecutionEnd());
                        return true;
+               } else if (macro == "check_source") {
+                       *result = cr->GetCheckSource();
+                       return true;
                }
        }