Useful Resources

ResourceLink
Alerts REST APIAlert Definitions 
Customizing the Alert TemplateCustomizing the Alert Template

Setting Connection Timeout for WEB and METRIC Alerts

WEB and METRIC alert types include a connection_timeout property on the alert definition (see below in AlertDefinition : source : uri : connection_timeout). This value is in seconds and defaults to 5.0. Use the Ambari REST API by updating the source block if you need to modify the connection timeout.

{
  "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/MyCluster/alert_definitions/42",
  "AlertDefinition" : {
    "cluster_name" : "MyCluster",
    "component_name" : "APP_TIMELINE_SERVER",
    "description" : "This host-level alert is triggered if the App Timeline Server Web UI is unreachable.",
    "enabled" : true,
    "id" : 42,
    "ignore_host" : false,
    "interval" : 1,
    "label" : "App Timeline Web UI",
    "name" : "yarn_app_timeline_server_webui",
    "scope" : "ANY",
    "service_name" : "YARN",
    "source" : {
      "reporting" : {
        "ok" : {
          "text" : "HTTP {0} response in {2:.3f}s"
        },
        "warning" : {
          "text" : "HTTP {0} response from {1} in {2:.3f}s ({3})"
        },
        "critical" : {
          "text" : "Connection failed to {1} ({3})"
        }
      },
      "type" : "WEB",
      "uri" : {
        "http" : "{{yarn-site/yarn.timeline-service.webapp.address}}",
        "https" : "{{yarn-site/yarn.timeline-service.webapp.https.address}}",
        "https_property" : "{{yarn-site/yarn.http.policy}}",
        "https_property_value" : "HTTPS_ONLY",
        "kerberos_keytab" : "{{yarn-site/yarn.timeline-service.http-authentication.kerberos.keytab}}",
        "kerberos_principal" : "{{yarn-site/yarn.timeline-service.http-authentication.kerberos.principal}}",
        "default_port" : 0.0,
        "connection_timeout" : 5.0
      }
    }
  }
}

For example, to update the connection_timeout with the API, you need to PUT the entire contents of the source block with your API call. For example, you need to PUT the following to update the connection_timeout to 6.5 seconds.

PUT /api/v1/clusters/MyCluster/alert_definitions/42

{
"AlertDefinition" : {
  "source" : {
      "reporting" : {
        "ok" : {
          "text" : "HTTP {0} response in {2:.3f}s"
        },
        "warning" : {
          "text" : "HTTP {0} response from {1} in {2:.3f}s ({3})"
        },
        "critical" : {
          "text" : "Connection failed to {1} ({3})"
        }
      },
      "type" : "WEB",
      "uri" : {
        "http" : "{{yarn-site/yarn.timeline-service.webapp.address}}",
        "https" : "{{yarn-site/yarn.timeline-service.webapp.https.address}}",
        "https_property" : "{{yarn-site/yarn.http.policy}}",
        "https_property_value" : "HTTPS_ONLY",
        "kerberos_keytab" : "{{yarn-site/yarn.timeline-service.http-authentication.kerberos.keytab}}",
        "kerberos_principal" : "{{yarn-site/yarn.timeline-service.http-authentication.kerberos.principal}}",
        "default_port" : 0.0,
        "connection_timeout" : 6.5
      }
    }
  }
}

 

 

  • No labels