Hello together,
i hope anybody can help me? - With my JMX-Java Program i can access to our SAP Web Application Server. The Java-Program save the result into a textfile. Do you have a ShellScript for HM in VBScript that can pick out the value and compare it with a threshold? - We need this solution to have a report. At the moment we have set in the Java-Program a threshold and write the result out in the textfile: "ok" or "bad". This is not a good solution. We use in the HM the file compare function, but then we have only a info whether the value ist good or bad. With a ShellScript we could have a reporting
We do not have "cooked" solution for this particula issue. However, I do not think it is a big problem to write such a script. If you search through this forum with "shell script file" keywords, you will wind a lot of useful examples.
Could you provide a piece of log to parse?
yes, you have right. I wrote this shell script in HM:
--------------------------------------
Dim fso, datei, aVar , intValue
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set datei = fso.OpenTextFile("\\139.3.202.234\J2EE\dedussv-ep001_Application_ActiveThreadsCount.txt")
Do Until datei.AtEndOfStream
aVar = datei.ReadLine
Loop
Datei.Close
intValue = CInt(aVar)
rem WScript.StdOut.Write aVar
WScript.StdOut.Write intValue
--------------------------------------
In the script monitor i got the result from the textfile, but in the HM i got now the following error-message:
Error: Invalid result ( 8 )
The result is ok, but what i do make wrong. What must i do to get the value in the shell script test method? - I set the point: params to: intValue.
rsteffen wrote:What must i do to get the value in the shell script test method? - I set the point: params to: intValue.
Use warning status -> ("%Reply%">"10")
I think, you should perform comparison operation right in the script. I slightly modified the script, now it should work for you:
Option Explicit
const statusAlive = "scriptRes:Host is alive:"
const statusDead = "scriptRes:No answer:"
const statusUnknown = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"
Dim fso, datei, aVar , intValue
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set datei = fso.OpenTextFile("\\139.3.202.234\J2EE\dedussv-ep001_Application_ActiveThreadsCount.txt")
Do Until datei.AtEndOfStream
aVar = datei.ReadLine
Loop
Datei.Close
intValue = CInt(aVar)
if intValue > 10 then
WScript.StdOut.Write( statusBad & IntValue)
else
WScript.StdOut.Write( statusOk & IntValue)
end if
Also, I do not think it is a good idea to hardcode file name and threshold in the script body. You may modify this script using "WScript.Arguments" object to pass these values as a parameters into the script