Member since
02-27-2017
2
Posts
0
Kudos Received
0
Solutions
03-03-2017
01:40 PM
2 Kudos
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>
... View more