Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

Targetting for an XML monitor

$
0
0

Hi I have created a three phase script to run a vbscript to monitor an XML file for messages. The script is attached. I can run it outside of SCOM without issue. Im just not sure how to target it in SCOM, ive tried windows server?

Dim FSO,oArgs,oAPI, sfolder, oBag
On Error Resume Next
Set oAPI = CreateObject("MOM.ScriptAPI")
Set FSO= CreateObject("Scripting.FileSystemObject")
Set oArgs = WScript.Arguments
'Set oBag = oAPI.CreatePropertyBag()

set xmlhttp = createobject ("msxml2.xmlhttp.3.0")
xmlhttp.open "get", "URL",
xmlhttp.send

intCount = 0
myString = xmlhttp.responseText

intCount = GetSubstringCount(myString, "message id=", False)
'wscript.echo intCount

'wscript.quit

'=======================================================================
Function GetSubstringCount(strToSearch, strToLookFor, bolCaseSensative)
               If bolCaseSensative then
                              GetSubstringCount = UBound(split(strToSearch, strToLookFor))
               Else
                              GetSubstringCount = UBound(split(UCase(strToSearch), UCase(strToLookFor)))
               End If
End Function


Set strResult = intCount
if err.number > 10 Then
Wscript.echo "WARNING"
     'Call oBag.AddValue("Status", "WARNING")
Else
     if err.number > 20 Then
Wscript.echo "BAD"
          'Call oBag.AddValue("Status", "BAD")
     Else
Wscript.echo "GOOD"
           'Call oBag.AddValue("Status", "GOOD")
     End If


Viewing all articles
Browse latest Browse all 11941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>