Преглед изворни кода

AMBARI-8040. Alerts UI: Create mapper for alert-definitions. (akovalenko)

Aleksandr Kovalenko пре 10 година
родитељ
комит
dc93cbb376

+ 1160 - 0
ambari-web/app/assets/data/alerts/alertDefinitions.json

@@ -0,0 +1,1160 @@
+{
+  "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions?fields=*",
+  "items" : [
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/1",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "GANGLIA_SERVER",
+        "enabled" : true,
+        "id" : 1,
+        "interval" : 1,
+        "label" : "Ganglia History Server Process Monitor",
+        "name" : "ganglia_monitor_mapreduce_history_server",
+        "scope" : "ANY",
+        "service_name" : "GANGLIA",
+        "source" : {
+          "default_port" : 8666.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "8666"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/2",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "GANGLIA_SERVER",
+        "enabled" : true,
+        "id" : 2,
+        "interval" : 1,
+        "label" : "Ganglia ResourceManager Process Monitor",
+        "name" : "ganglia_monitor_yarn_resourcemanager",
+        "scope" : "ANY",
+        "service_name" : "GANGLIA",
+        "source" : {
+          "default_port" : 8664.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "8664"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/3",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "GANGLIA_SERVER",
+        "enabled" : true,
+        "id" : 3,
+        "interval" : 1,
+        "label" : "Ganglia NameNode Process Monitor",
+        "name" : "ganglia_monitor_hdfs_namenode",
+        "scope" : "ANY",
+        "service_name" : "GANGLIA",
+        "source" : {
+          "default_port" : 8661.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "8661"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/4",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "GANGLIA_SERVER",
+        "enabled" : true,
+        "id" : 4,
+        "interval" : 1,
+        "label" : "Ganglia HBase Master Process Monitor",
+        "name" : "ganglia_monitor_hbase_master",
+        "scope" : "ANY",
+        "service_name" : "GANGLIA",
+        "source" : {
+          "default_port" : 8663.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "8663"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/5",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "GANGLIA_SERVER",
+        "enabled" : true,
+        "id" : 5,
+        "interval" : 1,
+        "label" : "Ganglia Server Process",
+        "name" : "ganglia_server_process",
+        "scope" : "ANY",
+        "service_name" : "GANGLIA",
+        "source" : {
+          "default_port" : 8651.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "8651"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/6",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "ZOOKEEPER_SERVER",
+        "enabled" : true,
+        "id" : 6,
+        "interval" : 1,
+        "label" : "ZooKeeper Server Process",
+        "name" : "zookeeper_server_process",
+        "scope" : "ANY",
+        "service_name" : "ZOOKEEPER",
+        "source" : {
+          "default_port" : 2181.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "{{zookeeper-env/clientPort}}"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/7",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : null,
+        "enabled" : true,
+        "id" : 7,
+        "interval" : 1,
+        "label" : "Percent ZooKeeper Servers Available",
+        "name" : "zookeeper_server_process_percent",
+        "scope" : "SERVICE",
+        "service_name" : "ZOOKEEPER",
+        "source" : {
+          "alert_name" : "zookeeper_server_process",
+          "reporting" : {
+            "ok" : {
+              "text" : "affected: [{1}], total: [{0}]"
+            },
+            "warning" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.35
+            },
+            "critical" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.7
+            }
+          },
+          "type" : "AGGREGATE"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/8",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "HISTORYSERVER",
+        "enabled" : true,
+        "id" : 8,
+        "interval" : 1,
+        "label" : "History Server Web UI",
+        "name" : "mapreduce_history_server_webui",
+        "scope" : "ANY",
+        "service_name" : "MAPREDUCE2",
+        "source" : {
+          "reporting" : {
+            "ok" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "warning" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "critical" : {
+              "text" : "Connection failed to {1}"
+            }
+          },
+          "type" : "WEB",
+          "uri" : {
+            "http" : "{{mapred-site/mapreduce.jobhistory.webapp.address}}",
+            "https" : "{{mapred-site/mapreduce.jobhistory.webapp.https.address}}",
+            "https_property" : "{{mapred-site/mapreduce.jobhistory.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/9",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "HISTORYSERVER",
+        "enabled" : true,
+        "id" : 9,
+        "interval" : 1,
+        "label" : "History Server Process",
+        "name" : "mapreduce_history_server_process",
+        "scope" : "ANY",
+        "service_name" : "MAPREDUCE2",
+        "source" : {
+          "default_port" : 19888.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "{{mapred-site/mapreduce.jobhistory.webapp.address}}"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/10",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "HISTORYSERVER",
+        "enabled" : true,
+        "id" : 10,
+        "interval" : 5,
+        "label" : "History Server RPC Latency",
+        "name" : "mapreduce_history_server_rpc_latency",
+        "scope" : "ANY",
+        "service_name" : "MAPREDUCE2",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "Hadoop:service=JobHistoryServer,name=RpcActivityForPort*/RpcQueueTimeAvgTime",
+              "Hadoop:service=JobHistoryServer,name=RpcActivityForPort*/RpcProcessingTimeAvgTime"
+            ],
+            "value" : "{0}"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]"
+            },
+            "warning" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]",
+              "value" : 3000.0
+            },
+            "critical" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]",
+              "value" : 5000.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{mapred-site/mapreduce.jobhistory.webapp.address}}",
+            "https" : "{{mapred-site/mapreduce.jobhistory.webapp.https.address}}",
+            "https_property" : "{{mapred-site/mapreduce.jobhistory.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/11",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "HISTORYSERVER",
+        "enabled" : true,
+        "id" : 11,
+        "interval" : 5,
+        "label" : "History Server CPU Utilization",
+        "name" : "mapreduce_history_server_cpu",
+        "scope" : "ANY",
+        "service_name" : "MAPREDUCE2",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "java.lang:type=OperatingSystem/SystemCpuLoad",
+              "java.lang:type=OperatingSystem/AvailableProcessors"
+            ],
+            "value" : "{0} * 100"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "{1} CPU, load {0:.1%}"
+            },
+            "warning" : {
+              "text" : "{1} CPU, load {0:.1%}",
+              "value" : 200.0
+            },
+            "critical" : {
+              "text" : "{1} CPU, load {0:.1%}",
+              "value" : 250.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{mapred-site/mapreduce.jobhistory.webapp.address}}",
+            "https" : "{{mapred-site/mapreduce.jobhistory.webapp.https.address}}",
+            "https_property" : "{{mapred-site/mapreduce.jobhistory.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/12",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "RESOURCEMANAGER",
+        "enabled" : true,
+        "id" : 12,
+        "interval" : 5,
+        "label" : "ResourceManager RPC Latency",
+        "name" : "yarn_resourcemanager_rpc_latency",
+        "scope" : "ANY",
+        "service_name" : "YARN",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "Hadoop:service=ResourceManager,name=RpcActivityForPort*/RpcQueueTimeAvgTime",
+              "Hadoop:service=ResourceManager,name=RpcActivityForPort*/RpcProcessingTimeAvgTime"
+            ],
+            "value" : "{0}"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]"
+            },
+            "warning" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]",
+              "value" : 3000.0
+            },
+            "critical" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]",
+              "value" : 5000.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{yarn-site/yarn.resourcemanager.webapp.address}}",
+            "https" : "{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
+            "https_property" : "{{yarn-site/yarn.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/13",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "RESOURCEMANAGER",
+        "enabled" : true,
+        "id" : 13,
+        "interval" : 1,
+        "label" : "ResourceManager Web UI",
+        "name" : "yarn_resourcemanager_webui",
+        "scope" : "ANY",
+        "service_name" : "YARN",
+        "source" : {
+          "reporting" : {
+            "ok" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "warning" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "critical" : {
+              "text" : "Connection failed to {1}"
+            }
+          },
+          "type" : "WEB",
+          "uri" : {
+            "http" : "{{yarn-site/yarn.resourcemanager.webapp.address}}",
+            "https" : "{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
+            "https_property" : "{{yarn-site/yarn.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/14",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "APP_TIMELINE_SERVER",
+        "enabled" : true,
+        "id" : 14,
+        "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:.4f} seconds"
+            },
+            "warning" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "critical" : {
+              "text" : "Connection failed to {1}"
+            }
+          },
+          "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",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/15",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : null,
+        "enabled" : true,
+        "id" : 15,
+        "interval" : 1,
+        "label" : "Percent NodeManagers Available",
+        "name" : "yarn_nodemanager_webui_percent",
+        "scope" : "SERVICE",
+        "service_name" : "YARN",
+        "source" : {
+          "alert_name" : "yarn_nodemanager_webui",
+          "reporting" : {
+            "ok" : {
+              "text" : "affected: [{1}], total: [{0}]"
+            },
+            "warning" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.1
+            },
+            "critical" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.3
+            }
+          },
+          "type" : "AGGREGATE"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/16",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "RESOURCEMANAGER",
+        "enabled" : true,
+        "id" : 16,
+        "interval" : 5,
+        "label" : "ResourceManager CPU Utilization",
+        "name" : "yarn_resourcemanager_cpu",
+        "scope" : "ANY",
+        "service_name" : "YARN",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "java.lang:type=OperatingSystem/SystemCpuLoad",
+              "java.lang:type=OperatingSystem/AvailableProcessors"
+            ],
+            "value" : "{0} * 100"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "{1} CPU, load {0:.1%}"
+            },
+            "warning" : {
+              "text" : "{1} CPU, load {0:.1%}",
+              "value" : 200.0
+            },
+            "critical" : {
+              "text" : "{1} CPU, load {0:.1%}",
+              "value" : 250.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{yarn-site/yarn.resourcemanager.webapp.address}}",
+            "https" : "{{yarn-site/yarn.resourcemanager.webapp.https.address}}",
+            "https_property" : "{{yarn-site/yarn.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/17",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NODEMANAGER",
+        "enabled" : true,
+        "id" : 17,
+        "interval" : 1,
+        "label" : "NodeManager Health",
+        "name" : "yarn_nodemanager_health",
+        "scope" : "HOST",
+        "service_name" : "YARN",
+        "source" : {
+          "path" : "HDP/2.0.6/services/YARN/package/files/alert_nodemanager_health.py",
+          "type" : "SCRIPT"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/18",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NODEMANAGER",
+        "enabled" : true,
+        "id" : 18,
+        "interval" : 1,
+        "label" : "NodeManager Web UI",
+        "name" : "yarn_nodemanager_webui",
+        "scope" : "HOST",
+        "service_name" : "YARN",
+        "source" : {
+          "reporting" : {
+            "ok" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "warning" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "critical" : {
+              "text" : "Connection failed to {1}"
+            }
+          },
+          "type" : "WEB",
+          "uri" : {
+            "http" : "{{yarn-site/yarn.nodemanager.webapp.address}}",
+            "https" : "{{yarn-site/yarn.nodemanager.webapp.https.address}}",
+            "https_property" : "{{yarn-site/yarn.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 8042.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/19",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "SECONDARY_NAMENODE",
+        "enabled" : true,
+        "id" : 19,
+        "interval" : 1,
+        "label" : "Secondary NameNode Process",
+        "name" : "secondary_namenode_process",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "default_port" : 50071.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "{{hdfs-site/dfs.namenode.secondary.http-address}}"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/20",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "DATANODE",
+        "enabled" : true,
+        "id" : 20,
+        "interval" : 1,
+        "label" : "DataNode Web UI",
+        "name" : "datanode_webui",
+        "scope" : "HOST",
+        "service_name" : "HDFS",
+        "source" : {
+          "reporting" : {
+            "ok" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "warning" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "critical" : {
+              "text" : "Connection failed to {1}"
+            }
+          },
+          "type" : "WEB",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.datanode.http.address}}",
+            "https" : "{{hdfs-site/dfs.datanode.https.address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/21",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 21,
+        "interval" : 5,
+        "label" : "NameNode Host CPU Utilization",
+        "name" : "namenode_cpu",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "java.lang:type=OperatingSystem/SystemCpuLoad",
+              "java.lang:type=OperatingSystem/AvailableProcessors"
+            ],
+            "value" : "{0} * 100"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "{1} CPU, load {0:.1%}"
+            },
+            "warning" : {
+              "text" : "{1} CPU, load {0:.1%}",
+              "value" : 200.0
+            },
+            "critical" : {
+              "text" : "{1} CPU, load {0:.1%}",
+              "value" : 250.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.namenode.http-address}}",
+            "https" : "{{hdfs-site/dfs.namenode.https-address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/22",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 22,
+        "interval" : 2,
+        "label" : "NameNode RPC Latency",
+        "name" : "namenode_rpc_latency",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "Hadoop:service=NameNode,name=RpcActivityForPort*/RpcQueueTimeAvgTime",
+              "Hadoop:service=NameNode,name=RpcActivityForPort*/RpcProcessingTimeAvgTime"
+            ],
+            "value" : "{0}"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]"
+            },
+            "warning" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]",
+              "value" : 3000.0
+            },
+            "critical" : {
+              "text" : "Average Queue Time:[{0}], Average Processing Time:[{1}]",
+              "value" : 5000.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.namenode.http-address}}",
+            "https" : "{{hdfs-site/dfs.namenode.https-address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/23",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 23,
+        "interval" : 2,
+        "label" : "NameNode Blocks Health",
+        "name" : "namenode_hdfs_blocks_health",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "Hadoop:service=NameNode,name=FSNamesystem/MissingBlocks",
+              "Hadoop:service=NameNode,name=FSNamesystem/BlocksTotal"
+            ],
+            "value" : "{0}"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "Total Blocks:[{1}], Missing Blocks:[{0}]"
+            },
+            "warning" : {
+              "text" : "Total Blocks:[{1}], Missing Blocks:[{0}]",
+              "value" : 1.0
+            },
+            "critical" : {
+              "text" : "Total Blocks:[{1}], Missing Blocks:[{0}]",
+              "value" : 1.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.namenode.http-address}}",
+            "https" : "{{hdfs-site/dfs.namenode.https-address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/24",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 24,
+        "interval" : 1,
+        "label" : "NameNode Web UI",
+        "name" : "namenode_webui",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "reporting" : {
+            "ok" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "warning" : {
+              "text" : "HTTP {0} response in {2:.4f} seconds"
+            },
+            "critical" : {
+              "text" : "Connection failed to {1}"
+            }
+          },
+          "type" : "WEB",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.namenode.http-address}}",
+            "https" : "{{hdfs-site/dfs.namenode.https-address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/25",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "DATANODE",
+        "enabled" : true,
+        "id" : 25,
+        "interval" : 1,
+        "label" : "DateNode Process",
+        "name" : "datanode_process",
+        "scope" : "HOST",
+        "service_name" : "HDFS",
+        "source" : {
+          "default_port" : 50010.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "{{hdfs-site/dfs.datanode.address}}"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/26",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : null,
+        "enabled" : true,
+        "id" : 26,
+        "interval" : 1,
+        "label" : "Percent DataNodes Available",
+        "name" : "datanode_process_percent",
+        "scope" : "SERVICE",
+        "service_name" : "HDFS",
+        "source" : {
+          "alert_name" : "datanode_process",
+          "reporting" : {
+            "ok" : {
+              "text" : "affected: [{1}], total: [{0}]"
+            },
+            "warning" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.1
+            },
+            "critical" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.3
+            }
+          },
+          "type" : "AGGREGATE"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/27",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 27,
+        "interval" : 1,
+        "label" : "NameNode Process",
+        "name" : "namenode_process",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "default_port" : 50070.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "{{hdfs-site/dfs.namenode.http-address}}"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/28",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 28,
+        "interval" : 2,
+        "label" : "HDFS Capacity Utilization",
+        "name" : "namenode_hdfs_capacity_utilization",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "Hadoop:service=NameNode,name=FSNamesystemState/CapacityUsed",
+              "Hadoop:service=NameNode,name=FSNamesystemState/CapacityRemaining"
+            ],
+            "value" : "{0}/({0} + {1}) * 100"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "Capacity Used:[{2:d}%, {0}], Capacity Remaining:[{1}]"
+            },
+            "warning" : {
+              "text" : "Capacity Used:[{2:d}%, {0}], Capacity Remaining:[{1}]",
+              "value" : 80.0
+            },
+            "critical" : {
+              "text" : "Capacity Used:[{2:d}%, {0}], Capacity Remaining:[{1}]",
+              "value" : 90.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.namenode.http-address}}",
+            "https" : "{{hdfs-site/dfs.namenode.https-address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/29",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 29,
+        "interval" : 1,
+        "label" : "NameNode Last Checkpoint",
+        "name" : "namenode_last_checkpoint",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "path" : "HDP/2.0.6/services/HDFS/package/files/alert_checkpoint_time.py",
+          "type" : "SCRIPT"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/30",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "JOURNALNODE",
+        "enabled" : true,
+        "id" : 30,
+        "interval" : 1,
+        "label" : "JournalNode Process",
+        "name" : "journalnode_process",
+        "scope" : "HOST",
+        "service_name" : "HDFS",
+        "source" : {
+          "default_port" : 8480.0,
+          "reporting" : {
+            "ok" : {
+              "text" : "TCP OK - {0:.4f} response on port {1}"
+            },
+            "critical" : {
+              "text" : "Connection failed: {0} to {1}:{2}"
+            }
+          },
+          "type" : "PORT",
+          "uri" : "{{hdfs-site/dfs.journalnode.http-address}}"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/31",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "NAMENODE",
+        "enabled" : true,
+        "id" : 31,
+        "interval" : 1,
+        "label" : "NameNode Directory Status",
+        "name" : "namenode_directory_status",
+        "scope" : "ANY",
+        "service_name" : "HDFS",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "Hadoop:service=NameNode,name=NameNodeInfo/NameDirStatuses"
+            ],
+            "value" : "calculate(args)\ndef calculate(args):\n  import json\n  json_statuses = json.loads({0})\n  return len(json_statuses['failed']) if 'failed' in json_statuses else 0"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "Directories are healthy"
+            },
+            "warning" : {
+              "text" : "Failed directory count: {1}",
+              "value" : 1.0
+            },
+            "critical" : {
+              "text" : "Failed directory count: {1}",
+              "value" : 1.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.namenode.http-address}}",
+            "https" : "{{hdfs-site/dfs.namenode.https-address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/32",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "DATANODE",
+        "enabled" : true,
+        "id" : 32,
+        "interval" : 2,
+        "label" : "DataNode Storage",
+        "name" : "datanode_storage",
+        "scope" : "HOST",
+        "service_name" : "HDFS",
+        "source" : {
+          "jmx" : {
+            "property_list" : [
+              "Hadoop:service=DataNode,name=FSDatasetState-*/Remaining",
+              "Hadoop:service=DataNode,name=FSDatasetState-*/Capacity"
+            ],
+            "value" : "({1} - {0})/{1} * 100"
+          },
+          "reporting" : {
+            "ok" : {
+              "text" : "Remaining Capacity:[{0}], Total Capacity:[{2:d}% Used, {1}]"
+            },
+            "warning" : {
+              "text" : "Remaining Capacity:[{0}], Total Capacity:[{2:d}% Used, {1}]",
+              "value" : 80.0
+            },
+            "critical" : {
+              "text" : "Remaining Capacity:[{0}], Total Capacity:[{2:d}% Used, {1}]",
+              "value" : 90.0
+            }
+          },
+          "type" : "METRIC",
+          "uri" : {
+            "http" : "{{hdfs-site/dfs.datanode.http.address}}",
+            "https" : "{{hdfs-site/dfs.datanode.https.address}}",
+            "https_property" : "{{hdfs-site/dfs.http.policy}}",
+            "https_property_value" : "HTTPS_ONLY",
+            "default_port" : 0.0
+          }
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/33",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : null,
+        "enabled" : true,
+        "id" : 33,
+        "interval" : 1,
+        "label" : "Percent DataNodes With Available Space",
+        "name" : "datanode_storage_percent",
+        "scope" : "SERVICE",
+        "service_name" : "HDFS",
+        "source" : {
+          "alert_name" : "datanode_storage",
+          "reporting" : {
+            "ok" : {
+              "text" : "affected: [{1}], total: [{0}]"
+            },
+            "warning" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.1
+            },
+            "critical" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.3
+            }
+          },
+          "type" : "AGGREGATE"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/34",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : null,
+        "enabled" : true,
+        "id" : 34,
+        "interval" : 1,
+        "label" : "Percent JournalNodes Available",
+        "name" : "journalnode_process_percent",
+        "scope" : "SERVICE",
+        "service_name" : "HDFS",
+        "source" : {
+          "alert_name" : "journalnode_process",
+          "reporting" : {
+            "ok" : {
+              "text" : "affected: [{1}], total: [{0}]"
+            },
+            "warning" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.33
+            },
+            "critical" : {
+              "text" : "affected: [{1}], total: [{0}]",
+              "value" : 0.5
+            }
+          },
+          "type" : "AGGREGATE"
+        }
+      }
+    },
+    {
+      "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/c/alert_definitions/35",
+      "AlertDefinition" : {
+        "cluster_name" : "c",
+        "component_name" : "AMBARI_AGENT",
+        "enabled" : true,
+        "id" : 35,
+        "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"
+        }
+      }
+    }
+  ]
+}

