mirror of https://github.com/Icinga/icinga2.git
parent
091274e417
commit
1451a0e5ad
|
@ -54,9 +54,11 @@ Check command for the built-in `cluster-zone` check.
|
|||
|
||||
Custom attributes passed as [command parameters](3-monitoring-basics.md#command-passing-parameters):
|
||||
|
||||
Name | Description
|
||||
-------------|---------------
|
||||
cluster_zone | **Optional.** The zone name. Defaults to "$host.name$".
|
||||
Name | Description
|
||||
---------------------|---------------
|
||||
cluster_zone | **Required.** The zone name.
|
||||
cluster_lag_warning | **Optional.** Warning threshold for log lag in seconds.
|
||||
cluster_lag_critical | **Optional.** Critical threshold for log lag in seconds.
|
||||
|
||||
### <a id="itl-icinga-ido"></a> ido
|
||||
|
||||
|
|
|
@ -61,6 +61,15 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
|
|||
String zoneName = MacroProcessor::ResolveMacros("$cluster_zone$", resolvers, checkable->GetLastCheckResult(),
|
||||
NULL, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros);
|
||||
|
||||
String missingLagWarning;
|
||||
String missingLagCritical;
|
||||
|
||||
double lagWarning = MacroProcessor::ResolveMacros("$cluster_lag_warning$", resolvers, checkable->GetLastCheckResult(),
|
||||
&missingLagWarning, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros);
|
||||
|
||||
double lagCritical = MacroProcessor::ResolveMacros("$cluster_lag_critical$", resolvers, checkable->GetLastCheckResult(),
|
||||
&missingLagCritical, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros);
|
||||
|
||||
if (resolvedMacros && !useResolvedMacros)
|
||||
return;
|
||||
|
||||
|
@ -101,8 +110,19 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
|
|||
cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag));
|
||||
}
|
||||
|
||||
/* Check whether the thresholds have been resolved and compare them */
|
||||
if (missingLagCritical.IsEmpty() && zoneLag > lagCritical) {
|
||||
cr->SetState(ServiceCritical);
|
||||
cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag)
|
||||
+ " greater than critical threshold: " + Utility::FormatDuration(lagCritical));
|
||||
} else if (missingLagWarning.IsEmpty() && zoneLag > lagWarning) {
|
||||
cr->SetState(ServiceWarning);
|
||||
cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag)
|
||||
+ " greater than warning threshold: " + Utility::FormatDuration(lagWarning));
|
||||
}
|
||||
|
||||
Array::Ptr perfdata = new Array();
|
||||
perfdata->Add(new PerfdataValue("slave_lag", zoneLag));
|
||||
perfdata->Add(new PerfdataValue("slave_lag", zoneLag, false, "s", lagWarning, lagCritical));
|
||||
cr->SetPerformanceData(perfdata);
|
||||
|
||||
checkable->ProcessCheckResult(cr);
|
||||
|
|
Loading…
Reference in New Issue