dashboard.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. App.MainDashboardController = Em.Controller.extend({
  20. name:'mainDashboardController',
  21. alerts: function(){
  22. return App.router.get('clusterController.alerts');
  23. }.property('App.router.clusterController.alerts'),
  24. data: {
  25. HDFS:{
  26. "namenode_addr":"namenode:50070",
  27. "secondary_namenode_addr":"snamenode:50090",
  28. "namenode_starttime":1348935028,
  29. "total_nodes":"1",
  30. "live_nodes":1,
  31. "dead_nodes":0,
  32. "decommissioning_nodes":0,
  33. "dfs_blocks_underreplicated":145,
  34. "safemode":false,
  35. "pending_upgrades":false,
  36. "dfs_configured_capacity":885570207744,
  37. "dfs_percent_used":0.01,
  38. "dfs_percent_remaining":95.09,
  39. "dfs_total_bytes":885570207744,
  40. "dfs_used_bytes":104898560,
  41. "nondfs_used_bytes":43365113856,
  42. "dfs_free_bytes":842100195328,
  43. // additionals
  44. "total_files_and_dirs": 1354,
  45. "namenode_heap_used":63365113856,
  46. "namenode_heap_total": 163365113856
  47. },
  48. MAPREDUCE: {
  49. "jobtracker_addr": "jobtracker:50030",
  50. "jobtracker_starttime": 1348935243,
  51. "running_jobs": 1,
  52. "waiting_jobs": 0,
  53. "trackers_total": "1",
  54. "trackers_live": 1,
  55. "trackers_graylisted": 0,
  56. "trackers_blacklisted": 0,
  57. "chart": [4,8,7,2,1,4,3,3,3],
  58. // additionals
  59. "map_slots_occuped": 4,
  60. "map_slots_reserved": 8,
  61. "map_slots_total": 12,
  62. "reduce_slots_occuped": 3,
  63. "reduce_slots_reserved": 7,
  64. "reduce_slots_total": 11,
  65. "completed_jobs": 3,
  66. "failed_jobs": 2,
  67. "trackers_heap_used": 1348935243,
  68. "trackers_heap_total": 6648935243
  69. },
  70. hbase : {
  71. "hbasemaster_addr": "hbasemaster:60010",
  72. "total_regionservers": "1",
  73. "hbasemaster_starttime": 1348935496,
  74. "live_regionservers": 1,
  75. "dead_regionservers": 0,
  76. "regions_in_transition_count": 0,
  77. "chart": [3,7,7,5,5,3,5,3,7],
  78. "master_server_heap_used": 2348935243,
  79. "master_server_heap_total": 5648935243,
  80. "average_load": 1.4
  81. }
  82. },
  83. services:function(){
  84. return App.router.get('mainServiceController.content');
  85. }.property('App.router.mainServiceController.content'),
  86. alertsFilteredBy: 'All',
  87. alertsFilter: function(event) {
  88. if (event.context)
  89. this.set('alertsFilteredBy', event.context.get('serviceName'));
  90. else
  91. this.set('alertsFilteredBy', 'All');
  92. },
  93. /**
  94. * We do not want to re-get all the data everytime the filter
  95. * is changed. Hence we just filtered the alerts got during page
  96. * load.
  97. */
  98. displayAlerts: function(){
  99. if(this.get('alertsFilteredBy')=='All')
  100. return this.get('alerts');
  101. else
  102. var type = this.get('alertsFilteredBy').toLowerCase();
  103. return this.get('alerts').filter(function(item){
  104. var serviceType = item.get('serviceType');
  105. return serviceType && serviceType.toLowerCase()==type.toLowerCase();
  106. });
  107. }.property('alerts', 'alertsFilteredBy'),
  108. nagiosUrl: function(){
  109. return App.router.get('clusterController.nagiosUrl');
  110. }.property('App.router.clusterController.nagiosUrl'),
  111. isNagiosInstalled: function(){
  112. return App.router.get('clusterController.isNagiosInstalled');
  113. }.property('App.router.clusterController.isNagiosInstalled'),
  114. alertsCount: function() {
  115. var alerts = this.get('alerts');
  116. return alerts ? alerts.filterProperty('status', 'corrupt').length : 0;
  117. }.property('alerts')
  118. })