AutoPatrol
191
edits
Line 121: | Line 121: | ||
== Situations == | == Situations == | ||
=== Situations Overview === | === Situations Overview === | ||
Situations is a special type of event processing objects | Situations is a special type of event processing objects which allow you to track current state of your infrastructure and process events accordingly. Each situation has one or more instances, and each instance has one or more attributes. Situation objects allow you to store information about current situation in attributes and then use this information in event processing. For example, if you have one service (service A) depending on another (service B), and in case of service B failure you wish to get alarm about service B failure, and not about consequent service A failure. To accomplish this, you can do the following: | ||
# Create situation object named "ServiceStatus"; | # Create situation object named "ServiceStatus"; | ||
# In event processing policy, for processing of event indicating service B failure, add situation attribute update: update situation "ServiceStatus", instance "Service_B", set attribute "status" to "failed"; | # In event processing policy, for processing of event indicating service B failure, add situation attribute update: update situation "ServiceStatus", instance "Service_B", set attribute "status" to "failed"; | ||
# In event processing policy, for rule generating alarm in case of service A failure, add additional filtering using script | # In event processing policy, for rule generating alarm in case of service A failure, add additional filtering using script - to match this rule only if service B is not failed. Your script may look like the following: | ||
<syntaxhighlight lang="c"> | |||
sub main() | sub main() | ||
{ | { | ||
s = FindSituation("ServiceStatus", "Service_B"); | |||
if (s->status == "failed") | if (s != NULL) | ||
{ | |||
return 0;// Don't match rule | if (s->status == "failed") | ||
return 0; // Don't match rule | |||
} | } | ||
return 1; // Match rule | |||
return 1;// Match rule | |||
} | } | ||
</syntaxhighlight> | |||
=== Defining Situations === | === Defining Situations === |