1) In Spotlight alarm configuration, select “Run a program”.
2) In command box enter the following (note that parameters need to be put in double-quotes):
C:\test.bat "{{CUSTOMER_OBJECT_NAME}}" "{{MESSAGE}}" "{{RULE_NAME}}" "{{SEVERITY}}" "{{TIME}}" "{{value}}" "{{key}}"
Then create the C:\test.bat file containing the following command:
wscript C:\test.vbs %1 %2 %3 %4 %5 %6 %7
And, finally, create the C:\test.vbs file containing the following script:
Dim Args
Set Args = WScript.Arguments
Dim objFSO, objFolder, objShell, strDirectory, strFile, strText
strDirectory = "c:\"
strFile = "\test.txt"
strText = Args(0) + " " + Args(1) + " " + Args(2) + " " + Args(3) + " " + Args(4) + " " + Args(5) + " " + Args(6)
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
'WScript.Echo "Just created " & strDirectory
End If
If objFSO.FileExists(strDirectory & strFile) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFile = objFSO.CreateTextFile(strDirectory & strFile)
'Wscript.Echo "Just created " & strDirectory & strFile
End If
set objFile = nothing
set objFolder = nothing
' OpenTextFile Method needs a Const value
' ForAppending = 8 ForReading = 1, ForWriting = 2
Const ForAppending = 8
Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, ForAppending, True)
' Writes strText every time you run this VBScript
objTextFile.WriteLine(strText)
objTextFile.Close
Every time an alarm is configured to run the above VBS triggers the alarm details will be logged into the C:\test.txt file.