Skip to content

Commit

Permalink
Add macro "check_source" for hosts and services to use them in notifi…
Browse files Browse the repository at this point in the history
…cation mails

fixes Icinga#8277

Signed-off-by: Gunnar Beutner <[email protected]>
  • Loading branch information
paalsteek authored and gunnarbeutner committed Jan 25, 2015
1 parent a4bfa99 commit 2d393ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/3-monitoring-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions lib/icinga/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
3 changes: 3 additions & 0 deletions lib/icinga/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 2d393ea

Please sign in to comment.