Author: yusaku
Date: Fri Jan 25 02:11:00 2013
New Revision: 1438294

URL: http://svn.apache.org/viewvc?rev=1438294&view=rev
Log:
AMBARI-1252. Fetch Nagios alerts through Ambari Server and not directly from 
Nagios Server. (srimanth via yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/assets/data/alerts/alerts.json
    
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
    incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1438294&r1=1438293&r2=1438294&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Fri Jan 25 02:11:00 2013
@@ -12,7 +12,11 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-1252. Fetch Nagios alerts through Ambari Server and not directly
+ from Nagios Server. (srimanth via yusaku)
+
  AMBARI-1237. Expose Nagios alerts via Rest API. (Nate Cole via jspeidel)
+
  AMBARI-1163. During agent registration and heartbeat, send information about
  various hadoop artifacts back to Ambari. (Nate Cole via mahadev)
 

Modified: incubator/ambari/trunk/ambari-web/app/assets/data/alerts/alerts.json
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/assets/data/alerts/alerts.json?rev=1438294&r1=1438293&r2=1438294&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/assets/data/alerts/alerts.json 
(original)
+++ incubator/ambari/trunk/ambari-web/app/assets/data/alerts/alerts.json Fri 
Jan 25 02:11:00 2013
@@ -1,426 +1,17 @@
-{"alerts": [
-  {
-    "service_description": "Process down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.001 second response time on port 50010",
-    "last_hard_state_change": "1350378326",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878529",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878529",
-    "service_type": "UNKNOWN"
-  },
-  {
-    "service_description": "Storage full",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: Capacity:[], Remaining Capacity:[], 
percent_full:[0]",
-    "last_hard_state_change": "1350378331",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878395",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878395",
-    "service_type": "UNKNOWN"
-  },
-  {
-    "service_description": "Ganglia [gmetad] Process down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.001 second response time on port 8651",
-    "last_hard_state_change": "1350378335",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878575",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878575",
-    "service_type": "UNKNOWN"
-  },
-  {
-    "service_description": "Ganglia collector [gmond] Process down alert for 
jobtracker",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.003 second response time on port 8662",
-    "last_hard_state_change": "1350378340",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878575",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878575",
-    "service_type": "UNKNOWN"
-  },
-  {
-    "service_description": "Ganglia collector [gmond] Process down alert for 
namenode",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.003 second response time on port 8661",
-    "last_hard_state_change": "1350378344",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878575",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878575",
-    "service_type": "UNKNOWN"
-  },
-  {
-    "service_description": "Ganglia collector [gmond] Process down alert for 
slaves",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.004 second response time on port 8660",
-    "last_hard_state_change": "1350378349",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878575",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878575",
-    "service_type": "UNKNOWN"
-  },
-  {
-    "service_description": "Corrupt\/Missing blocks",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: corrupt_blocks:<0>, missing_blocks:<0>, 
total_blocks:<135>",
-    "last_hard_state_change": "1350933589",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878469",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "1350933469",
-    "is_flapping": "0",
-    "last_check": "1351878469",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "HDFS Capacity utilization",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: DFSUsedGB:<0>, DFSTotalGB:<784.3>",
-    "last_hard_state_change": "1350378358",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878395",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878395",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Namenode RPC Latency",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: RpcQueueTime_avg_time:<0> Secs, 
RpcProcessingTime_avg_time:<0> Secs",
-    "last_hard_state_change": "1350378362",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878395",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878395",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Percent DataNodes down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: total:<1>, affected:<0>",
-    "last_hard_state_change": "1350378367",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878560",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878560",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Percent DataNodes storage full",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: total:<1>, affected:<0>",
-    "last_hard_state_change": "1350378371",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878469",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878469",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "JobHistory Web UI down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: Successfully accessed jobhistory Web UI",
-    "last_hard_state_change": "1350378376",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878529",
-    "last_time_warning": "1351216729",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878529",
-    "service_type": "MAPREDUCE"
-  },
-  {
-    "service_description": "JobTracker Web UI down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: Successfully accessed jobtracker Web UI",
-    "last_hard_state_change": "1350378380",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878529",
-    "last_time_warning": "1351216729",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878529",
-    "service_type": "MAPREDUCE"
-  },
-  {
-    "service_description": "Jobtracker CPU utilization",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "2 CPU, average load 3.0% < 200% : OK",
-    "last_hard_state_change": "1350378385",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878395",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878395",
-    "service_type": "MAPREDUCE"
-  },
-  {
-    "service_description": "Jobtracker Process down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.003 second response time on port 50030",
-    "last_hard_state_change": "1351216775",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878575",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "1351216745",
-    "is_flapping": "0",
-    "last_check": "1351878575",
-    "service_type": "MAPREDUCE"
-  },
-  {
-    "service_description": "JobTracker RPC Latency",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: RpcQueueTime_avg_time:<0> Secs, 
RpcProcessingTime_avg_time:<0.06> Secs",
-    "last_hard_state_change": "1350378394",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878395",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878395",
-    "service_type": "MAPREDUCE"
-  },
-  {
-    "service_description": "Percent TaskTrackers down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: total:<1>, affected:<0>",
-    "last_hard_state_change": "1351216880",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878560",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "1351216850",
-    "is_flapping": "0",
-    "last_check": "1351878560",
-    "service_type": "MAPREDUCE"
-  },
-  {
-    "service_description": "Nagios status log staleness",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "NAGIOS OK: 2 processes, status log updated 9 seconds 
ago",
-    "last_hard_state_change": "1350937033",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878433",
-    "last_time_warning": "1350936733",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878433",
-    "service_type": "UNKNOWN"
-  },
-  {
-    "service_description": "Namenode Edit logs directory status",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: All Namenode directories are active",
-    "last_hard_state_change": "1350378408",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878560",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878560",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Namenode Host CPU utilization",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "2 CPU, average load 3.0% < 200% : OK",
-    "last_hard_state_change": "1350378412",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878412",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878412",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Namenode Process down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.000 second response time on port 8020",
-    "last_hard_state_change": "1350378417",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878559",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878559",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Namenode Web UI down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: Successfully accessed namenode Web UI",
-    "last_hard_state_change": "1350378421",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878529",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878529",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Secondary Namenode Process down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.001 second response time on port 50090",
-    "last_hard_state_change": "1350378426",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878560",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878560",
-    "service_type": "HDFS"
-  },
-  {
-    "service_description": "Oozie status check",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "OK: Oozie server status [System mode: NORMAL]",
-    "last_hard_state_change": "1351217029",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878529",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "1351216969",
-    "is_flapping": "0",
-    "last_check": "1351878529",
-    "service_type": "OOZIE"
-  },
-  {
-    "service_description": "Puppet agent down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.001 second response time on port 8139",
-    "last_hard_state_change": "1350378435",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878529",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "0",
-    "is_flapping": "0",
-    "last_check": "1351878529",
-    "service_type": "PUPPET"
-  },
-  {
-    "service_description": "Process down",
-    "host_name": "host",
-    "current_attempt": "1",
-    "current_state": "0",
-    "plugin_output": "TCP OK - 0.000 second response time on port 50060",
-    "last_hard_state_change": "1351216849",
-    "last_hard_state": "0",
-    "last_time_ok": "1351878529",
-    "last_time_warning": "0",
-    "last_time_unknown": "0",
-    "last_time_critical": "1351216789",
-    "is_flapping": "0",
-    "last_check": "1351878529",
-    "service_type": "UNKNOWN"
-  }
-], "hostcounts": {
-  "up_hosts": 1,
-  "down_hosts": 0
-}, "servicestates": {
-  "PUPPET": 0,
-  "MAPREDUCE": "0",
-  "HDFS": "0",
-  "OOZIE": "0"
-}}
+{
+  "href" : 
"http://ec2-54-234-53-225.compute-1.amazonaws.com:8080/api/v1/clusters/yusaku/host_components?HostRoles/component_name=NAGIOS_SERVER&fields=HostRoles/nagios_alerts";,
+  "items" : [
+    {
+      "href" : 
"http://ec2-54-234-53-225.compute-1.amazonaws.com:8080/api/v1/clusters/yusaku/hosts/ip-10-114-35-111.ec2.internal/host_components/NAGIOS_SERVER";,
+      "HostRoles" : {
+        "cluster_name" : "yusaku",
+        "nagios_alerts" : "{\"alerts\":[{\"service_description\":\"Ganglia 
[gmetad] Process 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.004 second response time on port 
8651\",\"last_hard_state_change\":\"1359058506\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072006\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072006\",\"service_type\":\"GANGLIA\"},{\"service_description\":\"Ganglia
 collector [gmond] Process down alert for 
hbasemaster\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.009 second response time on port 
8663\",\"last_hard_state_change\":\"1359058517\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072002\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapp
 
ing\":\"0\",\"last_check\":\"1359072002\",\"service_type\":\"GANGLIA\"},{\"service_description\":\"Ganglia
 collector [gmond] Process down alert for 
jobtracker\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.009 second response time on port 
8662\",\"last_hard_state_change\":\"1359058528\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072013\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072013\",\"service_type\":\"GANGLIA\"},{\"service_description\":\"Ganglia
 collector [gmond] Process down alert for 
namenode\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.004 second response time on port 
8661\",\"last_hard_state_change\":\"1359058540\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072010\",\"last_time_warning\":\"0\",\"last_t
 
ime_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072010\",\"service_type\":\"GANGLIA\"},{\"service_description\":\"Ganglia
 collector [gmond] Process down alert for 
slaves\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.009 second response time on port 
8660\",\"last_hard_state_change\":\"1359058551\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072006\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072006\",\"service_type\":\"GANGLIA\"},{\"service_description\":\"Percent
 region servers 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 total:<1>, 
affected:<0>\",\"last_hard_state_change\":\"1359058802\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072002\",\"last_time_warning\
 
":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058772\",\"is_flapping\":\"0\",\"last_check\":\"1359072002\",\"service_type\":\"HBASE\"},{\"service_description\":\"HBase
 Web UI 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 Successfully accessed hbase Web 
UI\",\"last_hard_state_change\":\"1359058574\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072014\",\"last_time_warning\":\"1359058634\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072014\",\"service_type\":\"HBASE\"},{\"service_description\":\"HBaseMaster
 CPU 
utilization\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"2
 CPU, average load 14.0% < 200% : 
OK\",\"last_hard_state_change\":\"1359058585\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071785\",\"last_time_warning\":\"0\",\"last_ti
 
me_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071785\",\"service_type\":\"HBASE\"},{\"service_description\":\"HBaseMaster
 Process 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.000 second response time on port 
60000\",\"last_hard_state_change\":\"1359058596\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071991\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058626\",\"is_flapping\":\"0\",\"last_check\":\"1359071991\",\"service_type\":\"HBASE\"},{\"service_description\":\"Corrupt\\/Missing
 
blocks\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 corrupt_blocks:<0>, missing_blocks:<0>, 
total_blocks:<249>\",\"last_hard_state_change\":\"1359058509\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071949\",\"last_t
 
ime_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071949\",\"service_type\":\"HDFS\"},{\"service_description\":\"HDFS
 Capacity 
utilization\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 DFSUsedGB:<0.1>, 
DFSTotalGB:<784.4>\",\"last_hard_state_change\":\"1359058520\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071720\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071720\",\"service_type\":\"HDFS\"},{\"service_description\":\"Namenode
 RPC 
Latency\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 RpcQueueTime_avg_time:<0> Secs, RpcProcessingTime_avg_time:<0> 
Secs\",\"last_hard_state_change\":\"1359058531\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1
 
359071731\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071731\",\"service_type\":\"HDFS\"},{\"service_description\":\"Percent
 DataNodes 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 total:<1>, 
affected:<0>\",\"last_hard_state_change\":\"1359058543\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072013\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072013\",\"service_type\":\"HDFS\"},{\"service_description\":\"Percent
 DataNodes storage 
full\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 total:<1>, 
affected:<0>\",\"last_hard_state_change\":\"1359058554\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071994\",\"last_time_warni
 
ng\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071994\",\"service_type\":\"HDFS\"},{\"service_description\":\"Percent
 TaskTrackers 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 total:<1>, 
affected:<0>\",\"last_hard_state_change\":\"1359058745\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072005\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058715\",\"is_flapping\":\"0\",\"last_check\":\"1359072005\",\"service_type\":\"MAPREDUCE\"},{\"service_description\":\"Nagios
 status log 
staleness\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"NAGIOS
 OK: 2 processes, status log updated 9 seconds 
ago\",\"last_hard_state_change\":\"1359058576\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071776\",\"last_time_war
 
ning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071776\",\"service_type\":\"UNKNOWN\"},{\"service_description\":\"Namenode
 Edit logs directory 
status\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 All Namenode directories are 
active\",\"last_hard_state_change\":\"1359058588\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071998\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071998\",\"service_type\":\"HDFS\"},{\"service_description\":\"Namenode
 Host CPU 
utilization\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"2
 CPU, average load 14.5% < 200% : 
OK\",\"last_hard_state_change\":\"1359058599\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071799\",\"last_time_warning\":\"0\",
 
\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071799\",\"service_type\":\"HDFS\"},{\"service_description\":\"Namenode
 Process 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.001 second response time on port 
8020\",\"last_hard_state_change\":\"1359058511\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071996\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058511\",\"is_flapping\":\"0\",\"last_check\":\"1359071996\",\"service_type\":\"HDFS\"},{\"service_description\":\"Namenode
 Web UI 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 Successfully accessed namenode Web 
UI\",\"last_hard_state_change\":\"1359058523\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071963\",\"last_time_warning\":\"0\",\"last_time_unknown\
 
":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071963\",\"service_type\":\"HDFS\"},{\"service_description\":\"ZKSERVERS
 Process 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.003 second response time on port 
2181\",\"last_hard_state_change\":\"1359058654\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071974\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058594\",\"is_flapping\":\"0\",\"last_check\":\"1359071974\",\"service_type\":\"UNKNOWN\"},{\"service_description\":\"Percent
 zookeeper servers 
down\",\"host_name\":\"ip-10-114-35-111.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 total:<3>, 
affected:<0>\",\"last_hard_state_change\":\"1359058545\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072015\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",
 
\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072015\",\"service_type\":\"ZOOKEEPER\"},{\"service_description\":\"HIVE-METASTORE
 status 
check\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 Hive metaserver status 
OK\",\"last_hard_state_change\":\"1359058677\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071997\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058647\",\"is_flapping\":\"0\",\"last_check\":\"1359071997\",\"service_type\":\"HIVE\"},{\"service_description\":\"JobHistory
 Web UI 
down\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 Successfully accessed jobhistory Web 
UI\",\"last_hard_state_change\":\"1359058568\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072008\",\"last_time_warning\":\"1359058628\",\"last_time_unknown\":\"0\",\"last_time_cri
 
tical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072008\",\"service_type\":\"MAPREDUCE\"},{\"service_description\":\"JobTracker
 Web UI 
down\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 Successfully accessed jobtracker Web 
UI\",\"last_hard_state_change\":\"1359058579\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071959\",\"last_time_warning\":\"1359058639\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071959\",\"service_type\":\"MAPREDUCE\"},{\"service_description\":\"Jobtracker
 CPU 
utilization\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"2
 CPU, average load 2.5% < 200% : 
OK\",\"last_hard_state_change\":\"1359058591\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071791\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"
 
0\",\"is_flapping\":\"0\",\"last_check\":\"1359071791\",\"service_type\":\"MAPREDUCE\"},{\"service_description\":\"Jobtracker
 Process 
down\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.064 second response time on port 
50030\",\"last_hard_state_change\":\"1359058677\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071997\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058647\",\"is_flapping\":\"0\",\"last_check\":\"1359071997\",\"service_type\":\"MAPREDUCE\"},{\"service_description\":\"JobTracker
 RPC 
Latency\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 RpcQueueTime_avg_time:<0.2> Secs, 
RpcProcessingTime_avg_time:<0.24> 
Secs\",\"last_hard_state_change\":\"1359058514\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072014\",\"last_time_warning\":\"0\",\"last_time
 
_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072014\",\"service_type\":\"MAPREDUCE\"},{\"service_description\":\"Oozie
 status 
check\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 Oozie server status [System mode: 
NORMAL]\",\"last_hard_state_change\":\"1359058826\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071966\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058766\",\"is_flapping\":\"0\",\"last_check\":\"1359071966\",\"service_type\":\"OOZIE\"},{\"service_description\":\"WEBHCAT
 status 
check\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"\",\"last_hard_state_change\":\"1359058897\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071977\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058837\",\"is_f
 
lapping\":\"\",\"last_check\":\"\",\"service_type\":\"WEBHCAT\"},{\"service_description\":\"ZKSERVERS
 Process 
down\",\"host_name\":\"ip-10-12-194-214.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.001 second response time on port 
2181\",\"last_hard_state_change\":\"1359058548\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071988\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071988\",\"service_type\":\"UNKNOWN\"},{\"service_description\":\"ZKSERVERS
 Process 
down\",\"host_name\":\"ip-10-204-141-167.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.031 second response time on port 
2181\",\"last_hard_state_change\":\"1359058559\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071999\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_
 
check\":\"1359071999\",\"service_type\":\"UNKNOWN\"},{\"service_description\":\"Process
 
down\",\"host_name\":\"ip-10-80-69-221.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.127 second response time on port 
50010\",\"last_hard_state_change\":\"1359058571\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359072011\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359072011\",\"service_type\":\"UNKNOWN\"},{\"service_description\":\"Storage
 
full\",\"host_name\":\"ip-10-80-69-221.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"OK:
 Capacity:[], Remaining Capacity:[], 
percent_full:[0]\",\"last_hard_state_change\":\"1359058582\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071782\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"0\",\"is_flapping\":\"0\",\"last_check\":\"1359071782\",\"s
 ervice_type\":\"UNKNOWN\"},{\"service_description\":\"Process 
down\",\"host_name\":\"ip-10-80-69-221.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.001 second response time on port 
60020\",\"last_hard_state_change\":\"1359058773\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071973\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058713\",\"is_flapping\":\"0\",\"last_check\":\"1359071973\",\"service_type\":\"UNKNOWN\"},{\"service_description\":\"Process
 
down\",\"host_name\":\"ip-10-80-69-221.ec2.internal\",\"current_attempt\":\"1\",\"current_state\":\"0\",\"plugin_output\":\"TCP
 OK - 0.001 second response time on port 
50060\",\"last_hard_state_change\":\"1359058725\",\"last_hard_state\":\"0\",\"last_time_ok\":\"1359071985\",\"last_time_warning\":\"0\",\"last_time_unknown\":\"0\",\"last_time_critical\":\"1359058665\",\"is_flapping\":\"0\",\"last_check\":\"1359071985\",\"service_type\":\
 
"UNKNOWN\"}],\"hostcounts\":{\"up_hosts\":4,\"down_hosts\":0},\"servicestates\":{\"PUPPET\":0,\"HBASE\":\"0\",\"HDFS\":\"0\",\"ZOOKEEPER\":0,\"HIVE-METASTORE\":\"0\",\"MAPREDUCE\":\"0\",\"OOZIE\":\"0\"}}",
+        "component_name" : "NAGIOS_SERVER",
+        "host_name" : "ip-10-114-35-111.ec2.internal"
+      },
+      "host" : {
+        "href" : 
"http://ec2-54-234-53-225.compute-1.amazonaws.com:8080/api/v1/clusters/yusaku/hosts/ip-10-114-35-111.ec2.internal";
+      }
+    }
+  ]
+}
\ No newline at end of file

Modified: 
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js?rev=1438294&r1=1438293&r2=1438294&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js 
(original)
+++ 
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js 
Fri Jan 25 02:11:00 2013
@@ -210,10 +210,9 @@ App.ClusterController = Em.Controller.ex
       if (lastSlash > -1) {
         nagiosUrl = nagiosUrl.substring(0, lastSlash);
       }
-      var dataUrl;
+      var dataUrl = this.getUrl('/data/alerts/alerts.json', 
'/host_components?HostRoles/component_name=NAGIOS_SERVER&fields=HostRoles/nagios_alerts');
       var ajaxOptions = {
-        dataType:"jsonp",
-        jsonp:"jsonp",
+        dataType:"json",
         context:this,
         complete:function (jqXHR, textStatus) {
           this.updateLoadStatus('alerts');
@@ -224,12 +223,6 @@ App.ClusterController = Em.Controller.ex
           console.log('Nagios $.ajax() response:', error);
         }
       };
-      if (App.testMode) {
-        dataUrl = "/data/alerts/alerts.jsonp";
-        ajaxOptions.jsonpCallback = 
"jQuery172040994187095202506_1352498338217";
-      } else {
-        dataUrl = nagiosUrl + 
"/hdp/nagios/nagios_alerts.php?q1=alerts&alert_type=all";
-      }
       App.HttpClient.get(dataUrl, App.alertsMapper, ajaxOptions);
     } else {
       this.updateLoadStatus('alerts');

Modified: incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js?rev=1438294&r1=1438293&r2=1438294&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/alerts_mapper.js Fri Jan 25 
02:11:00 2013
@@ -41,26 +41,28 @@ App.alertsMapper = App.QuickDataMapper.c
     if (!this.get('model')) {
       return;
     }
-    if (json.alerts) {
+    if (json && json.items && json.items.length>0 && json.items[0].HostRoles 
&& json.items[0].HostRoles.nagios_alerts) {
+      var alertsString = json.items[0].HostRoles.nagios_alerts;
+      var alerts = jQuery.parseJSON(alertsString).alerts;
       if (App.Alert.find().content.length > 0) {
-        this.update(json);
+        this.update(alerts);
       } else {
         var result = [];
-        json.alerts.forEach(function (item) {
+        alerts.forEach(function (item) {
           result.push(this.parseIt(item, this.config));
         }, this);
         App.store.loadMany(this.get('model'), result);
       }
     }
   },
-  update: function(json){
+  update: function(alerts){
     var alertsList = App.Alert.find();
     var titleToAlertMap = {};
     alertsList.forEach(function(alert){
       titleToAlertMap[alert.get('serviceType') + alert.get('title') + 
alert.get('message')] = alert;
     });
     var newRecords = [];
-    json.alerts.forEach(function(item){
+    alerts.forEach(function(item){
       var existAlert = titleToAlertMap[item.service_type + 
item.service_description + item.plugin_output];
       if (existAlert == null) {
         newRecords.push(this.parseIt(item, this.config));


Reply via email to