This is my first THACK discussion so please excuse me for any silly questions I ask plus I don't have much knowledge of scripting so need an expert advise here.
In our environment, I have multiple Linux servers hosting multiple applications with services that vary server to server. I am looking for a script which could monitor all running servers and alert me if any of the running service goes down.
I found below script at the following link;
status=`ps -ef | grep speechbridged | grep -v grep`
if [[ $status ]]; then
echo "Statistic: 1"
echo "Statistic: 0"
However not too sure how to tweak it to monitor all running servers rather than one.
You're better off doing them for each service. You can use bash or perl, whichever makes the most sense. I tend to use perl for my linux boxes, but mostly because I have more experience with it. Some hints, though, if you wanted to do it all under one monitor, you could include the list in your script, identify how many are not running as your statistic, and include a list of non-running services in your message. You can also have up to 10 statistics in a scripted monitor, so you could also output statistic.0, statistic.1, statistic.n ... statistic.9 (10 total). I don't usually do it this way because alert handling doesn't work as cleanly when you cram 10 statistics into one component.
This is where you should start with understanding how custom script monitors work with SAM, SAM Script Component Monitors - Everything you need to know
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process. Learn more today by joining now.