You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Donald Hansen <do...@hansenfamily.us> on 2015/06/04 00:39:33 UTC

custom services / status

I'm trying to create a custom service in Ambari and curious how it tells
Ambari if the service successfully started or not. I was able to add a
python function that starts my service and my service does start correctly
but Ambari still shows the service as not started.

Thanks.
Donald

Re: custom services / status

Posted by Jaimin Jetly <ja...@hortonworks.com>.
Hi Donald,


There is a status command implementation that needs to be done in the python script for every service component. This is required for service component to return their current status back to ambari-server.

Example status command for Hbase Master: code link?<https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py#L91>


-- Thanks

    Jaimin




________________________________
From: Donald Hansen <do...@hansenfamily.us>
Sent: Wednesday, June 03, 2015 3:39 PM
To: user@ambari.apache.org
Subject: custom services / status

I'm trying to create a custom service in Ambari and curious how it tells Ambari if the service successfully started or not. I was able to add a python function that starts my service and my service does start correctly but Ambari still shows the service as not started.

Thanks.
Donald

Re: custom services / status

Posted by Donald Hansen <do...@hansenfamily.us>.
Thanks for all the help on custom services. I got my POC working great!

On Wed, Jun 3, 2015 at 5:24 PM, Tim To <tt...@phemi.com> wrote:

> Hi Donald,
> If you are setting up a custom service then it depends on what service you
> are setting up and whether that process/app already creates the pid file
> for you. If not, the following shell command after launching a process will
> put the pid in a file of your choosing:
>
> jobs -p | tail -1 > "fully qualified file name containing the pid"
>
> you can then give this filename to the     check_process_status() method
> inside your python service script for ambari to check up on the process.
> All that Ambari will do inside  check_process_status() is do a kill 0 on
> the pid periodically to check if it is running - pretty straightforward.
>
> Hope that helps,
> Tim
>
>
> On Wed, Jun 3, 2015 at 5:08 PM, Donald Hansen <do...@hansenfamily.us>
> wrote:
>
>> Thanks for the quick reply. I was looking at some examples and was curios
>> about the pid file. Do I need to create that myself or is there some code
>> that is creating that for me automatically?
>>
>>
>> On Wednesday, June 3, 2015, Yusaku Sako <yu...@hortonworks.com> wrote:
>>
>>>  Have you implemented the "status" command for the component(s) in your
>>> custom service?
>>> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=38571133
>>> For most components, the status is based on the PID file.
>>> You can look at some examples in the common-services directory:
>>> https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/hbase_regionserver.py#L55-L59
>>>
>>>  Yusaku
>>>
>>>   From: Donald Hansen <do...@hansenfamily.us>
>>> Reply-To: "user@ambari.apache.org" <us...@ambari.apache.org>
>>> Date: Wednesday, June 3, 2015 3:39 PM
>>> To: "user@ambari.apache.org" <us...@ambari.apache.org>
>>> Subject: custom services / status
>>>
>>>   I'm trying to create a custom service in Ambari and curious how it
>>> tells Ambari if the service successfully started or not. I was able to add
>>> a python function that starts my service and my service does start
>>> correctly but Ambari still shows the service as not started.
>>>
>>>  Thanks.
>>> Donald
>>>
>>
>
>
> --
> *Tim To*
> Software Engineer
> *PHEMI Health Systems*
> 180-887 Great Northern Way
> Vancouver, BC V5T 4T5
> website <http://www.phemi.com/> twitter <https://twitter.com/PHEMISystems>
>  Linkedin
> <http://www.linkedin.com/company/3561810?trk=tyah&trkInfo=tarId%3A1403279580554%2Ctas%3Aphemi%20hea%2Cidx%3A1-1-1>
>

Re: custom services / status

Posted by Tim To <tt...@phemi.com>.
Hi Donald,
If you are setting up a custom service then it depends on what service you
are setting up and whether that process/app already creates the pid file
for you. If not, the following shell command after launching a process will
put the pid in a file of your choosing:

jobs -p | tail -1 > "fully qualified file name containing the pid"

you can then give this filename to the     check_process_status() method
inside your python service script for ambari to check up on the process.
All that Ambari will do inside  check_process_status() is do a kill 0 on
the pid periodically to check if it is running - pretty straightforward.

Hope that helps,
Tim


On Wed, Jun 3, 2015 at 5:08 PM, Donald Hansen <do...@hansenfamily.us>
wrote:

