Clear alarms from command line

book

Article ID: 36474

calendar_today

Updated On:

Products

CA Workload Automation AE - Business Agents (AutoSys) CA Workload Automation AE - Scheduler (AutoSys) CA Workload Automation Agent

Issue/Introduction

Summary: 

Is there a way to clear  Autosys alarms with a command line utility?

If not, can alarms be cleared by directly updating the appropriate record in the alarm table?

Instructions: 

By default, the archive_events command deletes any alarm from the ujo_alarm table that is associated with an event in table ujo_proc_event


archive_events is executed from the $AUTOSYS/bin/DBMaint script. 

In this script, look into this piece of code: 

# Archive the Events 
archive_events -A -n 7 -b 50000 >> $outfile 2>&1 
ecode=`expr $? + $ecode` 

Where: 

?n num_days 
(Optional) Deletes records older than the num_days value from the ujo_proc_event and ujo_event2 tables. The num_days value indicates the number of days to leave events and their associated alarms in the database. When a row in the table exceeds this value, the product deletes it. 

Therefore you have to look into the -n option. If it is set to high value you could decrease it to 7 or 3 days. 

Otherwise you can run an sql command to delete alarms based on a time stamp: 

First of all you have to get the Autosys internal time with the time0 utility 

For example if you would like to delete alarms older than Jan 16th 2016, the command is

time0 -T "01/16/2016 00:00" 

CAUAJM_I_50099 Autotime(internal): 1452920400 

Now you can use this epoch time to plug into your SQL delete statements: 

 

With Autosys 11.0

delete from mdbadmin.ujo_alarm where alarm_time < 1452920400; 
commit; 

With Autosys 11.3.x

 delete from aedbadmin.ujo_alarm where alarm_time < 1452920400; 

  commit; 

Note:  You
 can run a “ select count(*) from mdbadmin.ujo_alarm; “ before and after this sql delete statement 


If you prefer to delete all of them, regardless their date, you can adjust the previous sql command for your current day or truncate the alarm table 

Environment

Release: ATSYHA99000-11.3.6-Workload Automation AE-High Availability Option
Component: