[one-users] How to monitor oned processes wich shell command?

=?gb2312?B?0e6gRA==?= yang_yi at neusoft.com
Wed Aug 29 08:35:18 PDT 2012


Hi

I want to write a shell script to monitor oned process to check if oned is
running and healthy.

my script only can count the number of process. and it can’t check if it is
really healthy.

could you please give me some ideas? thank you very much.

 

$ ps -fu oneadmin

UID        PID  PPID  C STIME TTY          TIME CMD

oneadmin  5096     1  0 14:46 ?        00:00:46 /opt/nebula/ONE/bin/oned -f

oneadmin  5097     1  0 14:46 ?        00:00:11 /opt/nebula/ONE/bin/mm_sched

oneadmin  5120  5096  0 14:47 ?        00:01:12 ruby
/opt/nebula/ONE/lib/mads/one_vmm_exec.rb -t 15 -r 0 kvm

oneadmin  5131  5096  0 14:47 ?        00:00:33 ruby
/opt/nebula/ONE/lib/mads/one_im_exec.rb -r 0 -t 15 kvm

oneadmin  5141  5096  0 14:47 ?        00:00:24 ruby
/opt/nebula/ONE/lib/mads/one_tm.rb tm_ssh/tm_ssh.conf

oneadmin  5155  5096  0 14:47 ?        00:00:18 ruby
/opt/nebula/ONE/lib/mads/one_hm.rb

oneadmin  5166  5096  0 14:47 ?        00:00:18 ruby
/opt/nebula/ONE/lib/mads/one_image.rb fs -t 15

oneadmin  5176  5096  0 14:47 ?        00:00:18 ruby
/opt/nebula/ONE/lib/mads/one_auth_mad.rb --authn
ssh,x509,ldap,server_cipher,server_x509

 

 

checkrun(){

        _num=`ps -ef|grep 'ONE' |grep -v grep |wc -l`

        if [ $_num -eq 8 ]; then

             RETVAL=0

             return $RETVAL

        elif [ $_num -eq 0 ]; then

             RETVAL=1

             return $RETVAL

        fi

 

Best Regards,

Yang Yi 

 

---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this communication in error,please 
immediately notify the sender by return e-mail, and delete the original message and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20120829/804e85fe/attachment-0001.htm>


More information about the Users mailing list