Linux Shell脚本监控WAS的运行状态
原理:通过调用 WAS 自带的脚本 wsadmin.sh 来获取实例的状态
操作系统版本:
[root]# head -1 /etc/redhat-release Red Hat Enterprise Linux Server release 5.3 (Tikanga) |
WAS 版本:
[root]# /opt/IBM/WebSphere/AppServer/bin/versionInfo.sh | grep -A 3 "Installed Product" Installed Product -------------------------------------------------------------------------------- Name IBM WebSphere Application Server - ND Version 7.0.0.25 |
代码:
check_was_state.sh
#!/bin/ksh WAS_IP="192.168.222.3" WAS_USERNAME="wasadmin" WAS_PASSWORD="wasadmin" WAS_INSTANCE_NAME="SampleServer1" WSADMIN="/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh" FILE_STAT_LOG=was_stat_`date +"%Y%m%d_%H%M%S"`.log $WSADMIN -lang jython -host $WAS_IP -user $WAS_USERNAME -password $WAS_PASSWORD -f check_was_state.py > $FILE_STAT_LOG 2>&1 grep "${WAS_INSTANCE_NAME}: STARTED" $FILE_STAT_LOG > /dev/null 2>&1 if [ $? == 0 ]; then echo "$WAS_IP $WAS_INSTANCE_NAME status is OK" else echo "$WAS_IP $WAS_INSTANCE_NAME status is not OK" fi
check_was_state.py
相关推荐
libao 2020-09-16
xiaonamylove 2020-08-16
yoshubom 2020-07-18
Zaratustra 2020-07-18
赵家小少爷 2020-07-18
firefaith 2020-06-14
CARBON 2020-06-14
CARBON 2020-06-08
流年浅滩 2020-05-26
CARBON 2020-05-18
CARBON 2020-04-21
xiaobater 2020-04-29
gcong 2020-04-10
酷云的csdn 2020-03-25
onetozero 2020-03-08
SciRui 2020-02-21
higheels 2020-02-13