Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit ccd195d

Browse files
committed
list_actions.sh: print jar-file name and MM name
1 parent 5a638b9 commit ccd195d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ The script `dependency_mm.sh` checks all Management Modules in your APM installa
135135

136136
## Export All Actions
137137

138-
The script `list_actions.sh` checks all Management Modules in your APM installation for actions and generates a csv file that contains the Management Module, Alert Name, Caution Action List and Danger Action List.
138+
The script `list_actions.sh` checks all Management Modules in your APM installation for actions and generates a csv file that contains the Management Module jar-file name and Name, Alert Name, Caution Action List and Danger Action List.
139139

140140
1. Set `EM_PATH` in `environment.properties` to point to your APM installation
141-
2. Run `./dependency_mm.sh`.
141+
2. Run `./list_actions.sh`.
142142
3. The script will print what it is doing:
143143
1. check all Management Modules in `EM_PATH`
144144
2. write all actions in alerts to `alert_actions.csv`.

list_actions.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ else
1010
FILES="${EM_PATH}/config/modules/*.jar ${EM_PATH}/config/modules/*/*.jar"
1111
fi
1212

13-
echo "Management Module, Alert Name, Caution Action List, Danger Action List" > alert_actions.csv
13+
echo "Management Module jar,Management Module Name,Alert Name,Caution Action List,Danger Action List" > alert_actions.csv
1414

1515
for i in $FILES
1616
do
1717

1818
cp $i .
19-
jar xvf $i ManagementModule.xml
19+
jar xvf $i ManagementModule.xml > /dev/null
2020

2121
mm=`echo *.jar`
22-
echo "Analyzing $mm ..."
22+
# get MM name
23+
mm_name=`echo 'cat /ManagementModule/Name' | xmllint --shell ManagementModule.xml | tr '\n' ' ' | sed -E 's/.+\<Name\>(.+)\<\/Name\>.+/\1/' | sed -E 's#/#\\\\/#g'`
24+
25+
echo "Analyzing $mm_name ($mm) ..."
2326

2427
# line 1: xml formatting of all AlertBase elements in ManagementModule.xml
2528
# line 2: compress to one alert per line: remove all newlines with space and '-------' with newline
@@ -33,9 +36,9 @@ echo "Analyzing $mm ..."
3336
echo 'cat /ManagementModule/DataGroups/DataGroup/AlertBase' | xmllint --shell ManagementModule.xml| \
3437
tr '\n' ' ' | sed 's/\-\-\-\-\-\-\-/\n/g' | \
3538
grep ActionID | \
36-
sed -E "s/^.+\<Name\>(.+)\<\/Name\>.+\<CautionActionList\>(.+)\<\/CautionActionList\>.+\<DangerActionList\>(.+)\<\/DangerActionList\>.+/$mm, \1, \2, \3/g" | \
37-
sed -E "s/^.+\<Name\>(.+)\<\/Name\>.+\<DangerActionList\>(.+)\<\/DangerActionList\>.+/$mm, \1,,\2/g" | \
38-
sed -E "s/^.+\<Name\>(.+)\<\/Name\>.+\<CautionActionList\>(.+)\<\/CautionActionList\>.+/$mm, \1,\2,/g" | \
39+
sed -E "s/^.+\<Name\>(.+)\<\/Name\>.+\<CautionActionList\>(.+)\<\/CautionActionList\>.+\<DangerActionList\>(.+)\<\/DangerActionList\>.+/$mm,$mm_name,\1,\2,\3/g" | \
40+
sed -E "s/^.+\<Name\>(.+)\<\/Name\>.+\<DangerActionList\>(.+)\<\/DangerActionList\>.+/$mm,$mm_name,\1,,\2/g" | \
41+
sed -E "s/^.+\<Name\>(.+)\<\/Name\>.+\<CautionActionList\>(.+)\<\/CautionActionList\>.+/$mm,$mm_name,\1,\2,/g" | \
3942
sed -E 's/\<ActionID\>[[:space:]]*\<ManagementModuleName\>([^\<]+)\<\/ManagementModuleName\>[[:space:]]*\<ConstructName\>([^\<]+)\<\/ConstructName\>[[:space:]]*\<\/ActionID\>/ \1\/\2/g' | \
4043
sed -E 's/[[:space:]]+/ /g' \
4144
>> alert_actions.csv

0 commit comments

Comments
 (0)