+ 1 - 0
ambari-web/app/config.js

@@ -34,6 +34,7 @@ App.maxRetries = 3; // max number of retries for certain AJAX calls
 App.bgOperationsUpdateInterval = 6000;
 App.componentsUpdateInterval = 6000;
 App.contentUpdateInterval = 15000;
+App.alertDefinitionsUpdateInterval = 10000;
 App.maxRunsForAppBrowser = 500;
 App.pageReloadTime=3600000;
 App.singleNodeInstall = false;

+ 9 - 3
ambari-web/app/controllers/global/cluster_controller.js

@@ -79,7 +79,8 @@ App.ClusterController = Em.Controller.extend({
     'clusterStatus': false,
     'racks': false,
     'componentConfigs': false,
-    'componentsState': false
+    'componentsState': false,
+    'alertDefinitions': false
   }),
 
   /**
@@ -303,12 +304,13 @@ App.ClusterController = Em.Controller.extend({
      * 8. load hosts to model
      * 9. load services from cache with metrics to model
      * 10. update stale_configs of host-components (depends on App.supports.hostOverrides)
+     * 11. load alert definitions to model
      */
     this.loadStackServiceComponents(function (data) {
-      data.items.forEach(function(service) {
+      data.items.forEach(function (service) {
         service.StackServices.is_selected = true;
         service.StackServices.is_installed = false;
-      },this);
+      }, this);
       App.stackServiceMapper.mapStackServices(data);
       App.config.setPreDefinedServiceConfigs();
       var updater = App.router.get('updateController');
@@ -329,6 +331,10 @@ App.ClusterController = Em.Controller.extend({
             self.updateLoadStatus('componentsState');
           });
           self.updateLoadStatus('serviceMetrics');
+
+          updater.updateAlertDefinitions(function () {
+            self.updateLoadStatus('alertDefinitions');
+          });
         });
       });
     });

