Best Way to Monitor Services in Windows Server 2008 #server #monitor #service

#

Best Way to Monitor Services in Windows Server 2008/2012 (No Install Required)

Recently I faced a challenge where I had to setup a system to monitor a service running on one of systems running operating system Windows Server 2012. In this article I will describe the approach used to monitor a service running on Window Server 2008/2012 without installing any kind of third party applications. Before we proceed with the setup, please gather following details and keep them ready with you:

Service Name

Service name can be obtained from Services application in Windows. To launch this application, go to run and execute services.msc command. From the Services application, note down the exact Name of the service to be monitored. For this example I m using the service name as DHCP Client .

SMTP Server and Port

Consult with your network team to obtain the SMTP server and port. Default port for SMTP server is 25. SMTP server and port are required to trigger email alerts.

Configuration

To configure the alert we need to first create a script, store it on the local system and schedule it using Windows Task Scheduler.

Script

Following is the VB script we will be using to monitor a service in Windows Server 2008/2012.

Change the Service Name, SMTP server and port, from, to and cc email addresses according to your settings:

Save this script with a .vbs extension (not .txt)

Store the script at some location for e.g. E:\DHCP\ServiceMonitor.vbs

Windows Task Scheduler

Open Task Scheduler (Schedule Tasks from Control Panel)

Create new folder for your task

Click on the newly created folder and click on Create Task from Actions window pane on right side.

In General tab, fill in the name of the task, Under security options select Run whether user is logged in or not and check the checkbox besides Run with highest privileges.

In Trigger tab, create a new trigger and set it run daily with an option to repeat task every 5mins indefinitely. Click Ok.

In actions tab, create new action to Start a program, with Program location as C:\Windows\System32\cscript.exe

In add arguments section specify the path to the VB script for e.g. E:\DHCP\ServiceMonitor.vbs

In condition tab, keep the default settings (modify them if you know what you are doing)

Click Ok. A prompt will popup to enter your credentials. Enter the same and click OK.

A task will be created and will run every 5min and send you alerts incase the service being monitored stops running:

That s all folks!

Let me know if you liked this article and it helped you. Also, if you have any questions related to monitoring services in Windows Server 2008/2012, please use the comment form below to post the same.

Post navigation

Recent Posts

Categories





Leave a Reply

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