Monday, August 9, 2010

Scripting a 'Suspend Alarms' Function

In Kaseya we were used to a very handy feature in the monitoring system called Suspend Alarms.  We used this extensively during maintenance periods and one-off server reboots.  As you can guess, this would suspend the generation of any alarms during our maintenance.

I found that in LabTech there wasn't a similar function like we were used to in Kaseya.  In LabTech you opened the machine and checked the 'Disable Alerting' checbox under the info tab. This would certainly disable alerting, but our concern was that it could accidentally remain checked if the tech forgot to uncheck it.  Also, it really wasn't a solution to our maintenance window issue where we need to suspend alarms on large numbers of servers at one time.

The solution was to write a script to enable and disable the Disable Alerting.  Since there wasn't any specific function in the scripting to set this field, it required using a Run SQL script command.

update agentcomputerdata set NoAlerts = 1 where ComputerID='@computerid@'

Pretty simple, but then we wanted to ensure that it was set back to 0 some time later so my solution was to add two more steps to the script.  Step 2 was to put the script to sleep for a while, say 30 minutes then run another sql command to set NoAlerts back to zero (same sql statement with a 0).

I was pretty happy with that, but then Bill Morgan from LabTech suggested that we just add an enable and disable script to our maintenance script groups and then we wouldn't need to treat it as a separate item.  I think we might have come to that conclusion on our own as we decided *where* we would schedule this script, but it was another one of those ah-ha moments.

The best part of this is that it will cure one of our most common mistakes, rebooting a server without first suspending alarms.  Yes, about 50% of the time when a tech schedules a reboot (outside of or normal maintenance window), they forgot to suspend the alarms in Kaseya.  Because rebooting is a script AND disabling of alarms is a script, why not just combine the steps?  By combining these two scripts we will no longer even need to think about suspension of alarms.

DW

No comments:

Post a Comment