Thanks everyone who sent me the suggestions. I had to delete 180,000 + alarms 
from Spectrum, which got created in a week because of a SBG integration I was 
testing with other NMS.

Anyways I first took the approach of deleting all the Stale alarms only 
(filtering on "grep Yes" below) from all the Event Models which got created. 
However this approach was taking too much of time. So I killed the nested for 
loop in the 4th command below, restored the database from previous day and 
destroyed all the Event models (except Default) using cli. After that I 
restated SS and OC and everything looks good now.

Below are the commands I used on  RHEL, just in case if anyone is interested.

== Find all Event Models and write their model handle in a file.
./show models mth=0x3dc0001 | cut -d' ' -f1 > /tmp/EventModels

== Write alarm id of all the stale alarms on different event models in 
different files.
for EM in `cat /tmp/EventModels`; do sleep 3 && ./show alarms -s mh=$EM | grep 
Yes | cut -d' ' -f1 > /tmp/alarm_$EM; done

== Remove all the event model files which are empty (has no alarms)
find /tmp -maxdepth 1 -size 0 -exec rm '{}' \;

== Delete alarms on the event models which have least alarms first.
for file in `ls -Sr /tmp/alarm_*` ; do echo "Processing file $file" &&  for ala 
in `cat $file`; do ./destroy alarm -n aid=$ala; done; done


== Destroy Event models after editing the file (remove default event model) 
from command 1 above
for EM in `cat /tmp/EventModels`; do sleep 5 && ./destroy model -n mh=$EM; done


Saurabh


From: Christian Fieres [mailto:[email protected]]
Sent: Wednesday, September 16, 2015 2:31 AM
To: spectrum
Subject: Antwort: RE:[spectrum] Delete all alarms from a model

Robert, list,

the correct CLI command is "destroy" - but I think it*s only suitable for user 
clearable alarms, which leaves the necessity to raise a specific clear event 
for every other alarm.

Freundliche Grüße

Christian Fieres

Mainova AG
Sachgebiet Netz- und Infrastruktur (M3-ST4)
Teamleiter Service Operation Center
Solmsstraße 38
60623 Frankfurt am Main

Telefon 069 213 23617
Mobil 0170 5601563
Telefax 069 213 9623617
E-Mail [email protected]<mailto:[email protected]>
Internet http://www.mainova.de<http://www.mainova.de/>




Von:        <[email protected]<mailto:[email protected]>>
An:        "spectrum" 
<[email protected]<mailto:[email protected]>>,
Datum:        16.09.2015 08:28
Betreff:        RE:[spectrum] Delete all alarms from a model
________________________________



Must be pretty simple to write a script that does that, something like below..

show alarms mh=<model_hangle> | while read ALARM
  Do
                           Clear $ALARM
Done

/R

From: Bohra, Saurabh [mailto:[email protected]]
Sent: den 15 september 2015 18:57
To: spectrum
Subject: [spectrum] Delete all alarms from a model

Is there a way to bulk delete all the alarms from a model using cli or do I 
have to destroy them one at a time?

Also, if bulk deleting is not available, does anyone know what will be the 
impact if a destroy a model which has a couple of thousand active alarms on it?

Saurabh


  *   --To unsubscribe from spectrum, send email to 
[email protected]<mailto:[email protected]>with the body: unsubscribe spectrum 
[email protected]<mailto:[email protected]>
  *   --To unsubscribe from spectrum, send email to 
[email protected]<mailto:[email protected]>with the body: unsubscribe spectrum 
[email protected]<mailto:[email protected]>

Mainova Aktiengesellschaft - Solmsstraße 38 - D-60623 Frankfurt am Main
Vorsitzender des Aufsichtsrates: Stadtkämmerer Uwe Becker
Vorstand: Dr. Constantin H. Alsheimer (Vorsitzender), Norbert Breidenbach, 
Lothar Herbst
Sitz der Aktiengesellschaft: Frankfurt am Main - Amtsgericht Frankfurt HRB 7173 
- USt-IdNr. DE 114184034


Mainova steht für besten Service, faire Verträge und top Preise für Ihre 
Energie - mit Auszeichnung!
Mehr Infos unter: http://www.mainova.de/auszeichnung

  *   --To unsubscribe from spectrum, send email to 
[email protected]<mailto:[email protected]> with the body: unsubscribe spectrum 
[email protected]<mailto:[email protected]>

---
To unsubscribe from spectrum, send email to [email protected] with the body: 
unsubscribe spectrum [email protected]

Reply via email to