Using CLI to Remove Existing Alarms that are not User Clearable
search cancel

Using CLI to Remove Existing Alarms that are not User Clearable

book

Article ID: 9001

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

Existing alarms in OneClick cannot be cleared because at the time they were generated the "Alarm is User Clearable" field was not selected in Event Configuration Editor

Environment

CA Spectrum

Cause

Selecting the "Alarm is User Clearable" Field in Event Configuration Editor will only apply to new alarms that come into OneClick and not existing alarms.

 

Resolution

 

The only way to clear these alarms will be to manually generate the event as specified in the Event Configuration Editor that clears the alarm.
     This can be done using CLI and is pretty simple if you only have one or two alarms that need to be cleared. An example of this is below:

 

Log on to the SpectroSERVER that the device is modeled on which has the alarm:

 

** For Windows you will first need to open a bash shell (bash -login) before running the following commands:

cd <SPECROOT>/vnmsh
./connect
./create event type=<EVENT_CODE_THAT_CLEARS_THE_ALARM> text="Clearing Event" mh=<MODEL_HANDLE_OF_DEVICE>


Once this event is generated the alarm in OneClick will clear. 

 

While this can be run for one or two instances, what if there is 100 alarms of the same type that need to be cleared?

The script below will achieve this in just one command:

 

You will need to take the following text and save it as a <FILENAME>.sh file and place it in the <SPECROOT>/vnmsh directory on
  the SpectroSERVER. You will then just need to insert the cause code that originally generated these alarms and the event code for
  the event that will clear them:

------------------------------------------------------------------
#!/bin/sh 

echo "
CA Incorporated
One CA Plaza 
Islandia, NY 11749 
Copyright (c) 2017 CA, Inc. 
All rights reserved. 

IN NO EVENT SHALL CA INCORPORATED BE LIABLE FOR 
ANY INCIDENTAL, INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES 
WHATSOEVER (INCLUDING BUT NOT LIMITED TO LOST PROFITS) ARISING OUT 
OF OR RELATED TO THIS SOFTWARE, EVEN IF CA INCORPORATED HAS BEEN 
ADVISED OF, KNOWN, OR SHOULD HAVE KNOWN, THE POSSIBILITY OF SUCH DAMAGES." 

./connect 

for a in `./show alarms| grep <CAUSE_CODE_OF_THE_ALARM> | awk '{ print $5 }'` 
do
     ./create event type=<EVENT_CODE_THAT_CLEARS_THE_ALARM> text=test mh=$a 
done 

./disconnect
------------------------------------------------------------------

 

Once that is complete, you can save file and then run the following command to remove the alarms in OneClick:

cd <SPECROOT>

./<FILENAME>.sh