cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

Monitor all running processes in Linux Server

Hello Experts,

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;

Linux/Unix Monitor

#!/bin/bash

status=`ps -ef | grep speechbridged | grep -v grep`

if [[ $status ]]; then

    echo "Statistic: 1"

else

        echo "Statistic: 0"

fi

However not too sure how to tweak it to monitor all running servers rather than one.

Kind Regards

Labels (1)
0 Kudos
2 Replies
Level 11

How many processes are you wanting to monitor?  You could create one application template and then add multiple component monitors, one for each process:Untitled44.jpg

Level 12

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

0 Kudos