Monitor and restart stopped Windows services in SAM
To automate the monitoring and restarting of stopped Windows services, you can assign a Windows Service Monitor to nodes and then set up an alert to restart services and send email.
Note the following details about creating alerts to restart stopped Windows services:
- The action to restart the service uses the credentials which the component is currently being monitored with.
- WMI requires administrator privileges on the target machine by default; permission issues can occur if the accounts have limitations.
SolarWinds Support cannot assist with creating a least-privileged Windows user account or assigning permissions. Click here to learn about creating a non-administrator user for SAM polling.
- If polling the service via Windows agent, the agent runs under the context of the LocalSystem account on the target machine so it requires sufficient privileges to restart the service.
- The action to restart the service will only work with a component monitor-based alert. If the alert is set up as an "I want to alert on an application monitor" on the Trigger Condition tab, the restart service alert action will not function.
Click here to learn more about alerts, or watch a SolarWinds Lab Bits video, Automating Alert Trigger Actions.
Create the monitor
- Click Settings > All Settings > SAM Settings > Component Monitor Wizard.
- Select Windows Service Monitor, and then click Next.
- Enter the IP address of the Windows node you want to monitor, or click Browse to select the node from a list.
- Enter or select the appropriate credentials, choose a Platform type, and then click Next.
- Select services to monitor and click Next.
- Select component monitors and edit properties as necessary, and then click Next.
- On the Add to Application Monitor or Template tab, type a name for the new template and click Next.
- On the Assign to Nodes tab, select the desired nodes to monitor and click Next.
- On the Confirm tab, click OK, Create.
Create an alert to restart stopped Windows services and then send an email
- Click Alerts & Activity > Alerts.
- On the All Active Alerts page, click Manage Alerts.
- On the Manage Alerts page, click Add New Alert.
- In the Add New Alert wizard, provide alert details on the Properties tab and click Next.
- On the Properties tab, provide alert details.
- On the Trigger Condition page:
- For "I want to alert on", select Component.
- Choose an alert scope.
Configure a trigger condition as follows: Component > Component Name (Component Alerting Properties) > Is equal to > Windows Service Monitor.
- Click Next to advance to the Reset Condition tab.
- Enter values on the Reset Condition and Time of Day tabs, as necessary.
- On the Trigger Actions tab, add an action to send email.
- Click Add Action.
- Select Send an E-Mail / Page and click OK.
- Complete the e-mail info and click OK.
- Click OK.
-
On the Trigger Actions tab, add an action to restart the service:
- Click Add Action.
- Select Execute an External Program, and then select Configure Action.
- Provide a name for the action.
-
Under Network path to external program, insert the following:
C:\Program Files\SolarWinds\Orion\APMServiceControl.exe
${N=SwisEntity;M=ComponentAlert.ComponentID} -c=RESTART
- Click Add Action.
-
For the Reset Action tab, specify actions to complete when resetting the alert.
- On the Summary tab, review the configuration and make any necessary changes.
- Click Submit.