Tuesday, March 13, 2012

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) {
LOG.info("Purged " + alarms.size() + " alarms older than " + cutoff);
return "Purged " + alarms.size() + " alarms older than " + cutoff;

No comments:

Post a Comment

Raspberry Pi Zero W - Wireless Configuation

create the file under "boot" folder wpa_supplicant.conf country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev u...