Hi Victor,
Thanks for your reply! Everything worked the way you said except for one thing: Using the pointer notation inside the filtering scripts does not appear to work. For example, this works:
CUSTOM_MESSAGE = GetSituationAttribute(s, "FaxCount") + 1;
but this does not:
CUSTOM_MESSAGE = (s->FaxCount) + 1;
It could be that I don't have the syntax right, but throughout my testing, the GetSituationAttribute always worked.
So for people that may want to do this in the future, I'll post this in more detail.
- Go into Events and define custom event(s) that you want to look for. In my case, I also set up an event to reset the error counter to zero (a "normal" event). An EventID will automatically be assigned.
- On the monitored server, set up the event log agent to generate the events in #1. Don't forget the event to reset the error counter to zero from #1.
- Define a situation.
- Add an event processing rule for the "normal" event in #2. In the Situation column, have it set a counter attribute (for the applicable instance) to zero.
- Add event processing rules for the "exception"-type events from #2. In the script column, do the following:
sub main() {
s = FindSituation("MySituation", "MyInstance");
if (s != NULL) {
CUSTOM_MESSAGE = GetSituationAttribute(s, "MyCounter") + 1; }
else {
CUSTOM_MESSAGE = 1;
}
return true;
}
For each "exception" event, in the Situation column, set the MyCounter attribute to "%M" (no quotes)
6) Add an event processing rule with the following script:
sub main() {
s = FindSituation("MySituation", "MyInstance");
if (int32(GetSituationAttribute(s, "MyCounter"))==5) {
return true; }
else {
return false;
}
}
On this same line, set up a custom email or text message action to advise you when the situation has occurred.
NOTE that the test for the counter uses the equals operator rather than "greater than." If you use "greater than" you will still get tons of emails/messages.
Once the "normal" even described in #1 occurs, it will set the counter back to zero.