Hook to remove monitoring during shutdown in Linux

By default when a server being monitored by UCM revealcloud is powered off, it appears inactive. Incase, if it is never powered up again, it remains showing up as an inactive server on the UI. Such entries are stale and create unnecessary performance issues.

In the Auto-Scaling during scale-down, the inactive and stale entries of servers remain as remnant. As matter of good practice these stale entries should be removed during or after shutdown of server.

In Linux a shutdown hook can be created to remove the server from UCM monitoring. For this following steps are to be followed.

vi spot-shutdown.sh

#!/bin/bash -x

apisrv='api.copperegg.com'
apikey='APIKEY'

# Remove the system:
/usr/local/revealcloud/revealcloud -k ${apikey} -R -m -a ${apisrv}

/sbin/poweroff -p

 

chmod +x spot-shutdown.sh
sudo sysctl -w kernel.poweroff_cmd=spot-shutdown.sh

 

 

Powered by Zendesk