vFoglight Purge Alarms (Groovy Script)

Using the script editor located in Administration > Tooling > Script Console. Best to go ahead and save these for running at a later date when you need them. On line "4" you can enter the number of day to go back and delete. This script will only remove 10,000 alarms at a time so you might want to make a rule to prune down the alarms.

def alarmSvc = server.AlarmService;
def LOG = org.apache.log4j.Logger.getLogger("Alarm Purge Rule")
def now = new Date();
def cutoff = now - 180;
def Anchor = now - 2000;
def alarms = alarmSvc.getAlarms(Anchor, cutoff);

for (alarm in alarms) {
 alarmSvc.purgeAlarm(alarm.getID());
}
LOG.info("Purged " + alarms.size() + " alarms older than " + cutoff);
return "Purged " + alarms.size() + " alarms older than " + cutoff;

Comments

Popular posts from this blog

Console over SSH (ONTAP)

Brocade Zone Setup

vFoglight Purge Stale Objects (Groovy Script)