alert_instance.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. var dateUtils = require('utils/date');
  20. App.AlertInstance = DS.Model.extend({
  21. id: DS.attr('number'),
  22. label: DS.attr('string'),
  23. alertDefinition: DS.belongsTo('App.AlertDefinition'),
  24. serviceName: DS.attr('string'),
  25. componentName: DS.attr('string'),
  26. hostName: DS.attr('string'),
  27. scope: DS.attr('string'),
  28. originalTimestamp: DS.attr('number'),
  29. latestTimestamp: DS.attr('number'),
  30. maintenanceState: DS.attr('string'),
  31. instance: DS.attr('string'),
  32. state: DS.attr('string'),
  33. text: DS.attr('string'),
  34. notification: DS.hasMany('App.AlertNotification'),
  35. /**
  36. * Formatted timestamp for latest instance triggering
  37. * @type {string}
  38. */
  39. lastTriggered: function() {
  40. return dateUtils.dateFormat(this.get('latestTimestamp'));
  41. }.property('latestTimestamp')
  42. });
  43. App.AlertInstance.FIXTURES = [
  44. {
  45. "id": 1,
  46. "cluster_name": "tdk",
  47. "component_name": "SECONDARY_NAMENODE",
  48. "host_name": "tr-2.c.pramod-thangali.internal",
  49. "instance": null,
  50. "label": "Secondary NameNode Process",
  51. "latest_timestamp": 1414664775337,
  52. "maintenance_state": "OFF",
  53. "name": "secondary_namenode_process",
  54. "original_timestamp": 1414585335334,
  55. "scope": "ANY",
  56. "service_name": "HDFS",
  57. "state": "CRITICAL",
  58. "text": "Connection failed: [Errno 111] Connection refused on host tr-2.c.pramod-thangali.internal:50090",
  59. "alert_definition": 1,
  60. "notification": 1
  61. },
  62. {
  63. "cluster_name" : "tdk",
  64. "component_name" : "DATANODE",
  65. "host_name" : "tr-3.c.pramod-thangali.internal",
  66. "id" : 2,
  67. "instance" : null,
  68. "label" : "DataNode Web UI",
  69. "latest_timestamp" : 1414666905645,
  70. "maintenance_state" : "OFF",
  71. "name" : "datanode_webui",
  72. "original_timestamp" : 1414585365674,
  73. "scope" : "HOST",
  74. "service_name" : "HDFS",
  75. "state" : "CRITICAL",
  76. "text" : "Connection failed to 0.0.0.0:50075",
  77. "alert_definition": 2,
  78. "notification": 2
  79. },
  80. {
  81. "cluster_name": "tdk",
  82. "component_name": "ZOOKEEPER_SERVER",
  83. "host_name": "tr-1.c.pramod-thangali.internal",
  84. "id": 3,
  85. "instance": null,
  86. "label": "ZooKeeper Server Process",
  87. "latest_timestamp": 1414665174611,
  88. "maintenance_state": "OFF",
  89. "name": "zookeeper_server_process",
  90. "original_timestamp": 1414585014606,
  91. "scope": "ANY",
  92. "service_name": "ZOOKEEPER",
  93. "state": "CRITICAL",
  94. "text": "TCP OK - 0.0000 response on port 2181",
  95. "alert_definition": 3,
  96. "notification": 3
  97. },
  98. {
  99. "cluster_name": "tdk",
  100. "component_name": "ZOOKEEPER_SERVER",
  101. "host_name": "tr-2.c.pramod-thangali.internal",
  102. "id": 4,
  103. "instance": null,
  104. "label": "ZooKeeper Server Process",
  105. "latest_timestamp": 1414665135341,
  106. "maintenance_state": "OFF",
  107. "name": "zookeeper_server_process",
  108. "original_timestamp": 1414585035316,
  109. "scope": "ANY",
  110. "service_name": "ZOOKEEPER",
  111. "state": "OK",
  112. "text": "TCP OK - 0.0000 response on port 2181",
  113. "alert_definition": 3,
  114. "notification": 3
  115. },
  116. {
  117. "cluster_name": "tdk",
  118. "component_name": "ZOOKEEPER_SERVER",
  119. "host_name": "tr-3.c.pramod-thangali.internal",
  120. "id": 5,
  121. "instance": null,
  122. "label": "ZooKeeper Server Process",
  123. "latest_timestamp": 1414665165640,
  124. "maintenance_state": "OFF",
  125. "name": "zookeeper_server_process",
  126. "original_timestamp": 1414585065616,
  127. "scope": "ANY",
  128. "service_name": "ZOOKEEPER",
  129. "state": "OK",
  130. "text": "TCP OK - 0.0000 response on port 2181",
  131. "alert_definition": 3,
  132. "notification": 3
  133. }
  134. ];