I would like to know if there is a way that I would be able to automate the clearing of alarms that are older then a certain number of days old.
Current versions of Foglight automatically purge alarms when they've been cleared for more than 30 days. This is configurable through the AlarmPurgeAge Registry Variable.
Here is a groovy script that you can schedule to run that will clear alarms older than X days old. It is currently set to 60 days, which you can change to meet your needs. Remember that when automatically clearing alarms if the condition is still true the alarm will fire again after it is cleared.
// alarmAge defined in days (change this) alarmAge = 60; ageMSecs = alarmAge * (24 * 60 * 60 * 1000L); alarmSvc = server.get("AlarmService"); output = new StringBuilder(); now = new Date().getTime(); currentAlarms = alarmSvc.getCurrentAlarms(); i = 0; for (alarm in currentAlarms) { timeDifference = now - alarm.getCreatedTime().getTime() if (timeDifference > ageMSecs) { alarmSvc. clearAlarm (alarm. getID()); i++; } } return "Cleared ${i} alarms out of ${currentAlarms.size()} in the range";
This can be run manually on the Script Console or used in the condition of a Time Driven custom rule.
© ALL RIGHTS RESERVED. 이용 약관 개인정보 보호정책 Cookie Preference Center