You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Benoit Perroud <be...@noisette.ch> on 2015/12/30 13:57:00 UTC

Custom Alert definition

Hi All,

I'm struggling with the following use case:

I want to add a custom alert which should call a custom script monitoring
some Pig jobs.

My alert definition currently looks like this:

  "AlertDefinition" : {
    "cluster_name" : "MyCluster",
    "component_name" : null,
    "description" : "My description",
    "enabled" : true,
    "ignore_host" : true,
    "interval" : 5,
    "label" : "My_Label",
    "name" : "my_name",
    "scope" : "ANY",
    "service_name" : "PIG",
    "source" : {
      "parameters" : [
        {
          "name" : "connection.timeout1",
          "display_name" : "Connection Timeout1",
          "units" : "seconds",
          "value" : 10.0,
          "description" : "The maximum time before this alert is considered
to be CRITICAL",
          "type" : "NUMERIC",
          "threshold" : "CRITICAL"
        }
      ],
      "path" : "/usr/local/bin/pig_check.sh",
      "type" : "SCRIPT"
    }
  }

My alert is added properly, i.e. I'm able to
query api/v1/clusters/DAPLAB02/alert_definitions/${alert_id}, but I don't
see my script called at all, i mean, the state in Ambari is NONE, and I
don't see any alert (api/v1/clusters/DAPLAB02/alerts) with defintion_id =
${alert_id}.

Also, is there some more detailed documentation about the properties such as
- ignore_host
- what is the difference between name and description?
- can we add general checks not related to any service?
- with the METRIC source, can we monitor metrics reported in the Ambari
Collector instead of JMX?

Thanks in advance,

Benoit.

Re: Custom Alert definition

Posted by Alejandro Fernandez <af...@hortonworks.com>.
Hi Benoit,

Two observations: you may need to put PIG as the component name, and the script may have to be a Python file.
You can try changing both of these things and see if it starts functioning, then work back to figure out what isn't supported.

You can certainly add checks not related to a service, since some run on at the Host-level.
I believe the metric source is the type, such as a port, script, url, etc.

Thanks,
Alejandro

From: Benoit Perroud <be...@noisette.ch>>
Reply-To: "user@ambari.apache.org<ma...@ambari.apache.org>" <us...@ambari.apache.org>>
Date: Wednesday, December 30, 2015 at 4:57 AM
To: "user@ambari.apache.org<ma...@ambari.apache.org>" <us...@ambari.apache.org>>
Subject: Custom Alert definition

Hi All,

I'm struggling with the following use case:

I want to add a custom alert which should call a custom script monitoring some Pig jobs.

My alert definition currently looks like this:

  "AlertDefinition" : {
    "cluster_name" : "MyCluster",
    "component_name" : null,
    "description" : "My description",
    "enabled" : true,
    "ignore_host" : true,
    "interval" : 5,
    "label" : "My_Label",
    "name" : "my_name",
    "scope" : "ANY",
    "service_name" : "PIG",
    "source" : {
      "parameters" : [
        {
          "name" : "connection.timeout1",
          "display_name" : "Connection Timeout1",
          "units" : "seconds",
          "value" : 10.0,
          "description" : "The maximum time before this alert is considered to be CRITICAL",
          "type" : "NUMERIC",
          "threshold" : "CRITICAL"
        }
      ],
      "path" : "/usr/local/bin/pig_check.sh",
      "type" : "SCRIPT"
    }
  }

My alert is added properly, i.e. I'm able to query api/v1/clusters/DAPLAB02/alert_definitions/${alert_id}, but I don't see my script called at all, i mean, the state in Ambari is NONE, and I don't see any alert (api/v1/clusters/DAPLAB02/alerts) with defintion_id = ${alert_id}.

Also, is there some more detailed documentation about the properties such as
- ignore_host
- what is the difference between name and description?
- can we add general checks not related to any service?
- with the METRIC source, can we monitor metrics reported in the Ambari Collector instead of JMX?

Thanks in advance,

Benoit.