1 of 1 people found this helpful
thyrsus I don't have much experience with SAM, but I think you need to print your output like this:
print "Statistic: 1" print "Message: It ran"
I believe SAM requires a "Statistic" value, which must be a number, or something like that. I just added a simple bash script, which simply returns a number. Then, I set my alerts/thresholds/etc. based on the returned value as compared to 0.
I have used this post to piece things together.
Let us know if you get it working.
I tried that, and it doesn't seem to have helped. With those added lines, it stops complaining about unrecognized values, but it still reports
Test failed with "Unknown" status"
(missing glyphs and typos in the above because text copying is somehow disabled) and "Details" still reports:
Testing on target node failed with 'Unknown' status ('Unknown' might be different if script exits with a different exit code).
Here's what fixed it: apparently it is mandatory to run the "GET SCRIPT OUTPUT" test after changing the script. Having done that, the 0 exit code was recognized as the success that was intended when running the test from the Component Monitors section. Apparently, since I'm communicating with swiagent, I can select credential "[NONE]" after "GET SCRIPT OUTPUT" and it works.
wluther, there is indeed a complaint if there is no "Statistic: 0" or similar on stdout; I'll explore what that means more deeply later.
[Edit] The lack of a "Statistic: <integer>" prevents "GET SCRIPT OUTPUT" from passing, and prevents further recognition of the exit status, so the "Statistic: <integer>" output is mandatory. For "<integer>", I'm using "0" for up and "1" for down.