![](https://i0.wp.com/media.dev.to/cdn-cgi/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmkh3r014ibt8kj875svq.png?w=1200&ssl=1)
This is the procedure for monitoring the service status of SQLServer on Windows with Prometheu.
++++++++++++++++++++++++++++++++
[environment].
prometheus : Ver. 2.23.0
prometheus-alertmanager : Ver. 0.15.3
++++++++++++++++++++++++++++++++
Describe the SQLserver service monitoring rules in the yml file (rules.yml by default) where the monitoring rules are set.
In this case, we will describe a configuration that alerts when the state of the SQLServer service is anything other than ‘started’.
- alert: SQLServer-ServiceDown expr: windows_service_state{job="[job name]", name="[target instance service name]", state="running"} == 0 #1 is running, 0 is not running for: 7m #If this duration is exceeded, the alert will change from Warning to Critical. s(seconds) m(minutes) labels: AlertGp: [alert group name] #This name is arbitrary. You can set any group label for the alert. This label can be used in alertmanager.yml.
Discover more from Coursity
Subscribe to get the latest posts sent to your email.