Member since
03-02-2016
3
Posts
4
Kudos Received
0
Solutions
04-01-2016
03:07 PM
1 Kudo
Hello everyone!
I tried to disable the predefined "Metrics Collector - HBase Master CPU Utilization" alert with "id 8" using the following API request: curl -H "X-Requested-By: ambari" -X DELETE "http://ambari-server:8080/api/v1/clusters/newcluster/alert_definitions/8" -u admin:admin But it turned out I completely removed it. I cannot find alert in a list of alerts that are disabled. Is there any way to recover it? And how to properly disable and not delete predefined alert over API? Thanks!
... View more
03-28-2016
01:59 PM
1 Kudo
Hi, I am trying to convert "original_timestamp" into human-friendly format. I suppose the values are presented in UNIX Epoch format but for some reason I cannot convert them to date. Example: "Alert" : {
"cluster_name" : "appslogs",
"component_name" : "AMBARI_AGENT",
"definition_id" : 50,
"definition_name" : "ambari_agent_disk_usage",
"host_name" : "1516.local.net",
"id" : 303,
"instance" : null,
"label" : "Host Disk Usage",
"latest_timestamp" : 1459169433304,
"maintenance_state" : "OFF",
"original_timestamp" : 1458822573305,
"scope" : "HOST",
"service_name" : "AMBARI",
"state" : "WARNING",
"text" : "Capacity Used: [70.92%, 5.9 GB], Capacity Total: [8.3 GB], path=/usr/hdp. Total free space is less than 2.0 GB"
} btop@gw-01:~$ date -d '@1458822573305'
Sat Mar 31 15:35:05 EEST 48198
Returned date is obviously incorrect. So the question is: what's a format of presented values? And how to convert it into date? Looking forward to your response! Thanks!
... View more
Labels:
03-02-2016
03:10 PM
2 Kudos
Hello everyone, I am trying to get a list of alerts via REST API but I want it to be limited to only specific fields. I am currently able to get all available information from the alerts, ie: {
"href" : "http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&Alert/maintenance_state=OFF&fields=*",
"items" : [
{
"href" : "http://ambari_server:8080/api/v1/clusters/appslogs/alerts/23",
"Alert" : {
"cluster_name" : "appslogs",
"component_name" : "AMBARI_AGENT",
"definition_id" : 50,
"definition_name" : "ambari_agent_disk_usage",
"host_name" : "host1.local",
"id" : 23,
"instance" : null,
"label" : "Host Disk Usage",
"latest_timestamp" : 1456931060177,
"maintenance_state" : "OFF",
"original_timestamp" : 1454589680156,
"scope" : "HOST",
"service_name" : "AMBARI",
"state" : "WARNING",
"text" : "Capacity Used: [71.56%, 6.0 GB], Capacity Total: [8.3 GB], path=/usr/hdp. Total free space is less than 2.0 GB"
} Does anybody know how to get ONLY state,host and text fields in response? I tried the following request but it does not work: http://ambari_server:8080/api/v1/clusters/appslogs/alerts?Alert/state.in(WARNING,CRITICAL,UNKNOWN)&Alert/maintenance_state=OFF&fields=state,host,text What am I missing? Apache Ambari
Version: 2.2.0.0
... View more
Labels: