You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Vitaly Brodetskyi (JIRA)" <ji...@apache.org> on 2013/09/09 14:50:52 UTC

[jira] [Commented] (AMBARI-3145) ambari-agent service script should return non-zero when the agent is not running

    [ https://issues.apache.org/jira/browse/AMBARI-3145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13761808#comment-13761808 ] 

Vitaly Brodetskyi commented on AMBARI-3145:
-------------------------------------------

Patch attached.
                
> ambari-agent service script should return non-zero when the agent is not running
> --------------------------------------------------------------------------------
>
>                 Key: AMBARI-3145
>                 URL: https://issues.apache.org/jira/browse/AMBARI-3145
>             Project: Ambari
>          Issue Type: Bug
>          Components: agent
>    Affects Versions: 1.2.5
>            Reporter: Vitaly Brodetskyi
>            Assignee: Vitaly Brodetskyi
>             Fix For: 1.4.1
>
>         Attachments: AMBARI-3145.patch
>
>
> The ambari-agent service script should return non-zero when the agent is not running. For example, if a customer wants to have puppet ensure the service is always running, it will not start a killed service because it thinks it's already running when it returns 0.
> [root@host-123-123-123 init.d]# service ambari-agent status
> ambari-agent currently not running
> Usage: /usr/sbin/ambari-agent {start|stop|restart|status}
> [root@host-123-123-123 init.d]# echo $?
> 0
> For comparison...
> [root@host-123-123-123 init.d]# service winbind status
> winbindd is stopped
> [root@host-123-123-123 init.d]# echo $?
> 3
> Possible fix:
> AMBARI_AGENT_PID_PATH="/var/run/ambari-agent/ambari-agent.pid";
> RES="3";
> if [ -f $AMBARI_AGENT_PID_PATH ]
> then
>   RES=`cat $AMBARI_AGENT_PID_PATH | xargs ps -f -p | wc -l`;
>   AMBARI_AGENT_PID=`cat $AMBARI_AGENT_PID_PATH`;
> else
>   RES=-1;
> fi
> if [ $RES -eq "2" ]
> then
>   echo "OK: Ambari agent is running [PID:$AMBARI_AGENT_PID]";
>   exit 0;
> else
>   echo "CRITICAL: Ambari agent is not running [$AMBARI_AGENT_PID_PATH not found]";
>   exit 2;
> fi

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira