SCOM 2016 – Unix/Linux service monitoring

SCOM 2016 – Unix/Linux service monitoring

Spread the love

Hi all!, today I am going to write about Linux/Unix service monitoring in SCOM 2016. Is really very simple and easy to do and I recommend to you to read my last post about Linux/Unix onboarding in SCOM.

Linux/Unix service monitoring

Pre requisites

Service monitoring

Before configuring the service monitoring, you have to keep in mind that the service that you want to monitor must be running in the Linux/Unix server, if the service is not running you are not going to be able to monitor it.

The first thing that we are have to know is the service name, for that, we go to the Linux server and type the following command to get the list of all the services: sudo service –status-all

The plus sign (+) means that the service is up and the minus sign (-) that the service is down. For this example, we are going to create a unit monitor for the mysql service.

Now that we have the name of the service, we go to the SCOM console > Authoring > Management Pack Objects > Monitors > Right Click > Create a monitor > Unit monitor

In the “Select a Monitor Type” window we expand the Scripting folder > Generic and we are going to create a UNIX/Linux script two state monitor. If we have a Management Pack to save the monitor we select it, and if not, we create it.

In the “General properties” click on Target and select Universal Linux Computer or the target that corresponds according to the server that you want to monitor. Then give a name to the monitor and a description, and select “Availability” as a Parent Monitor and click Next.

In the Scheduler windows, we will configure every how many minutes the monitor will run and click Next.

In the Script Details, we are going to insert the bash script to check the status of the monitor, for that, I use the following script:

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
echo “0”
echo “1”

This script will write a 0 if the service is Up or a 1 if the service is down. Change the service variable for the service you want to monitor and click Next.

In Error Expression windows, we change the first parameter to Equal 1

And in Healthy Expression to Does not equal 1

The configure Health window click Next and in Configure Alerts we are going to do the following changes:

  • Select Generate alerts for this monitor.
  • In the Generate an alert box, select The monitor is in a critical health state.
  • Leave the box selected to automatically resolve the alert.
  • In the Alert name box, type MySQL service is not running.
  • Clear the existing text in the Alert description box and type Computer:
  • Click on the ellipse button.
  • Target and then select Network Name.
  • Click OK.
  • In the Alert description box, add a new line and type StdOut: $Data/Context///*[local-name()=”StdOut”]$
  • Click on Create

Alert check

Now we verify that the alert was configured. We go to Monitoring > Unix/Linux Computers > Rick click on the Server > Open Health Explorer

Click on Filter monitors and expand Availability, and there we have our monitor!

Now, go to the Linux server and type the following command: Sudo service mysql stop

Go back to SCOM and wait to get the alert.


And that is all! We have the alerts configured every time our service is down!

I hope you like this post and let me know if you have any question! Enjoy it!



One thought on “SCOM 2016 – Unix/Linux service monitoring

Leave a Reply

Your email address will not be published. Required fields are marked *