System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

mon_EMSHAProvider_state.sh cron job failing with rc=1

 
SOLVED
Go to solution
Highlighted
Frequent Advisor

mon_EMSHAProvider_state.sh cron job failing with rc=1

Hi,

I've seen that there's a cron job that runs the script /etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh everytime. As far as I know this script checks if EMS is running and starts it just in case its down.
The issue is that I receive alerts everyday about this cronjob failing (its fails once a day) and if I check the cron log i get the following excerpt:

> CMD: sleep 15;/etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh
> root 22927 c Mon Aug 16 01:05:00 METDST 2010
< root 22926 c Mon Aug 16 01:05:00 METDST 2010
< root 22925 c Mon Aug 16 01:05:00 METDST 2010 rc=1
< root 22927 c Mon Aug 16 01:05:15 METDST 2010


How can I troubleshoot the reason of this (everyday) failed cronjob?

Regards.
7 REPLIES 7
Highlighted
Honored Contributor
Solution

Re: mon_EMSHAProvider_state.sh cron job failing with rc=1

Hi:


Put output from next command:

# sh -x /etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh

rgs,
Highlighted
Honored Contributor

Re: mon_EMSHAProvider_state.sh cron job failing with rc=1

Hi (again):

#############################################################
# Check if cimserver is running
#############################################################
is_cimserver_running()
{
message=$( /usr/bin/ps -e | /usr/bin/grep cimserver | /usr/bin/grep -v cimserverd | /usr/bin/grep -v cimservera 2>&1 )
if [ $? -ne 0 ]
then
return 1
fi
return 0
}

NOTE: If cimserver is not running, the script exit with condition 1.

Verify /var/adm/cron/log file

rgs,
Highlighted
Frequent Advisor

Re: mon_EMSHAProvider_state.sh cron job failing with rc=1

+ CIMPROVIDER=/opt/wbem/bin/cimprovider
+ PROVIDER_MODULE=EMSHAProviderModule
+ + /opt/wbem/bin/cimprovider -ls
+ awk { print $2}
+ grep EMSHAProviderModule
STATUS=OK
+ [ OK = Degraded ]


cat /etc/opt/resmon/lbin/mon_EMSHAProvider_state.sh (08-16 14:01)
#!/sbin/sh
#
#-------------------------------------------------------
# If ProviderModule state is "Degraded" then
# disable/re-enable it
#-------------------------------------------------------

CIMPROVIDER=/opt/wbem/bin/cimprovider
PROVIDER_MODULE=EMSHAProviderModule

STATUS=`$CIMPROVIDER -ls | grep $PROVIDER_MODULE | awk '{ print $2}' `
if [ "$STATUS" = "Degraded" ]
then
# Disable Provider Module
$CIMPROVIDER -d -m $PROVIDER_MODULE

# Enable Provider Module
$CIMPROVIDER -e -m $PROVIDER_MODULE
fi

#---------------------------------------------------------------------


Ok, this script fails with rc=1 if cimserver is not running at any time. How can I check while cimserver was not running at that moment???
Highlighted
Honored Contributor

Re: mon_EMSHAProvider_state.sh cron job failing with rc=1

Hi:

The script only check if the ProviderModule state is "Degraded" then disable and enable it.

The CIM Server must be started using the cimserver command. If the system is rebooted, the CIM Server will automatically
restart, with the exception of the case where the CIM Server was shutdown prior to the reboot.

- Verify than cimserver is running:

# cimserver -l -s

- If cimserver is not running then start with:

# cimserver


man cimserver
man cimserverd

rgs,

Highlighted
Frequent Advisor

Re: mon_EMSHAProvider_state.sh cron job failing with rc=1

But when the cron job fails with rc=1.. what means? Does it mean that the ProviderModule is degraded or any other error in the execution of the script?
Highlighted
Honored Contributor

Re: mon_EMSHAProvider_state.sh cron job failing with rc=1

Hi:

Cron is telling you the return code (rc) of the last command. In your case the last command returned a value of one (1).


Posible cause:

cimserver daemon proccess is not running.

Restart cimserver

# cimserver -s
# cimserver
# cimserver -l -s



rgs
Highlighted
Frequent Advisor

Re: mon_EMSHAProvider_state.sh cron job failing with rc=1

Ok, thanks!