ambari cluster + get status of component/services by tool / python script

You can get the state - STARTED/STOPPED by using the below API Calls

For services

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/services/{service-name}?fields=Serv...

For components

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/components/{component-name}?fields=...

To get complete status info about service

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/services/{service-name}

To get complete status info about component

curl -u {ambari-username}:{ambari-password} -H "X-Requested-By: ambari" -X GET http://{ambari-host}:{ambari-port}/api/v1/clusters/{clustername}/components/{component-name}

Replace the place holders like {ambari-username} , {ambari-password}, {ambari-host} , {ambari-port},{clustername} etc with your respective values

refer: https://community.cloudera.com/t5/Support-Questions/how-to-capture-all-ambari-services-components-status-by-API/m-p/179704/highlight/true#M141950