Thursday, July 29, 2004

Manually check status of Oracle HTTP Server (OHS)

Summary
The commands below use a combination of Oracle Application Server and Unix operating system commands to confirm that OHS is running.
The commands assume that the Oracle environment is set.

Details
1. Use DCMCTL to find out if OHS is up or not. Should return 'Up' if running and 'Down' if not.
    
dcmctl getstate -ct ohs | grep HTTP_Server | awk '{print $4}'

2. Use OPMNCTL to find out if OHS is up or not. Should return 'Alive' if running and 'Down' if not.
    
opmnctl status | grep HTTP_Server | awk '{print $7}'

3. Use DMSTOOL to determine whether OHS is alive or not. Should return 'Alive' if running and nothing if not.
    
dmstool -count 1 `dmstool -list | grep HTTP_Server | grep status.value` | tail -1 | cut -f2 -d' ' | awk '{print $2}'

4. Check for the PID and count the number of processes. Should return number of processes if running and 0 if not.

ps -e -o pid,ppid,comm | grep `cat $ORACLE_HOME/Apache/Apache/logs/httpd.pid 2 > /dev/null` 2 > /dev/null | grep httpd | grep -v grep | wc -l

5. Check if the port is listening. Should return 'LISTEN' if listening and nothing if not.
       
netstat -an | grep "`cat $ORACLE_HOME/Apache/Apache/conf/httpd.conf | grep Listen | grep -v "#" | head -1 | awk '{print $2}'` " | grep LISTEN | awk '{print $6}'

Applicable Versions
Oracle Application Server 10g (9.0.4)

No comments: