I'm trying to use the Linux Script montitor to return some values. I can run my bash script on the server and get the expected return, but I'm have trouble getting APM to do this. Any input would be appricated.
Here is what I have so far.
I've made some changes that appear to be helping. I removed the "./" and "ZONE1-WIRELESS" from the command line field.
The Script body now looks like this;
psql -h localhost -U postgres controlsmartdb -f /root/NACStats/NACqueries/ZONE1-WIRELESS.sql | grep -v 'count' | grep -v '-' | grep -v 'row'| grep -v "^$" | awk '{sub(/^[ \t]+/, ""); print}'
Now I'm getting hte following error; Script output did not contain required field "Statistic:". Actual script output begins "313"
Hello Jeff,
your Linux script must follow certain guidelines regarding return values and output. Look at our help: www.solarwinds.com/.../OrionAPMAGCreatingLinuxUnixScriptMonitor.htm
Your script must output Message and Statistic values and exit with appropriate exit code to work as expected.
Hi, Jeff. The Linux script monitor in Orion APM expects your script to return a few things: A string that reads "Statistic: x" where x is the value you want Orion APM to keep as a statistic, and an error code that tells Orion APM what status it should return.
The error you got means Orion APM did not see the expected "Statistic: x" at the start of the output, but received "313" instead.
(fromCreating a Linux/Unix Script Monitor):
...
Linux/Unix Scripts Report Status Through Exit Codes
Scripts must exit with an appropriate exit code so that Orion APM can select a status for the component monitor:
Exit Code: Meaning
0: Up status
1: Down status
2: Warning status
3: Critical status
Any other value: Unknown status
Linux/UnixScripts Must Have Text Output
Scripts report additional details by sending text to the script’s standard output. Each line of output can contain a single detail in the following format:
DetailType: Value
Detail Type. Required?. Meaning.
Message. Optional. An error or information message to be displayed in the monitor status details.
Statistic. Required. A numeric value used as the Orion APM statistic.