Support Questions

Find answers, ask questions, and share your expertise

what is the right API to stop ambari METRICS

avatar

I am using in my bash script the following API in order to stop the ambari METRICS

curl -u $USER:$PASSWD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"$METRICS_SERVICE_ACTION AMBARI_METRICS via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://localhost:8080/api/v1/clusters/hdp/services/AMBARI_METRICS

the problem is that Metrics Collector not stopped and also Metrics Monitor on one of the workers machine

so actually ambari METRICS was stop partially

my question is dose my syntax to stop the ambari metrics is the right syntax?

second can we force the Metrics Monitor to stop ?

67392-capture.png

Michael-Bronson
1 ACCEPTED SOLUTION

avatar
Super Guru

@Michael Bronson,

Try this

curl -u $USER:$PASSWD -i -H 'X-Requested-By: ambari'-X PUT -d '{"RequestInfo":{"context":"_PARSE_.STOP.AMBARI_METRICS","operation_level":{"level":"SERVICE","cluster_name":"hdp","service_name":"AMBARI_METRICS"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://localhost:8080/api/v1/clusters/hdp/services/AMBARI_METRICS

Make sure that stop operation is not failed. You can check the operations in ambari UI.

.

Thanks,

Aditya

View solution in original post

6 REPLIES 6

avatar
Super Guru

@Michael Bronson,

Try this

curl -u $USER:$PASSWD -i -H 'X-Requested-By: ambari'-X PUT -d '{"RequestInfo":{"context":"_PARSE_.STOP.AMBARI_METRICS","operation_level":{"level":"SERVICE","cluster_name":"hdp","service_name":"AMBARI_METRICS"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://localhost:8080/api/v1/clusters/hdp/services/AMBARI_METRICS

Make sure that stop operation is not failed. You can check the operations in ambari UI.

.

Thanks,

Aditya

avatar

I tried your syntax but we get:

curl: (6) Could not resolve host: PUT; Unknown error
HTTP/1.1 400 Bad Request
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-store
Pragma: no-cache
Set-Cookie: AMBARISESSIONID=5u0mvfkjcd6v1pa1v5apjaymk;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
User: admin
Content-Type: text/plain
Content-Length: 131
Server: Jetty(8.1.19.v20160209)
{
  "status" : 400,
  "message" : "Invalid desired state only INIT state allowed during creation, providedDesiredState=INSTALLED"
Michael-Bronson

avatar
Super Guru

@Michael Bronson,

My bad. A space was missing between header and -X put. Use this

curl -u $USER:$PASSWD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo":{"context":"_PARSE_.STOP.AMBARI_METRICS","operation_level":{"level":"SERVICE","cluster_name":"hdp","service_name":"AMBARI_METRICS"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://localhost:8080/api/v1/clusters/hdp/services/AMBARI_METRICS

avatar

now we have the output , its ok

HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-store
Pragma: no-cache
Set-Cookie: AMBARISESSIONID=1sn5tlp90xkn81kp3n34hterju;Path=/;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
User: admin
Content-Type: text/plain
Vary: Accept-Encoding, User-Agent
Content-Length: 135
Server: Jetty(8.1.19.v20160209)
{
  "href" : "http://localhost:8080/api/v1/clusters/hdp/requests/64",
  "Requests" : {
    "id" : 64,
    "status" : "Accepted"
  }
Michael-Bronson

avatar

@Aditya what is the syntax for ambari metrics start ?

Michael-Bronson

avatar
Super Guru

@Michael Bronson,

This is the curl call for start

curl -u $USER:$PASSWD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo":{"context":"_PARSE_.START.AMBARI_METRICS","operation_level":{"level":"SERVICE","cluster_name":"hdp","service_name":"AMBARI_METRICS"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://localhost:8080/api/v1/clusters/hdp/services/AMBARI_METRICS