Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - twillia1

#1
General Support / Re: Logwatch function
December 28, 2010, 05:37:27 PM
Hi Victor!

I'm not 100% sure how to get the version info, but when I go to the Server Console it comes up as "NetXMS Server Remote Console V1.0.8 Ready"

Not that it would probably matter, but the Logwatch agent is also 1.0.8 as is the console.

The only time I noticed an issue with the pointer notation was in the filtering script.

Thanks!

Torry
#2
General Support / Re: Logwatch function
December 27, 2010, 10:31:55 PM
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.

1) 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.
2) 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.
3) Define a situation.
4) 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.
5) 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.
#3
General Support / Re: Logwatch function
December 23, 2010, 04:22:43 PM
I'll add to this question...

I want to get notified via text message if a certain critical error occurs in a process on a monitored server. However, this critical error could happen 300 times before I can get in and fix it. I do not want to get 300 text messages!  :o  So I'd like to create a situation that states "if this event occurs x number of times, continue processing the event and send the email."

I created a situation and instance with an attribute "counter"

There is an event that runs first that sets the attribute "counter" to zero. That event processing is running; however, when I look in "View Situations" I can't see the "counter" attribute value. I have another event script that as follows:

sub main() {
  s = FindSituation("Multiple FAXes printed", "FaxFinder");
  if (s != NULL) {
    s->counter = s->counter+1;
    if (s->counter > 5) {
      return true; }
    else {
      return false;
    }
  }
}

It seems like if I could get the counter attribute to work this might work, but I can't even see the counter attribute. I still get the email every time, so the script is not processing. Not sure if I'm doing this correctly or not?