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
   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
    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

accept rate: 50%

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


answered 19 Apr '13, 16:45

GabrielS's gravatar image

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.



answered 19 Apr '13, 10:12

Quinn's gravatar image

Quinn ♦♦
accept rate: 36%

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.


answered 19 Apr '13, 15:29

GabrielS's gravatar image

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).


answered 22 Apr '13, 18:14

Doug's gravatar image

Doug ♦♦
accept rate: 22%

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 19 Apr '13, 09:00

Seen: 7,191 times

Last updated: 22 Apr '13, 18:14