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