How to restart a service from another component alert?


I am trying to create an alert that checks for a couple of things.  

1. Windows Service "Tomcat X" 
2. HTTP Status

If the HTTP status shows down I want to trigger a service restart the service component, even though that component is showing up.  Is this possible?

  • You can get really complex or really simple with this scenario. The easy answer is to look up the component id of the service you want to restart, make a copy of the ootb service restart alert, edit it so it is specifically checking your http component and instead of passing the alert action the ${componentid} variable you just hard code it in so when http component is down then componentid 1234 gets restarted.

    That'll work for a small scale situation but if you have a lot of combinations like that it can be kind of a pain to build that all out, so in the past I've used custom properties and custom sql variables to hold all the logic i needed to correlate a given component to the services I wanted to restart.
  • Thank you.  In this alert, I just want to know if X is down and restart one service.   But do you have a syntax example of what something like that would look like?

  • There is an out of the box alert called "Restart a Service" that you can copy as your example.

    On the trigger definition you set up your rules, and the main change is on the actions to this:
    APM\APMServiceControl.exe ${N=SwisEntity;M=ComponentAlert.ComponentID}

    and change it to (assuming that 1234 is the componentid of that specific service you want to restart)
    APM\APMServiceControl.exe 1234