Deleting alerts from the command line
Deleting alerts from the command line
Hi Guys,
Rather than use the CCM, Tools, Remove Old Alerts
I would like to know what underlying script is ececuted by this option, so that I can set-up a job to perform this task regularly.
I'm guessing that once the alerts have been deleted, GAS will still need to be bounced/refreshed?!?
Any ideas?
thanks
Deano
Rather than use the CCM, Tools, Remove Old Alerts
I would like to know what underlying script is ececuted by this option, so that I can set-up a job to perform this task regularly.
I'm guessing that once the alerts have been deleted, GAS will still need to be bounced/refreshed?!?
Any ideas?
thanks
Deano
Hi,
the <erase_alerts> EM utility invoked in command line will erase Alerts, regardless of their current Status, up until the ending date and hour as specified
Erase Alerts Usage
This utility deletes all alerts posted prior to the specific hour and date from the CONTROLM/EM database.
Use one of the two options:
1. erase_alerts -U <user> -P <password> [-D <date> ] [-H <hour> ] [-F]
where
date : YYYYMMDD or YYMMDD format
hour : 0 - 23
Note: If date or hour are missing, then the current date/hour will be used.
-F: Forces the deletion without confirmation.
2. erase_alerts -I
A prompts is displayed requesting the date, hour and password.
You can schedule a job to execute this:
- Step 1 Erase old alerts
erase_alerts -U <user> -P <password> [-D <date> ] [-H <hour> ] [-F]
- Step 2 Refresh the GAS
ecs ctl -U emuser -P <Password> -C GAS -all -cmdstr "REFRESH"
- Step 3 Check the GAS
ecs ctl -U emuser -P <Password> -C GAS -all -cmd life_check
the <erase_alerts> EM utility invoked in command line will erase Alerts, regardless of their current Status, up until the ending date and hour as specified
Erase Alerts Usage
This utility deletes all alerts posted prior to the specific hour and date from the CONTROLM/EM database.
Use one of the two options:
1. erase_alerts -U <user> -P <password> [-D <date> ] [-H <hour> ] [-F]
where
date : YYYYMMDD or YYMMDD format
hour : 0 - 23
Note: If date or hour are missing, then the current date/hour will be used.
-F: Forces the deletion without confirmation.
2. erase_alerts -I
A prompts is displayed requesting the date, hour and password.
You can schedule a job to execute this:
- Step 1 Erase old alerts
erase_alerts -U <user> -P <password> [-D <date> ] [-H <hour> ] [-F]
- Step 2 Refresh the GAS
ecs ctl -U emuser -P <Password> -C GAS -all -cmdstr "REFRESH"
- Step 3 Check the GAS
ecs ctl -U emuser -P <Password> -C GAS -all -cmd life_check
Best regards
Walty
Walty
Hi,
the <erase_aletrs> utility exist on Unix platform an is located on:
$HOME/scripts directory of <emuser>
Other solution is to execute this delete directly in your Control-M/EM DB by SQL query. The name of this table in Control-M/EM DB is <ALARM>
Don't forget to refresh the GAS after.
the <erase_aletrs> utility exist on Unix platform an is located on:
$HOME/scripts directory of <emuser>
Other solution is to execute this delete directly in your Control-M/EM DB by SQL query. The name of this table in Control-M/EM DB is <ALARM>
Don't forget to refresh the GAS after.
Best regards
Walty
Walty
- philmalmaison
- Nouveau
- Posts: 1148
- Joined: 08 Jun 2007 12:00
- Location: Ile de France
here is my solution :
erase_alerts -U ${user} -P ${pass} -D ${prior} -F
sleep 5
ecs ctl -U ${user} -P ${pass} -C GAS -M `uname -n` -name `GAS_name` -cmdstr "REFRESH"
in the following script
#!/bin/ksh
user=`cat ~/scripts/.psfile | awk '{print $1}'`
pass=`cat ~/scripts/.psfile | awk '{print $2}'`
prior=${1}
#
usage () {
echo
echo "usage : `basename $0` <date>"
echo "date = delete alerts prior to the date"
echo
exit 999
}
#
GAS_name () {
SQL -U${user} -P${pass} -b <<EOF>> ${gasname}
}
verif_config () {
orbix_state=`orbadmin ns status | awk '{print $4}'`
case "${orbix_state}" in
"Running")
echo "Noeud actif poursuite du traitement ..."
continue
;;
*)
echo "Noeud passif arret du traitement"
exit 0
;;
esac
}
#
# Main
#
if [ $# -ne 1 ]
then
usage ;
fi
verif_config;
erase_alerts -U ${user} -P ${pass} -D ${prior} -F
sleep 5
ecs ctl -U ${user} -P ${pass} -C GAS -M `uname -n` -name `GAS_name` -cmdstr "REFRESH"
regards
philmalmaison
erase_alerts -U ${user} -P ${pass} -D ${prior} -F
sleep 5
ecs ctl -U ${user} -P ${pass} -C GAS -M `uname -n` -name `GAS_name` -cmdstr "REFRESH"
in the following script
#!/bin/ksh
user=`cat ~/scripts/.psfile | awk '{print $1}'`
pass=`cat ~/scripts/.psfile | awk '{print $2}'`
prior=${1}
#
usage () {
echo
echo "usage : `basename $0` <date>"
echo "date = delete alerts prior to the date"
echo
exit 999
}
#
GAS_name () {
SQL -U${user} -P${pass} -b <<EOF>> ${gasname}
}
verif_config () {
orbix_state=`orbadmin ns status | awk '{print $4}'`
case "${orbix_state}" in
"Running")
echo "Noeud actif poursuite du traitement ..."
continue
;;
*)
echo "Noeud passif arret du traitement"
exit 0
;;
esac
}
#
# Main
#
if [ $# -ne 1 ]
then
usage ;
fi
verif_config;
erase_alerts -U ${user} -P ${pass} -D ${prior} -F
sleep 5
ecs ctl -U ${user} -P ${pass} -C GAS -M `uname -n` -name `GAS_name` -cmdstr "REFRESH"
regards
philmalmaison
- philmalmaison
- Nouveau
- Posts: 1148
- Joined: 08 Jun 2007 12:00
- Location: Ile de France
- philmalmaison
- Nouveau
- Posts: 1148
- Joined: 08 Jun 2007 12:00
- Location: Ile de France
- philmalmaison
- Nouveau
- Posts: 1148
- Joined: 08 Jun 2007 12:00
- Location: Ile de France
Hi,
This script does not exist in Windows.
In the Windows environment i implemented one script like this (it works directly with the ALARM table in Control-M/EM db)
SET ServerInst=<MSSQL instance>
SET User=<emuser>
SET Pswd=<password>
SET MyServer=<your serveur>
SET MyDate=%1 (pass by AUTOEDIT variables)
ECHO Number of Alerts before delete
ECHO -------------------------------------
OSQL -U %User% -P %Pswd% -S %ServerInst% -h-1 -Q "select count(*) from ALARM"
ECHO .
ECHO Delete Alerts before date %1
ECHO ---------------------------------------------
OSQL -U %User% -P %Pswd% -S %ServerInst% -h-1 -Q " delete from ALARM where HOST_TIME < convert(datetime,'%MyDate%')"
ECHO .
ECHO Number of Alerts after delete
ECHO ----------------------------------
OSQL -U %User% -P %Pswd% -S %ServerInst% -h-1 -Q "select count(*) from ALARM"
ECHO .
ECHO Refresh GAS
ECHO ---------------
ctl -U %User% -P %Pswd% -M %MyServer% -C GAS -cmdstr "refresh"
ECHO .
_sleep 3
ECHO Check GAS
ECHO --------------
ctl -U %User% -P %Pswd% -M %MyServer% -C GAS -cmd life_check
Example of sysout:
Number of Alerts before delete
--------------------------------------
476
(1 row affected)
.
Delete Alerts before date 2009-09-11
-------------------------------------------
(46 rows affected)
.
Number of Alerts after delete
----------------------------------
430
(1 row affected)
.
Refresh GAS
---------------
The command string: "refresh"
have been sent to: GAS on testctlm, the Response is:
true
.
Check GAS
--------------
GAS on testctlm is alive!
This script does not exist in Windows.
In the Windows environment i implemented one script like this (it works directly with the ALARM table in Control-M/EM db)
SET ServerInst=<MSSQL instance>
SET User=<emuser>
SET Pswd=<password>
SET MyServer=<your serveur>
SET MyDate=%1 (pass by AUTOEDIT variables)
ECHO Number of Alerts before delete
ECHO -------------------------------------
OSQL -U %User% -P %Pswd% -S %ServerInst% -h-1 -Q "select count(*) from ALARM"
ECHO .
ECHO Delete Alerts before date %1
ECHO ---------------------------------------------
OSQL -U %User% -P %Pswd% -S %ServerInst% -h-1 -Q " delete from ALARM where HOST_TIME < convert(datetime,'%MyDate%')"
ECHO .
ECHO Number of Alerts after delete
ECHO ----------------------------------
OSQL -U %User% -P %Pswd% -S %ServerInst% -h-1 -Q "select count(*) from ALARM"
ECHO .
ECHO Refresh GAS
ECHO ---------------
ctl -U %User% -P %Pswd% -M %MyServer% -C GAS -cmdstr "refresh"
ECHO .
_sleep 3
ECHO Check GAS
ECHO --------------
ctl -U %User% -P %Pswd% -M %MyServer% -C GAS -cmd life_check
Example of sysout:
Number of Alerts before delete
--------------------------------------
476
(1 row affected)
.
Delete Alerts before date 2009-09-11
-------------------------------------------
(46 rows affected)
.
Number of Alerts after delete
----------------------------------
430
(1 row affected)
.
Refresh GAS
---------------
The command string: "refresh"
have been sent to: GAS on testctlm, the Response is:
true
.
Check GAS
--------------
GAS on testctlm is alive!
Best regards
Walty
Walty