> Thanks for the quick reply. I was looking at some examples and was curios
> about the pid file. Do I need to create that myself or is there some code
> that is creating that for me automatically?
>
>
> On Wednesday, June 3, 2015, Yusaku Sako <yu...@hortonworks.com> wrote:
>
>>  Have you implemented the "status" command for the component(s) in your
>> custom service?
>> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=38571133
>> For most components, the status is based on the PID file.
>> You can look at some examples in the common-services directory:
>> https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/hbase_regionserver.py#L55-L59
>>
>>  Yusaku
>>
>>   From: Donald Hansen <do...@hansenfamily.us>
>> Reply-To: "user@ambari.apache.org" <us...@ambari.apache.org>
>> Date: Wednesday, June 3, 2015 3:39 PM
>> To: "user@ambari.apache.org" <us...@ambari.apache.org>
>> Subject: custom services / status
>>
>>   I'm trying to create a custom service in Ambari and curious how it
>> tells Ambari if the service successfully started or not. I was able to add
>> a python function that starts my service and my service does start
>> correctly but Ambari still shows the service as not started.
>>
>>  Thanks.
>> Donald
>>
>


-- 
*Tim To*
Software Engineer
*PHEMI Health Systems*
180-887 Great Northern Way
Vancouver, BC V5T 4T5
website <http://www.phemi.com/> twitter <https://twitter.com/PHEMISystems>
Linkedin
<http://www.linkedin.com/company/3561810?trk=tyah&trkInfo=tarId%3A1403279580554%2Ctas%3Aphemi%20hea%2Cidx%3A1-1-1>

Re: custom services / status

Posted by Sumit Mohanty <sm...@hortonworks.com>.
Its the implementation of start command that should create the pid file - essentially you have to do it yourself in the start script.


You can use the pid file to make the start script idempotent. Its a best practice for stop command to delete the pid file after stopping the component instance.


-Sumit

________________________________
From: Donald Hansen <do...@hansenfamily.us>
Sent: Wednesday, June 03, 2015 5:08 PM
To: user@ambari.apache.org
Subject: Re: custom services / status

Thanks for the quick reply. I was looking at some examples and was curios about the pid file. Do I need to create that myself or is there some code that is creating that for me automatically?


On Wednesday, June 3, 2015, Yusaku Sako <yu...@hortonworks.com>> wrote:
Have you implemented the "status" command for the component(s) in your custom service?  https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=38571133
For most components, the status is based on the PID file.
You can look at some examples in the common-services directory: https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/hbase_regionserver.py#L55-L59

Yusaku

From: Donald Hansen <do...@hansenfamily.us>
Reply-To: "user@ambari.apache.org" <us...@ambari.apache.org>
Date: Wednesday, June 3, 2015 3:39 PM
To: "user@ambari.apache.org" <us...@ambari.apache.org>
Subject: custom services / status

I'm trying to create a custom service in Ambari and curious how it tells Ambari if the service successfully started or not. I was able to add a python function that starts my service and my service does start correctly but Ambari still shows the service as not started.

Thanks.
Donald

Re: custom services / status

Posted by Donald Hansen <do...@hansenfamily.us>.
Thanks for the quick reply. I was looking at some examples and was curios
about the pid file. Do I need to create that myself or is there some code
that is creating that for me automatically?


On Wednesday, June 3, 2015, Yusaku Sako <yu...@hortonworks.com> wrote:

>  Have you implemented the "status" command for the component(s) in your
> custom service?
> https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=38571133
> For most components, the status is based on the PID file.
> You can look at some examples in the common-services directory:
> https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/hbase_regionserver.py#L55-L59
>
>  Yusaku
>
>   From: Donald Hansen <donald@hansenfamily.us
> <javascript:_e(%7B%7D,'cvml','donald@hansenfamily.us');>>
> Reply-To: "user@ambari.apache.org
> <javascript:_e(%7B%7D,'cvml','user@ambari.apache.org');>" <
> user@ambari.apache.org
> <javascript:_e(%7B%7D,'cvml','user@ambari.apache.org');>>
> Date: Wednesday, June 3, 2015 3:39 PM
> To: "user@ambari.apache.org
> <javascript:_e(%7B%7D,'cvml','user@ambari.apache.org');>" <
> user@ambari.apache.org
> <javascript:_e(%7B%7D,'cvml','user@ambari.apache.org');>>
> Subject: custom services / status
>
>   I'm trying to create a custom service in Ambari and curious how it
> tells Ambari if the service successfully started or not. I was able to add
> a python function that starts my service and my service does start
> correctly but Ambari still shows the service as not started.
>
>  Thanks.
> Donald
>

Re: custom services / status

Posted by Yusaku Sako <yu...@hortonworks.com>.
Have you implemented the "status" command for the component(s) in your custom service?  https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=38571133
For most components, the status is based on the PID file.
You can look at some examples in the common-services directory: https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/hbase_regionserver.py#L55-L59

Yusaku

From: Donald Hansen <do...@hansenfamily.us>>
Reply-To: "user@ambari.apache.org<ma...@ambari.apache.org>" <us...@ambari.apache.org>>
Date: Wednesday, June 3, 2015 3:39 PM
To: "user@ambari.apache.org<ma...@ambari.apache.org>" <us...@ambari.apache.org>>
Subject: custom services / status

I'm trying to create a custom service in Ambari and curious how it tells Ambari if the service successfully started or not. I was able to add a python function that starts my service and my service does start correctly but Ambari still shows the service as not started.

Thanks.
Donald