I've been trying to get this script working for what seems like eternity with no luck and I'd appreciate any help that you can provide. The problem is this:
We are trying to take a value presented in a REST page (see RestPage.jpg) and bring it into Orion for tracking, etc. However, when I try to run the script against the site, I get an NaN error that I can't seem to get rid of (see ScriptResult.jpg). The script we're using is a slightly modified version of one that we use against a different rest page with multiple name value pairs, and that works well there. I've been looking for ways to convert the string to a number, without success, and am wondering if I even need to as it is not explicitly converted in the other scripts that work. Anyway, if anyone can tell me where I'm going wrong here, I'd really appreciate it. Here is the full script in question.
args = WScript.Arguments.Count
If args < 1 then
Wscript.Echo "usage: GetPage.vbs URL"
wscript.Quit
end If
URL = WScript.Arguments.Item(0)
Set WshShell = WScript.CreateObject("WScript.Shell")
Set http = CreateObject("MSXML2.ServerXMLHTTP")
On Error Resume Next
http.setOption 2, 13056
http.open "GET", URL, False
http.send("")
if err.Number = 0 Then
strResult=http.responseText
Else
Wscript.Echo " error " & Err.Number & ": " & Err.Description
End If
statName = "Unique Users Since Midnight"
statValue = Trim(strResult)
WScript.Echo "Message.UniqueUsersSinceMidnight: Unique Users Since Midnight"
WScript.Echo "Statistic.UniqueUsersSinceMidnight:" & statValue