Heartbeat Monitoring Off/On programmatically?

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?

Hi Alexander,

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

Indu Alagarsamy
Particular Software

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.

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.

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.