You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Eirik Thorsnes <ei...@uni.no> on 2015/06/18 11:58:26 UTC

Ambari 2.1.0-snap: Alert configuration location

Hi,

I'm looking at Ambari 2.1.0 compiled from git.
In JIRA AMBARI-10816 it was added the possibility to use configuration
instead of hard-coded values for alerts (as I understand it).

Where do I set these configurations?
For e.g.: the configuration percent.used.space.warning.threshold in the
alert_disk_space.py script.

Thanks,
Eirik

-- 
Eirik Thorsnes

Re: Ambari 2.1.0-snap: Alert configuration location

Posted by Jonathan Hurley <jh...@hortonworks.com>.
Yes, they should be there. Was this an upgrade from an earlier Ambari 2.0 install? In which case they might not be there since the 2.0 definitions didn’t have them. Also, my below JSON had a syntax error in it, there should be an extra closing { 

> On Jun 18, 2015, at 11:12 AM, Eirik Thorsnes <ei...@uni.no> wrote:
> 
> On 18. juni 2015 16:53, Jonathan Hurley wrote:
>> You can update the values, but you’ll need to us the APIs to do this.
>> When sending a new “source” element, you need to include all fields - it
>> will not merge omitted source child elements in with the existing source:
>> 
>> PUT api/v1/clusters/<cluster-name>/alert_definitions/<definition-id>
> 
> Thank you, I'll try that.
> 
> Are the parameters section supposed to be already there in the definitions?
> 
> If I issue a GET I only see the following:
> 
> GET -H 'X-Requested-By: ambari'
> http://localhost:8080/api/v1/clusters/helm/alert_definitions/52
> {
>  "href" :
> "http://localhost:8080/api/v1/clusters/helm/alert_definitions/52",
>  "AlertDefinition" : {
>    "cluster_name" : "helm",
>    "component_name" : "AMBARI_AGENT",
>    "description" : "This host-level alert is triggered if the amount of
> disk space used on a host goes above specific thresholds. The default
> values are 50% for WARNING and 80% for CRITICAL.",
>    "enabled" : true,
>    "id" : 52,
>    "ignore_host" : false,
>    "interval" : 1,
>    "label" : "Ambari Agent Disk Usage",
>    "name" : "ambari_agent_disk_usage",
>    "scope" : "HOST",
>    "service_name" : "AMBARI",
>    "source" : {
>      "path" : "alert_disk_space.py",
>      "type" : "SCRIPT"
>    }
>  }
> }
> 
> Regards,
> Eirik
> 
> -- 
> Eirik Thorsnes
> 
> 


Re: Ambari 2.1.0-snap: Alert configuration location

Posted by Eirik Thorsnes <ei...@uni.no>.
On 18. juni 2015 16:53, Jonathan Hurley wrote:
> You can update the values, but you’ll need to us the APIs to do this.
> When sending a new “source” element, you need to include all fields - it
> will not merge omitted source child elements in with the existing source:
> 
> PUT api/v1/clusters/<cluster-name>/alert_definitions/<definition-id>

Thank you, I'll try that.

Are the parameters section supposed to be already there in the definitions?

If I issue a GET I only see the following:

GET -H 'X-Requested-By: ambari'
http://localhost:8080/api/v1/clusters/helm/alert_definitions/52
{
  "href" :
"http://localhost:8080/api/v1/clusters/helm/alert_definitions/52",
  "AlertDefinition" : {
    "cluster_name" : "helm",
    "component_name" : "AMBARI_AGENT",
    "description" : "This host-level alert is triggered if the amount of
disk space used on a host goes above specific thresholds. The default
values are 50% for WARNING and 80% for CRITICAL.",
    "enabled" : true,
    "id" : 52,
    "ignore_host" : false,
    "interval" : 1,
    "label" : "Ambari Agent Disk Usage",
    "name" : "ambari_agent_disk_usage",
    "scope" : "HOST",
    "service_name" : "AMBARI",
    "source" : {
      "path" : "alert_disk_space.py",
      "type" : "SCRIPT"
    }
  }
}

Regards,
Eirik

-- 
Eirik Thorsnes


Re: Ambari 2.1.0-snap: Alert configuration location

Posted by Jonathan Hurley <jh...@hortonworks.com>.
You can update the values, but you’ll need to us the APIs to do this. When sending a new “source” element, you need to include all fields - it will not merge omitted source child elements in with the existing source:

PUT api/v1/clusters/<cluster-name>/alert_definitions/<definition-id>

{
  "AlertDefinition" : {
    "source" : {
      "type": "SCRIPT",
      "path": "alert_disk_space.py",
      "parameters": [
        {
          "name": "minimum.free.space",
          "display_name": "Minimum Free Space",
          "value": 5000000000,
          "type": "NUMERIC",
          "description": "The overall amount of free disk space left before an alert is triggered.",
          "units": "bytes",
          "threshold": "WARNING"
        },
        {
          "name": "percent.used.space.warning.threshold",
          "display_name": "Warning",
          "value": 0.5,
          "type": "PERCENT",
          "description": "The percent of disk space consumed before a warning is triggered.",
          "units": "%",
          "threshold": "WARNING"
        },
        {
          "name": "percent.free.space.critical.threshold",
          "display_name": "Critical",
          "value": 0.8,
          "type": "PERCENT",
          "description": "The percent of disk space consumed before a critical alert is triggered.",
          "units": "%",
          "threshold": "CRITICAL"
       }
     ]
  }
}



On Jun 18, 2015, at 10:05 AM, Sumit Mohanty <sm...@hortonworks.com>> wrote:

Does this have the details you need?
https://github.com/apache/ambari/blob/branch-2.0.0/ambari-server/docs/api/v1/alert-definitions.md

-Sumit
________________________________________
From: Eirik Thorsnes <ei...@uni.no>
Sent: Thursday, June 18, 2015 2:58 AM
To: user@ambari.apache.org
Subject: Ambari 2.1.0-snap: Alert configuration location

Hi,

I'm looking at Ambari 2.1.0 compiled from git.
In JIRA AMBARI-10816 it was added the possibility to use configuration
instead of hard-coded values for alerts (as I understand it).

Where do I set these configurations?
For e.g.: the configuration percent.used.space.warning.threshold in the
alert_disk_space.py script.

Thanks,
Eirik

--
Eirik Thorsnes



Re: Ambari 2.1.0-snap: Alert configuration location

Posted by Sumit Mohanty <sm...@hortonworks.com>.
Does this have the details you need?
https://github.com/apache/ambari/blob/branch-2.0.0/ambari-server/docs/api/v1/alert-definitions.md

-Sumit
________________________________________
From: Eirik Thorsnes <ei...@uni.no>
Sent: Thursday, June 18, 2015 2:58 AM
To: user@ambari.apache.org
Subject: Ambari 2.1.0-snap: Alert configuration location

Hi,

I'm looking at Ambari 2.1.0 compiled from git.
In JIRA AMBARI-10816 it was added the possibility to use configuration
instead of hard-coded values for alerts (as I understand it).

Where do I set these configurations?
For e.g.: the configuration percent.used.space.warning.threshold in the
alert_disk_space.py script.

Thanks,
Eirik

--
Eirik Thorsnes