+ 10 - 0
ambari-web/app/controllers/global/update_controller.js

@@ -128,6 +128,7 @@ App.UpdateController = Em.Controller.extend({
       App.updater.run(this, 'updateComponentsState', 'isWorking', App.componentsUpdateInterval);
       App.updater.run(this, 'graphsUpdate', 'isWorking');
       App.updater.run(this, 'updateComponentConfig', 'isWorking');
+      App.updater.run(this, 'updateAlertDefinitions', 'isWorking', App.alertDefinitionsUpdateInterval);
     }
   }.observes('isWorking'),
   /**
@@ -443,5 +444,14 @@ App.UpdateController = Em.Controller.extend({
     App.HttpClient.get(url, App.componentsStateMapper, {
       complete: callback
     });
+  },
+  updateAlertDefinitions: function (callback) {
+    var testUrl = '/data/alerts/alertDefinitions.json';
+    var realUrl = '/alert_definitions?fields=*';
+    var url = this.getUrl(testUrl, realUrl);
+
+    App.HttpClient.get(url, App.alertDefinitionsMapper, {
+      complete: callback
+    });
   }
 });

+ 2 - 1
ambari-web/app/mappers.js

@@ -32,4 +32,5 @@ require('mappers/target_cluster_mapper');
 require('mappers/dataset_mapper');
 require('mappers/component_config_mapper');
 require('mappers/components_state_mapper');
-require('mappers/service_config_version_mapper');
+require('mappers/service_config_version_mapper');
+require('mappers/alert_definitions_mapper');

+ 168 - 0
ambari-web/app/mappers/alert_definitions_mapper.js

@@ -0,0 +1,168 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+
+var stringUtils = require('utils/string_utils');
+
+App.alertDefinitionsMapper = App.QuickDataMapper.create({
+
+  model: App.AlertDefinition,
+  reportModel: App.AlertReportDefinition,
+  metricsSourceModel: App.AlertMetricsSourceDefinition,
+  metricsUriModel: App.AlertMetricsUriDefinition,
+
+  config: {
+    id: 'AlertDefinition.id',
+    name: 'AlertDefinition.name',
+    label: 'AlertDefinition.label',
+    service_id: 'AlertDefinition.service_name',
+    component_name: 'AlertDefinition.component_name',
+    enabled: 'AlertDefinition.enabled',
+    scope: 'AlertDefinition.scope',
+    interval: 'AlertDefinition.interval',
+    type: 'AlertDefinition.source.type',
+    reporting_key: 'reporting',
+    reporting_type: 'array',
+    reporting: {
+      item: 'id'
+    }
+  },
+
+  portConfig: {
+    default_port: 'AlertDefinition.source.default_port',
+    uri: 'AlertDefinition.source.uri'
+  },
+
+  aggregateConfig: {
+    alert_name: 'AlertDefinition.source.alert_name'
+  },
+
+  scriptConfig: {
+    location: 'AlertDefinition.source.path'
+  },
+
+  uriConfig: {
+    id: 'AlertDefinition.source.uri.id',
+    http: 'AlertDefinition.source.uri.http',
+    https: 'AlertDefinition.source.uri.https',
+    https_property: 'AlertDefinition.source.uri.https_property',
+    https_property_value: 'AlertDefinition.source.uri.https_property_value'
+  },
+
+  map: function (json) {
+    if (json && json.items) {
+
+      var portAlertDefinitions = [];
+      var metricsAlertDefinitions = [];
+      var webAlertDefinitions = [];
+      var aggregateAlertDefinitions = [];
+      var scriptAlertDefinitions = [];
+      var alertReportDefinitions = [];
+      var alertMetricsSourceDefinitions = [];
+      var alertMetricsUriDefinitions = [];
+
+      json.items.forEach(function (item) {
+        var convertedReportDefinitions = [];
+        var reporting = item.AlertDefinition.source.reporting;
+        for (var report in reporting) {
+          if (reporting.hasOwnProperty(report)) {
+            convertedReportDefinitions.push({
+              id: item.AlertDefinition.id + report,
+              type: report,
+              text: reporting[report].text,
+              value: reporting[report].value
+            });
+          }
+        }
+
+        alertReportDefinitions = alertReportDefinitions.concat(convertedReportDefinitions);
+        item.reporting = convertedReportDefinitions;
+        var alertDefinition = this.parseIt(item, this.get('config'));
+
+        // map properties dependent on Alert Definition type
+        switch (item.AlertDefinition.source.type) {
+          case 'PORT':
+            portAlertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('portConfig'))));
+            break;
+          case 'METRIC':
+            // map App.AlertMetricsSourceDefinition's
+            var jmxMetric = item.AlertDefinition.source.jmx;
+            var gangliaMetric = item.AlertDefinition.source.ganglia;
+            if (jmxMetric) {
+              alertReportDefinitions.jmx_id = item.AlertDefinition.id + 'jmx';
+              alertMetricsSourceDefinitions.push({
+                id: item.AlertDefinition.id + 'jmx',
+                value: jmxMetric.value
+              });
+            }
+            if (gangliaMetric) {
+              alertReportDefinitions.ganglia_id = item.AlertDefinition.id + 'ganglia';
+              alertMetricsSourceDefinitions.push({
+                id: alertReportDefinitions.ganglia_id,
+                value: gangliaMetric.value
+              });
+            }
+
+            // map App.AlertMetricsUriDefinition
+            alertDefinition.uri_id = item.AlertDefinition.id + 'uri';
+            item.AlertDefinition.source.uri.id = alertDefinition.uri_id;
+            alertMetricsUriDefinitions.push(this.parseIt(item, this.get('uriConfig')));
+            metricsAlertDefinitions.push(alertDefinition);
+            break;
+          case 'WEB':
+            // map App.AlertMetricsUriDefinition
+            alertDefinition.uri_id = item.AlertDefinition.id + 'uri';
+            item.AlertDefinition.source.uri.id = alertDefinition.uri_id;
+            alertMetricsUriDefinitions.push(this.parseIt(item, this.get('uriConfig')));
+            webAlertDefinitions.push(alertDefinition);
+            break;
+          case 'AGGREGATE':
+            aggregateAlertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('aggregateConfig'))));
+            break;
+          case 'SCRIPT':
+            scriptAlertDefinitions.push($.extend(alertDefinition, this.parseIt(item, this.get('scriptConfig'))));
+            break;
+          default:
+            console.error('Incorrect Alert Definition type:', item.AlertDefinition);
+        }
+      }, this);
+
+      // load all mapped data to model
+      App.store.loadMany(this.get('reportModel'), alertReportDefinitions);
+      App.store.loadMany(this.get('metricsSourceModel'), alertMetricsSourceDefinitions);
+      this.setMetricsSourcePropertyLists(this.get('metricsSourceModel'), alertMetricsSourceDefinitions);
+      App.store.loadMany(this.get('metricsUriModel'), alertMetricsUriDefinitions);
+      App.store.loadMany(App.PortAlertDefinition, portAlertDefinitions);
+      App.store.loadMany(App.MetricsAlertDefinition, metricsAlertDefinitions);
+      App.store.loadMany(App.WebAlertDefinition, webAlertDefinitions);
+      App.store.loadMany(App.AggregateAlertDefinition, aggregateAlertDefinitions);
+      App.store.loadMany(App.ScriptAlertDefinition, scriptAlertDefinitions);
+    }
+  },
+
+  /**
+   * set propertyList properties from <code>data</code> for records in <code>model</code>
+   * @param model
+   * @param data
+   */
+  setMetricsSourcePropertyLists: function (model, data) {
+    data.forEach(function (record) {
+      model.find().findProperty('id', record.id).set('propertyList', record.property_list);
+    });
+  }
+});

