Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

Alert to restart Windows service when HTTP monitor under the same Application monitor fails

I have a SAM application monitor that has 2 component monitors - a Windows service monitor to verify the service for the application is up, and an HTTP monitor to verify that the web content of the application is up. I want to create these alerts for the application monitor:

1) An alert to restart the Windows service if it's down. This one is easy using the external program call "APM\APMServiceControl.exe ${N=SwisEntity;M=ComponentAlert.ComponentID} -c=RESTART".

2)  An alert to restart the Windows service if the service is up, but the web page isn't working. Is this possible? If the alert is a component level alert, the component that's failing is the HTTP monitor, so would the alert have access to the ID of the Windows service monitor? Is this possible if I create an application level alert instead of component level? Are there variables that have the component IDs for all component monitors under an application monitor?



Tags (1)
0 Kudos
3 Replies
Level 9

Hi Bob,


i think you have the idea for point 1, thats how it is implemented. 

for 2 - i would set up a component monitor alert looking at the HTTP monitor on whichever particular server. then when you check the windows service monitor component for that specific server you will see in the url what the component ID is for the specific service. The in the alert you could hard code the component id. So the command would look something like:

 APM\APMServiceControl.exe 123 -c=RESTART

this is where 123 is the component id for the specific windows service you want to restart. if you pipe in the c:\programfiles.... location in the alert it will run it locally on teh solarwinds server which will then restart whatever service corresponds to the component ID.


hopefully that makes sense?


It took me a while to find where to see the component id of the Windows service monitor. I had to go to "Manage Assigned Component Monitors", find the component monitor for the Windows service, select it, and then click on "Edit Assigned Application Monitor". That brought up the application monitor with the Windows service  component selected and expanded. The component id was in the URL:


I was hoping to find a way to get the component id through a variable, but if finding it manually and hard coding it in the alert action to restart the service is the only option, this should work. I'll try it.


0 Kudos

You can use the parameter in the command line when you build the alert. i believe it will be:


if you build the trigger condition scope in an alert to look at the component type of 9 - this will set it to only windows service monitors. you can then add in things for the component name for ServiceX etc.

0 Kudos