You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Zhang Ruiqiang <zh...@163.com> on 2016/02/22 15:27:29 UTC

How to add a host level action?

Hi all:
     I want to add a host level action, is there any document that I can follow?


Thanks!

Re: Re: How to add a host level action?

Posted by Mithun Mathew <mi...@gmail.com>.
Hi Zhang

As far as I know there is no documentation for host level actions.

At present Ambari supports the actions you mentioned (Start, Stop and
Restart components) from the hosts page. You can also select multiple hosts
that you would like to perform the bulk operation on.

If you'd like to take a look at the source code, you may start from here:
https://github.com/apache/ambari/blob/trunk/ambari-web/app/controllers/main/host/bulk_operations_controller.js

Refer screenshots below.

Regards
Matt

[image: Inline image 1]
[image: Inline image 2]



On Mon, Feb 22, 2016 at 7:55 PM, Zhang Ruiqiang <zh...@163.com> wrote:

> Hi Matt:
>     Thanks for your reply!
>     But it seems that your description is a "sevice level action". I want
> to add a "host level action" likes "Start/Stop/Restart All Components" on
> the Hosts page.
>     In fact, I want to add a "Shutdown" action, so that I can  shutdown a
> host on the ambari web page.
>
> Thanks!
>
>
>
> At 2016-02-23 01:47:45, "Mithun Mathew" <mi...@gmail.com> wrote:
>
> I'm not sure if a documentation exists, but here's the procedure on how to
> add a custom action.
>
> To define a host level custom action for a service component, you would
> have to do the following:
> - Add the custom action for the service component to metainfo.xml
> https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml#L39-#L46
> - Add the definition of the custom action in the component's script
> https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py#L120-#L124
>
> Please note that the naming convention for the action in metainfo.xml is
> *MY_CUSTOM_COMMAND* and the corresponding function signature in the
> script would be *my_custom_command (self, env)*
>
>
>
> On Mon, Feb 22, 2016 at 6:27 AM, Zhang Ruiqiang <zh...@163.com> wrote:
>
>> Hi all:
>>      I want to add a host level action, is there any document that I can
>> follow?
>>
>> Thanks!
>>
>>
>>
>>
>
>
>
> --
> *Mithun Mathew* (Matt)
>
>    - www.linkedin.com/in/mithunmatt/
>
>
>
>
>



-- 
*Mithun Mathew* (Matt)

   - www.linkedin.com/in/mithunmatt/

Re:Re: How to add a host level action?

Posted by Zhang Ruiqiang <zh...@163.com>.
Hi Matt:
    Thanks for your reply!
    But it seems that your description is a "sevice level action". I want to add a "host level action" likes "Start/Stop/Restart All Components" on the Hosts page.
    In fact, I want to add a "Shutdown" action, so that I can  shutdown a host on the ambari web page.


Thanks!



At 2016-02-23 01:47:45, "Mithun Mathew" <mi...@gmail.com> wrote:

I'm not sure if a documentation exists, but here's the procedure on how to add a custom action.


To define a host level custom action for a service component, you would have to do the following:
- Add the custom action for the service component to metainfo.xml https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml#L39-#L46
- Add the definition of the custom action in the component's script https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py#L120-#L124


Please note that the naming convention for the action in metainfo.xml is MY_CUSTOM_COMMAND and the corresponding function signature in the script would be my_custom_command (self, env)






On Mon, Feb 22, 2016 at 6:27 AM, Zhang Ruiqiang <zh...@163.com> wrote:

Hi all:
     I want to add a host level action, is there any document that I can follow?


Thanks!




 






--

Mithun Mathew (Matt)
www.linkedin.com/in/mithunmatt/

Re: How to add a host level action?

Posted by Mithun Mathew <mi...@gmail.com>.
I'm not sure if a documentation exists, but here's the procedure on how to
add a custom action.

To define a host level custom action for a service component, you would
have to do the following:
- Add the custom action for the service component to metainfo.xml
https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml#L39-#L46
- Add the definition of the custom action in the component's script
https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py#L120-#L124

Please note that the naming convention for the action in metainfo.xml is
*MY_CUSTOM_COMMAND* and the corresponding function signature in the script
would be *my_custom_command (self, env)*



On Mon, Feb 22, 2016 at 6:27 AM, Zhang Ruiqiang <zh...@163.com> wrote:

> Hi all:
>      I want to add a host level action, is there any document that I can
> follow?
>
> Thanks!
>
>
>
>



-- 
*Mithun Mathew* (Matt)

   - www.linkedin.com/in/mithunmatt/