+ 16 - 6
ambari-web/app/models/alertDefinition.js

@@ -22,7 +22,7 @@ App.AlertDefinition = DS.Model.extend({
 
   name: DS.attr('string'),
   label: DS.attr('string'),
-  serviceName: DS.attr('string'),
+  service: DS.belongsTo('App.Service'),
   componentName: DS.attr('string'),
   enabled: DS.attr('boolean'),
   scope: DS.attr('string'),
@@ -42,11 +42,6 @@ App.AlertMetricsSourceDefinition = DS.Model.extend({
   value: DS.attr('string')
 });
 
-App.PortAlertDefinition = App.AlertDefinition.extend({
-  defaultPort: DS.attr('number'),
-  uri: DS.attr('string')
-});
-
 App.AlertMetricsUriDefinition = DS.Model.extend({
   http: DS.attr('string'),
   https: DS.attr('string'),
@@ -54,6 +49,11 @@ App.AlertMetricsUriDefinition = DS.Model.extend({
   httpsPropertyValue: DS.attr('string')
 });
 
+App.PortAlertDefinition = App.AlertDefinition.extend({
+  defaultPort: DS.attr('number'),
+  uri: DS.attr('string')
+});
+
 App.MetricsAlertDefinition = App.AlertDefinition.extend({
   jmx: DS.belongsTo('App.AlertMetricsSourceDefinition'),
   ganglia: DS.belongsTo('App.AlertMetricsSourceDefinition'),
@@ -71,3 +71,13 @@ App.AggregateAlertDefinition = App.AlertDefinition.extend({
 App.ScriptAlertDefinition = App.AlertDefinition.extend({
   location: DS.attr('string')
 });
+
+App.AlertDefinition.FIXTURES = [];
+App.AlertReportDefinition.FIXTURES = [];
+App.AlertMetricsSourceDefinition.FIXTURES = [];
+App.PortAlertDefinition.FIXTURES = [];
+App.AlertMetricsUriDefinition.FIXTURES = [];
+App.MetricsAlertDefinition.FIXTURES = [];
+App.WebAlertDefinition.FIXTURES = [];
+App.AggregateAlertDefinition.FIXTURES = [];
+App.ScriptAlertDefinition.FIXTURES = [];

+ 1 - 1
ambari-web/app/utils/ajax/ajax.js

@@ -431,7 +431,7 @@ var urls = {
         data : JSON.stringify({
           RequestInfo: {
             'context': data.context,
-            'command': data.command,
+            'command': data.command
           },
           "Requests/resource_filters": [{"service_name" : data.serviceName, "component_name" : data.componentName, 'hosts': data.hosts}]
         })

+ 1 - 1
ambari-web/test/controllers/global/update_controller_test.js

@@ -62,7 +62,7 @@ describe('App.UpdateController', function () {
 
     it('isWorking = true', function () {
       controller.set('isWorking', true);
-      expect(App.updater.run.callCount).to.equal(6);
+      expect(App.updater.run.callCount).to.equal(7);
     });
   });