Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

Parsing the StdOut from a linux shell command in SCOM 2012 SP1

$
0
0

Hi,  We have configured a linux shell command 2 state monitor on SCOM SP1, to run a quick command on a mongodb server.  The monitor is disabled in general but enabled for  a single mongodb test server.  

The shell command is:

mongo admin --eval "printjson(db.runCommand( { replSetGetStatus : 1 } ))" | grep "state"

results in :

                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "state" : 2,
                        "stateStr" : "SECONDARY",

How can I parse this text after it comes back to scom so I can look specifically at the state values?   I heard this is a way to do this with powershell in the linux shell command monitor but not sure how its done.

Thanks in advance


Thanks Lance


Viewing all articles
Browse latest Browse all 11941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>