- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Execute custom scripts on hosts
- Labels:
-
Apache Ambari
Created ‎03-02-2017 11:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way to execute custom scripts on all hosts from ambari server, or any other process/service?
Created ‎03-03-2017 01:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I believe that you can. There is a folder which ships with Ambari Server in /var/lib/ambari-server/resources/custom_actions/scripts. You can have Ambari execute these scripts on the agents. For example, when you create a new cluster, Ambari "checks the hosts" for things like memory, OS, problems. This script is the check_host.py script. It's invoked like:
{ "RequestInfo": { "action": "check_host", "context": "Check host", "parameters": { "check_execute_list": "host_resolution_check", "jdk_location": "http://192.168.64.1:8080/resources/", "threshold": "20", "hosts": "c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org" } }, "Requests/resource_filters": [ { "hosts": "c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org" } ] }
Where "action" is the name of the script. The action is defined in /var/lib/ambari-server/resources/custom_action_definitions/system_action_definitions.xml like so:
<actionDefinition> <actionName>check_host</actionName> <actionType>SYSTEM</actionType> <inputs/> <targetService/> <targetComponent/> <defaultTimeout>60</defaultTimeout> <description>General check for host</description> <targetType>ANY</targetType> <permissions>HOST.ADD_DELETE_HOSTS</permissions> </actionDefinition>
Created ‎03-02-2017 11:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you're using Hortonworks Data Cloud, HDInsights or Cloudbreak, you can leverage node recipes to execute custom actions. For on premise clusters there is nothing out of the box you can leverage except for extending Ambari to custom service via API. If you're running RPM derivative OS, you can use Ansible as RHEL sells enterprise support with OS. For home-baked solution, you can still use Ansible, Chef, Puppet, CFEngine or Salt Stack across all OS flavors but it has nothing to do with Ambari.
Created ‎03-03-2017 01:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I believe that you can. There is a folder which ships with Ambari Server in /var/lib/ambari-server/resources/custom_actions/scripts. You can have Ambari execute these scripts on the agents. For example, when you create a new cluster, Ambari "checks the hosts" for things like memory, OS, problems. This script is the check_host.py script. It's invoked like:
{ "RequestInfo": { "action": "check_host", "context": "Check host", "parameters": { "check_execute_list": "host_resolution_check", "jdk_location": "http://192.168.64.1:8080/resources/", "threshold": "20", "hosts": "c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org" } }, "Requests/resource_filters": [ { "hosts": "c6401.ambari.apache.org,c6402.ambari.apache.org,c6403.ambari.apache.org" } ] }
Where "action" is the name of the script. The action is defined in /var/lib/ambari-server/resources/custom_action_definitions/system_action_definitions.xml like so:
<actionDefinition> <actionName>check_host</actionName> <actionType>SYSTEM</actionType> <inputs/> <targetService/> <targetComponent/> <defaultTimeout>60</defaultTimeout> <description>General check for host</description> <targetType>ANY</targetType> <permissions>HOST.ADD_DELETE_HOSTS</permissions> </actionDefinition>
