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.