Support Questions
Find answers, ask questions, and share your expertise

ambari alert

ambari alert

i do not want "definition_name" and "id" and i want timestamp in date format inside alert

script :

curl -u admin:admin -H "X-Requested-By: ambari" -X GET "ambari_server:8080/api/v1/clusters/clustername/alerts?Alert/,CRITICAL)&Alert/maintenance_state=OFF&fields=Alert/state,Alert/text,Alert/latest_timestamp,Alert/original_timestamp"

after executing above command i get output like

{ "cluster_name" : "clustername", "definition_name" : "datanode_storage", "latest_timestamp" : 1498725975458, "maintenance_state" : "OFF", "original_timestamp" : 1497691757895, "service_name" : "HDFS", "state" : "WARNING", "text" : "Remaining Capacity:[9402732544], Total Capacity:[80% Used, 46953267200]" }

but i want original_timestamp in date format and do not want defitinition_name field


Re: ambari alert

Super Collaborator

The ID and the definition name are required fields when dealing which alerts, and are always returned. They don't hurt anything if you're not using them and don't incur a cost when retrieving them, so it's really not really an issue if you just ignore them.

All dates in Ambari are returned in the Java epoch, which is the number of milliseconds since 1970. There are many tools which can convert these for you in variety of languages and environments.