Solved

How do I check the downtime of a process in sun solaris?

Posted on 2007-11-17
5
701 Views
Last Modified: 2013-12-27
Greetings experts,

I have a sun solaris server (version 9) and I want to check the downtime of a process. For example if my oracle process (pmon) goes down during the night , I can come in the next morning and check the time duration during which the process was down.

Please help.

Thanks and regards,
casemanager
0
Comment
Question by:casemanager
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:omarfarid
Comment Utility
Hi,

You may look in to the Oracle logs to see when the process stopped (last log).

You may also look in to the system logs like

/var/log/syslog
/var/adm/messages

0
 
LVL 1

Author Comment

by:casemanager
Comment Utility
Thanks for replying Omar. I got the information I was looking for in the logs generated in /var/adm/messages. Is there any way in which I can automate this process and get to know this information without checking the logs. What I am trying to say is -Oracle process goes down every night for about 3 hours. Is there any way in which the server can send me a report via email with the information as  to when the process was unavaliable and the time when it was back up.

I am thinking that this requires modification of the syslog parameters --all I want to know is how to do it??

Thanks.
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 125 total points
Comment Utility
Hi,

Well,

You may have a crontab job that run say every 5 min. The job (e.g. script) can check for the process (in the server's running processes or logs), and if found not running may send you email.

e.g. you may create script called monitormypmon (here I will assume that the process just die and not running), and contains

count=`/usr/bin/ps -ef | /usr/bin/grep -v grep | /usr/bin/grep pmon | wc -l`
if test $count -gt 0
then
      /usr/bin/date >> /path/to/pmon.log
      echo "running ...." >> /path/to/pmon.log
else
     /usr/bin/mail -s "pmon not running" username < /dev/null
fi

Make this script executable:

chmod +x monitormypmon

To create crontab job, run:

crontab -l > mycrontab

edit mycrontab (e.g. vi mycrontab) and add line similar to:

0,10,20,30,40,50 * * * * /path/to/monitormypmon


The above schedule will run the script every 10 min (for more info please use man crontab)

run:

crontab mycrontab
crontab -l
0
 
LVL 1

Author Comment

by:casemanager
Comment Utility
Thanks...I tried the solution and is seems to fulfill the purpose for now..
0
 
LVL 1

Author Closing Comment

by:casemanager
Comment Utility
Thanks Omarfarid for the excellent answer
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now