Skip to content

Commit 2df2425

Browse files
committed
Add config_dc_linux0aix.sh and update README
1 parent 1af2cf2 commit 2df2425

File tree

2 files changed

+110
-3
lines changed

2 files changed

+110
-3
lines changed

README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
# Scripts that automate ITM installation and configuration
1+
# Scripts that automate ITM installation and configuration, work on both linux and AIX platform
22

3-
1. config_or_linux0aix.sh - discover oracle instance automatically, and then automatically configure ITCAM for oracle.
3+
Those scripts are proved to be able to greately prove productivity in my cooperation, and greately reduced work load.
4+
5+
1. config_or_linux0aix.sh - discover oracle instance automatically, and then automatically configure ITCAM for oracle.
46

57
It has below features:
68
1) One script to do all: it will detect oracle databse instance name, and config them automatically without any interaction, as long as those instances has same monitor user and canonical TNS definition (which is true in a DC)
79
2) Able to detect already configured instances, and avoid duplicated config.
810
3) Able to detect oracle dataguard, and will skip it.
911

10-
The script is proved to be able to greately prove productivity in my cooperation, and greately reduced work load.
12+
1113

1214
Usage:
1315
1) Automaticlly find all oracle database instances, and config ITM Agent to monitor them, with TNS=tivoli_INSTANCENAME, User=tivoli, Pass=XXXX
@@ -19,4 +21,13 @@ Usage:
1921
User: optional. User that ITM Agent will use to connect to oracle instaces to be monitored. if not specified, use hard-coded username.
2022
Pass: Password for User, optional
2123
Instance1: Instances to be configured and monitored
24+
25+
2. config_dc_linux0aix - discover IBM WAS (Websphere Application Server) servers and configure ITM data collector automatically.
26+
27+
Usage:
28+
./config_dc_linux0aix.sh -u AdminUser -p AdminPass -n SoapPort Server1 Server2
2229

30+
AdminUser: optional, the WAS dmgr admin user name
31+
AdminPass: optional, password for AdminUser
32+
SoapPort: optional, WAS SOAP port, if ommited, will discover from server.xml
33+
Server1, Server2: optional, server list, if ommited, will discover from WAS configuration home.

config_dc_linux0aix.sh

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
homeDir=`dirname $0`
2+
######## 0) Pre-condition : node agent needs Running ##############
3+
refargs=`ps -ef|grep java|grep nodeagent|grep -v "grep"`
4+
5+
####### 1) Determine ProfileHome, etc, ###########################
6+
ProfileHome=`echo $refargs|awk '{print $(NF-3)}'|sed 's_/config__'`
7+
CellName=`echo $refargs|awk '{print $(NF-2)}'`
8+
NodeName=`echo $refargs|awk '{print $(NF-1)}'`
9+
WasHome=`echo $ProfileHome|sed 's_/profiles/.*__'`
10+
ProfileName=`echo $ProfileHome|awk -F'/' '{print $NF}'`
11+
12+
####### 2) Fix out DM IP ################################
13+
DmgrName=`echo $CellName|sed 's/Cell[0-9]*$//'`
14+
DmgrIP=`cat /etc/hosts|grep "$DmgrName"|grep -v "^#"|head -1|awk '{print $1}'`
15+
16+
17+
####### 3) Try to fix out SOAP Port ###################
18+
XmlFile=`find $ProfileHome/config -name "serverindex.xml"|grep $CellName|grep -v $NodeName|grep Manager`
19+
tmpno=`cat $XmlFile | grep -n SOAP_CONNECTOR_ADDRESS | awk -F: '{print $1}'`;
20+
tmpno=`expr $tmpno + 1`
21+
SoapPort=`cat $XmlFile|sed -n ${tmpno}p| sed 's/.*port="\(.*\)".*/\1/'`
22+
23+
###### 4) DM admin Username and Password ###############
24+
AdminUser=wasadm;
25+
AdminPass=****;
26+
27+
while getopts "u:p:n:" opt; do
28+
case $opt in
29+
u) AdminUser=$OPTARG;;
30+
p) AdminPass=$OPTARG;;
31+
n) SoapPort=$OPTARG;;
32+
?) echo "Parameter Error!"
33+
exit 1;;
34+
esac
35+
done
36+
37+
shift $(($OPTIND - 1))
38+
39+
######## 5) What Servers to Config #####################
40+
if [ -z "$*" ]; then
41+
servers=`ls $ProfileHome/config/cells/$CellName/nodes/$NodeName/servers|grep -v "nodeagent"`
42+
else
43+
servers="$*";
44+
fi
45+
46+
ServersConfigured=""
47+
for i in `echo $servers`; do
48+
grep "TIVOLI" $ProfileHome/config/cells/$CellName/nodes/$NodeName/servers/$i/server.xml>/dev/null 2>&1
49+
if [ $? -eq 0 ]; then
50+
ServersConfigured="$ServersConfigured $i"
51+
fi
52+
done
53+
if [ -n "$ServersConfigured" ]; then
54+
echo "You choose to configure ["$servers"], But we found that ["$ServersConfigured"] are already configured"
55+
echo "Are you sure to continue? (yes/no)"
56+
read reply
57+
if [ "$reply" = "no" ]; then
58+
echo "exiting...";exit;
59+
fi
60+
fi
61+
62+
ServerName=`echo $servers | sed -e "s/^/$NodeName/" -e "s/ /,$NodeName/g"`
63+
ServerPath=`echo $servers | sed -e "s#^#cells/$CellName/nodes/$NodeName/servers/#" -e "s_ _,cells/$CellName/nodes/$NodeName/servers/_g"`
64+
65+
######## 6) Generate response file #####################
66+
cat ${homeDir}/template/config_dc_template.txt |
67+
sed -e "s%#ProfileHome#%$ProfileHome%" \
68+
-e "s%#DmgrIP#%$DmgrIP%" \
69+
-e "s%#AdminUser#%$AdminUser%" \
70+
-e "s%#AdminPass#%$AdminPass%" \
71+
-e "s%#SoapPort#%$SoapPort%" \
72+
-e "s%#ServerName#%$ServerName%" \
73+
-e "s%#ProfileName#%$ProfileName%" \
74+
-e "s%#WasHome#%$WasHome%" \
75+
-e "s%#ServerPath#%$ServerPath%" >${homeDir}/response/config_dc.txt
76+
77+
####### 7) Start to Config #############################
78+
OSUser=`echo $refargs|awk '{print $1}'`
79+
id | grep $OSUser >/dev/null 2>&1
80+
if [ $? -ne 0 ]; then
81+
echo "User not correct"
82+
exit -1
83+
fi
84+
/TIVOLI/IBM/ITM/bin/itmcmd config -A -p ${homeDir}/response/config_dc.txt yn
85+
86+
87+
####### 8) Check if the configuring process correct! ###########
88+
for i in `echo $servers`; do
89+
grep "TIVOLI" $ProfileHome/config/cells/$CellName/nodes/$NodeName/servers/$i/server.xml>/dev/null 2>&1
90+
if [ $? -eq 0 ]
91+
then
92+
echo DC config for server $i Success
93+
else
94+
echo DC config for server $i Failed
95+
fi
96+
done

0 commit comments

Comments
 (0)