If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Sell Script for OEM Agent Status

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-17-10, 05:21
newdbaxchange newdbaxchange is offline
Registered User
 
Join Date: Jun 2010
Posts: 81
Sell Script for OEM Agent Status

Hello,

does anyone havea shell script to check the status of the OEM Agent running on a solaris 10 box?

Basically, I am rubbish at scripting, but I'd like a procedure which will
do the following:

1) cd into this directory '/u01/app/oracle/product/10.2.0/agent10g/bin
2) perform a command 'emctl status agent'
3) The status will either say Agent is running or not running
4) if the Agent is running - then I would like that in an output file, called
agent_running.log if not running - then an output file called agent_not_running.log

I could schedule this job via cron on a hourly basis

I know it appears quite simple, but like I said I am not too great on shell scripting

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 06-17-10, 06:54
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
Code:
#!/bin/ksh
cd /u01/app/oracle/product/10.2.0/agent10g/bin
./emctl status agent
if [ $? = 0 ]
then
   echo Running >agent_running.log
else
   echo Not running >agent_not_running.log
fi
Your logic is pretty rubbish too though. If the agent is not running, and then is started, both log files will exist, and you won't be able to tell anymore whether the process is running or not.
Reply With Quote
  #3 (permalink)  
Old 06-17-10, 09:25
newdbaxchange newdbaxchange is offline
Registered User
 
Join Date: Jun 2010
Posts: 81
OK Thanks for your help and assistance. I supoose I did ask incorrectly
Reply With Quote
  #4 (permalink)  
Old 06-17-10, 09:33
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool EM will do it...

In Grid control you can set an event to e-mail an alert if any of the agents is down.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On