- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Ambari rest API to control flume agent?
- Labels:
-
Apache Ambari
-
Apache Flume
Created ‎09-02-2016 09:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to use the rest api to start / stop a specific flume agent rather than the whole flume service.
Working example: I have a 5 node cluster with Ambari on node1, flume agent running on node5.
I can get the URL for the flume agent with:
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X GET http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components
This shows:
http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER
However if you try to stop it, it stops the whole flume service not just the agent:
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{"HostRoles": {"state": "INSTALLED"}}' http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER
Is this possible using REST API?
Created ‎09-07-2016 01:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just tested the below in my local environment and worked fine:
curl -u admin:admin -H "X-Requested-By: ambari" -d '{"RequestInfo":{"context":"Stop Flume agent","flume_handler":"agent","operation_level":{"level":"HOST_COMPONENT","cluster_name":"Cluster","service_name":"FLUME","host_name":"node5"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' -X PUT "http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER"
Created ‎09-05-2016 08:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The passing the following:
{ "RequestInfo": { "context": "Stop Flume agent", "flume_handler": "agent", "operation_level": { "level": "HOST_COMPONENT", "cluster_name": "Cluster", "service_name": "FLUME", "host_name": "node5" } }, "Body": { "HostRoles": { "state": "INSTALLED" } } }
Created ‎09-06-2016 12:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - what would be the URL for this @stoader. I tried with both the service and the component. e.g.
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{ "RequestInfo": { "context": "Stop Flume agent", "flume_handler": "agent", "operation_level": { "level": "HOST_COMPONENT", "cluster_name": "Cluster", "service_name" "FLUME", "host_name": "node5" } }, "Body": { "HostRoles": { "state": "INSTALLED" } } }' http://node1:8080/api/v1/clusters/Cluster/services/FLUME
and
curl -u admin:admin -i -H 'X-Requested-By: ambari' -X PUT -d '{ "RequestInfo": { "context": "Stop Flume agent", "flume_handler": "agent", "operation_level": { "level": "HOST_COMPONENT", "cluster_name": "Cluster", "service_name" "FLUME", "host_name": "node5" } }, "Body": { "HostRoles": { "state": "INSTALLED" } } }' http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER
Created ‎09-07-2016 01:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just tested the below in my local environment and worked fine:
curl -u admin:admin -H "X-Requested-By: ambari" -d '{"RequestInfo":{"context":"Stop Flume agent","flume_handler":"agent","operation_level":{"level":"HOST_COMPONENT","cluster_name":"Cluster","service_name":"FLUME","host_name":"node5"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' -X PUT "http://node1:8080/api/v1/clusters/Cluster/hosts/node5/host_components/FLUME_HANDLER"
