3 Replies Latest reply on Jun 13, 2018 6:14 PM by thyrsus

    Linux/Unix Script monitor with Agent


      I'm trying to write an Up/Down monitor script with no associated statistics, with swiagent running on the Linux box.  swiagent is reporting "native" resources (cpu, file systems, interfaces, etc.) just fine.


      I've attached a screen shot of my attempted component test.  Even though it runs (the output "it ran" comes back) and obviously(?) exits 0, the test doesn't recognize the status as "up", but instead claims it is unknown.  What do I need to do differently?  SAM is version 6.4.


      Needless to say, the actual code will be more elaborate, but for now I need to be able to return an "up" status.

        • Re: Linux/Unix Script monitor with Agent

          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.

          SAM Script Component Monitors - Everything you need to know


          Let us know if you get it working.



          Thank you,



          1 of 1 people found this helpful
            • Re: Linux/Unix Script monitor with Agent

              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).


            • Re: Linux/Unix Script monitor with Agent

              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.