To check the OEM Status, we can check the background process EM and OMS. Also for more details, we can go the OMS_Home and check the process state by
./emctl status OMS./emctl status agent
So, we will now create a script to check for the background process. In this script, we will count the process matching 'EM' and 'OMS' and if the process is not equal to zero
#!/bin/bash
exportOMS_HOME=/oracle/em/agent/agent_13.3.0.0.0
$OMS_HOME/bin/emctl status agent >/tmp/check_oms.txt
check_stat='ps -ef | grep oms | grep em | wc -l';
oracle_num='expr $check_stat'if["$oracle_num"=0]
then
mailx -s "OMS is down!"-a </tmp/check_oms.txt xxx@xxx.com
else
mailx -s "OMS is up and running"-a </tmp/check_oms.txt xxx@xxx.com
exit
fi
EOF
To check the OEM Status, we can check the background process EM and OMS. Also for more details, we can go the OMS_Home and check the process state by
./emctl status OMS ./emctl status agent
So, we will now create a script to check for the background process. In this script, we will count the process matching 'EM' and 'OMS' and if the process is not equal to zero
#!/bin/bash export OMS_HOME= /oracle/em/agent/agent_13.3.0.0.0 $OMS_HOME/bin/emctl status agent > /tmp/check_oms.txt check_stat='ps -ef | grep oms | grep em | wc -l'; oracle_num='expr $check_stat' if [ "$oracle_num" = 0 ] then mailx -s "OMS is down!" -a < /tmp/check_oms.txt xxx@xxx.com else mailx -s "OMS is up and running" -a < /tmp/check_oms.txt xxx@xxx.com exit fi EOF