Logo

EMDAD HAQUE

I am a seasoned IT Systems Engineer and Solution Architect specializing in systems design & administration, virtualisation, networking, code development and automation for on-prem and Azure / AWS cloud infrastructure.

View a list of my projects
View my certifications on Credly
View my career history on LinkedIn
Download my Résumé: pdf -- doc

Monitor a Service on an Azure Windows VM and Create an Alert Notification if the Windows Service is not Running

Date: 04 Feb 2025

Scenario: A critical Windows service runinng on an Azure VM crashes and needs to be manually restarted due to some manual authentication steps required by the service.

Requirement: The IT team needs to be alerted when the Windows service is not running so that remediation efforts can be made as soon as it occurs.

Summary:

It is possible to create Alerts in Azure based on performance metrics and Windows Event Logs. The Alert can be used to trigger a notification using an Action Group.

We can collect Event Logs from VMs using Data Collection Rules that employ Azure Monitoring Agent (AMA) installed on the VMs to send the logs to a Log Analytics WorkSpace. Then, we create an Alert based on a Custom Log Search query which can trigger an alert notification to be sent.

In Windows Server OS, we can monitor events with the Event ID 7038 for services changing running state or Event ID 7000 if the service fails to start.However, Windows Client OSes (such as Windows 8, 10 or 11) do not trigger the 7038 events. To address this limitation, we can use a PowerShell script to monitor the Service state and log an event.  


Steps:

 

 

 

 

You should now start to receive an alert notification every 15 minute if the monitored service is not in a running state over 15 minutes.

Hope this was helpful.

 


Back to Project List       Back to Top