I have Server Monitor v4.2.

I need to be able to set the status of the monitor to ok if the FireActions is true. I also have Resolved Actions I would like to run when that happens.

This is probably a settings issue, so here are my settings: Configure Actions > Fire actions when a problem is first detected, with opt escalation, and later when it is resolved.

Configure Options > Error Actions > Email Action in Do Immediately. Configure Options > Resolved Actions > Email Action.

Advanced Monitor Actions > Alert Suppression > Dont suppress. Advanced Monitor Actions > Status > Make the monitor red. Other options unchecked.

In case this is a script issue, here is my anonymized script. The monitor script itself works perfectly. The monitor just does not change to okay when the FireActions var is set to true. The resolved notification is never fired.

' VBScript Reference: http://msdn.microsoft.com/en-us/library/d1wf56tt.aspx

'Status definitions:
'Changed to string to simplify using Get\StoreValue
const msOK       = "1"   'no problems (green - OK, alert suppressed, training, etc)
const msALERT    = "2"   'error actions will be fired (yellow - alert state, threshold passed, etc)

Dim failedCount:   failedCount=0
Dim monitorStatus: monitorStatus = GetValue("LastState")

If monitorStatus = "" Then ' First run, set to ok
    monitorStatus = msOK
End If

Details = "Count Errors in DB"
FireActions = DbFail()

If FireActions Then
   StoreValue "LastState", msALERT
Else
   StoreValue "LastState", msOK
End If

Function DbFail()
    Dim mConnection, mRecordSet
    Dim connString:connString = "DRIVER={SQL Server};SERVER=MyMsftSqlServer;DATABASE=MyDb;Trusted Connection=yes"

    Dim sql:sql = "SELECT COUNT(*) FROM sometable WHERE this=that"

    Set mConnection = CreateObject("ADODB.Connection")
    Set mRecordset = CreateObject("ADODB.Recordset")

    mConnection.Open connString
    mRecordset.Open sql, mConnection
    ' Because I am only expection one record.
    If Not mRecordset.eof Then
        failedCount=mRecordset.Fields(0)
    End If

    ' Return true if failed count greater than 50 for past 24 hours.
    ' Reset to true if zero errors in past 24 hours.
    DbFail = Not ( (failedCount < 50 And monitorStatus = msOK) Or (failedCount = 0 And monitorStatus = msAlert) )
End Function

asked 19 Apr '13, 09:00

GabrielS's gravatar image

GabrielS
1614
accept rate: 50%


Restarting the monitoring service seems to have fixed my issues. Well at least my monitoring issues. :-)

link

answered 19 Apr '13, 16:45

GabrielS's gravatar image

GabrielS
1614
accept rate: 50%

Hi Gabriel,

If you want your monitor status to always be OK (Green) even when it fires an action I would suggest that you set your Advanced Monitor Actions > Status > Force the monitor to always show Green. Then remove from you script any code that tries to change the status of the monitor and just fire the actions when you need them to fire.

Thanks
Quinn

link

answered 19 Apr '13, 10:12

Quinn's gravatar image

Quinn ♦♦
14.4k3925
accept rate: 35%

Hi Quinn:

I just noticed my initial question was a little backwards. I want the monitor to go back to green if the FireActions is False.

I do not always want it to be green.

The issue is that it goes red and never goes back to green.

I did a test to make it fail. I set it back and FireAction is being set to false, but the monitor remains in alert. I have even manually acknowledged the alert.

I have tested that it is not firing actions with both test in console and test in service buttons.

link

answered 19 Apr '13, 15:29

GabrielS's gravatar image

GabrielS
1614
accept rate: 50%

edited 19 Apr '13, 15:30

Look at the server status report, at that monitor. If the status is "Unacknowledged Alert", and it's yellow, you're using the Error Auditing. Right-click the server and go to Report & Delivery Settings -> Report Settings and you can turn the auditing requirement back off (it's step 1 in the link above).

link

answered 22 Apr '13, 18:14

Doug's gravatar image

Doug ♦♦
10.2k122138
accept rate: 21%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4
×2
×1

Asked: 19 Apr '13, 09:00

Seen: 9,581 times

Last updated: 22 Apr '13, 18:14