none
URL Script Monitor RRS feed

  • Question

  • Hey

    i am monitoring my application urls using a vb script & tested which are working fine.

    They are alerting me as & when their is a break up in the link or content not found.

    my problem come up here.....

    when the link is back or the content is found the monitor is not closing by it self though i recalculate health the monitor is still in error state.

    any help would be a great help.

    -Raj
    Wednesday, September 23, 2009 4:07 AM

Answers

  • Hi Raj

    Are you running this from a monitor? If so, do you have the "Automatically resolve the alert when the monitor returns to a healthy state" option selected?

    Also, on the monitor, have you set healthy expression correctly? It looks like you have an ' (single quote in the "good'"). It should be:

    Call oBag.AddValue("Status","GOOD")

    Property[@Status='GOOD']

    Cheers

    Graham
    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Marked as answer by vrkumar01 Monday, October 12, 2009 2:44 AM
    Saturday, October 10, 2009 3:35 PM
    Moderator

All replies

  • It would be difficult to debug the issue without looking at code.

    I would debug the script to see how it is behaving when the URl is back online and also check the configuration of the monitor.


    This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
    Friday, September 25, 2009 10:51 PM
  • Hey Vineet,

    here is the script i am using

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Dim oAPI, oBag, obj, iArgs, iCounter, strURL, iState, strPattern, strError, objRegExp, objMatches

    On error Resume Next

    Set oAPI = CreateObject("MOM.ScriptAPI")

    Set oBag = oAPI.CreatePropertyBag()

    iArgs = Wscript.Arguments.Count

    iCounter = 0

    iState = 0

    strError = ""

    Do while iCounter< iArgs

    strURL = Wscript.Arguments(iCounter)

    strPattern = Wscript.Arguments(iCounter + 1)

    iCounter = iCounter + 2

    Set obj = CreateObject("MSXML2.XMLHTTP")

    obj.open "GET", strURL ,False

    obj.send

    If err.number <>0 Then

    ' wscript.Echo err.description

    strError = strError & strURL & ":" & err.description & " "

    iState = 1

     

    err.number = 0

     

    else

    ' wscript.Echo "Status:" & obj.Status

    ' Wscript.Echo obj.responseText

    Set objRegExp = New RegExp

    objRegExp.IgnoreCase = True

    objRegExp.Global = True

    objRegExp.Pattern = strPattern

    Set objMatches = objRegExp.Execute(obj.responseText)

    ' Wscript.Echo strPattern, "-> ", " found ", objMatches.Count

    if objMatches.Count > 0 Then

    strError = strError & strURL & ": Pattern [" & strPattern & "] found "

    iState = 1

    End If

    End If

    Loop

     

    if iState = 1 Then

     

    ' wscript.Echo strError

    Call oBag.AddValue("Status","BAD")

     

    Else

    ' wscript.Echo strError

    Call oBag.AddValue("Status","GOOD'")

     

    End If

     

    Call oBag.AddValue("ErrorMessage",strError)

    Call oAPI.Return(oBag)

    Wscript.quit
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    parameters are "Url" "content match"
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Please let me know if this helps.

    -Raj

    Sunday, September 27, 2009 5:09 AM
  • Hi Raj

    Are you running this from a monitor? If so, do you have the "Automatically resolve the alert when the monitor returns to a healthy state" option selected?

    Also, on the monitor, have you set healthy expression correctly? It looks like you have an ' (single quote in the "good'"). It should be:

    Call oBag.AddValue("Status","GOOD")

    Property[@Status='GOOD']

    Cheers

    Graham
    View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/
    • Marked as answer by vrkumar01 Monday, October 12, 2009 2:44 AM
    Saturday, October 10, 2009 3:35 PM
    Moderator