Heartbeat Monitoring Off/On programmatically?


(Alexander) #1

In service pulse, there’s a way to flip a switch in settings to turn heartbeat monitoring on and off. Is there a way to do it programmatically?
Thanks


(Indu Alagarsamy) #2

Hi Alexander,

Currently this is not possible. I’ve raised an issue here:

Thanks,
Indu Alagarsamy
Particular Software


(William Brander) #3

Do you mean to programmatically turn heartbeat monitoring off in ServicePulse, or to disable the plugin completely?

You could call the Rest API that disables heartbeat monitoring within ServicePulse programmatically, which would be the same as if you turned heartbeat monitoring off from within ServicePulse. If you want to disable the plugin completely, the only way to do that is to restart the endpoint and not call the SendHeartbeatTo method.


(Alexander) #4

One of our processes needs to stop Service-A for a period of batch cycle running. We have a monitoring service that’s subscribed to ServiceControl’s HearbeatStopped/Restored events and if a heartbeat stopped, the support is notified. I’ve changed the monitoring service to stop monitoring the Service-A’s heartbeat during batch cycle. However, the ServicePulse dashboard shows that the Service-A heartbeat stopped. It’d be nice if the dashboard did not show the stopping so that support does not get confused.
I’m thinking, I should have disabled the HeartbeatStopped event instead of changing monitoring service. That way both the ServicePulse dashboard and our monitoring service would not raise an alarm when the Service-A is stopped during the batch cycle.
If RestAPI can accomplish this, then point me to its documentation and samples.


(William Brander) #5

The Rest API is not documented unfortunately, but you can send a PATCH request to http://{SERVICECONTROLURLANDPORT}/endpoints/{endpointId} with the data object being { "monitor_heartbeat": false } to disable monitoring of an endpoint.

As you mentioned though, I think it would be better (and more consistent) to disable the subscription to the HeartbeatStopped, or at least have a flag in your monitoring service that checks if the alerts are valid or not. This feels more natural than disabling heartbeat tracking to me.