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
      }
         else
      {
         alarms[alarmName] = alarmEntry + 1
      }
   }
for (alarm in alarms.entrySet())
   {
      result.append(alarm.getKey()).append(" ").append(alarm.getValue()).append("\n")
   }
return result

Comments

Popular posts from this blog

Brocade Zone Setup

OpenSolaris ZFS Setup

Console over SSH (ONTAP)