Tuesday, March 13, 2012

vFoglight Alarms with Counts (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. This will give you all of the alarms in the system along with the number of times it has triggered.

alarmService = server.get("AlarmService")
currentAlarms = alarmService.getCurrentAlarms();
def alarms = [] as TreeMap;
def result = new StringBuilder();
for (currentAlarm in currentAlarms)
      def alarmName = currentAlarm.getSourceName()
      def alarmEntry = alarms[alarmName]
      if(alarmEntry == null)
         alarms[alarmName] = 1
         alarms[alarmName] = alarmEntry + 1
for (alarm in alarms.entrySet())
      result.append(alarm.getKey()).append(" ").append(alarm.getValue()).append("\n")
return result

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...