dashboard.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. MAPREDUCE: {
  26. "jobtracker_addr": "jobtracker:50030",
  27. "jobtracker_starttime": 1348935243,
  28. "running_jobs": 1,
  29. "waiting_jobs": 0,
  30. "trackers_total": "1",
  31. "trackers_live": 1,
  32. "trackers_graylisted": 0,
  33. "trackers_blacklisted": 0,
  34. "chart": [4,8,7,2,1,4,3,3,3],
  35. // additionals
  36. "map_slots_occuped": 4,
  37. "map_slots_reserved": 8,
  38. "map_slots_total": 12,
  39. "reduce_slots_occuped": 3,
  40. "reduce_slots_reserved": 7,
  41. "reduce_slots_total": 11,
  42. "completed_jobs": 3,
  43. "failed_jobs": 2,
  44. "trackers_heap_used": 1348935243,
  45. "trackers_heap_total": 6648935243
  46. },
  47. hbase : {
  48. "hbasemaster_addr": "hbasemaster:60010",
  49. "total_regionservers": "1",
  50. "hbasemaster_starttime": 1348935496,
  51. "live_regionservers": 1,
  52. "dead_regionservers": 0,
  53. "regions_in_transition_count": 0,
  54. "chart": [3,7,7,5,5,3,5,3,7],
  55. "master_server_heap_used": 2348935243,
  56. "master_server_heap_total": 5648935243,
  57. "average_load": 1.4
  58. }
  59. },
  60. services:function(){
  61. return App.router.get('mainServiceController.content');
  62. }.property('App.router.mainServiceController.content'),
  63. alertsFilteredBy: 'All',
  64. alertsFilter: function(event) {
  65. if (event.context)
  66. this.set('alertsFilteredBy', event.context.get('serviceName'));
  67. else
  68. this.set('alertsFilteredBy', 'All');
  69. },
  70. /**
  71. * We do not want to re-get all the data everytime the filter
  72. * is changed. Hence we just filtered the alerts got during page
  73. * load.
  74. */
  75. displayAlerts: function(){
  76. if(this.get('alertsFilteredBy')=='All')
  77. return this.get('alerts');
  78. else
  79. var type = this.get('alertsFilteredBy').toLowerCase();
  80. return this.get('alerts').filter(function(item){
  81. var serviceType = item.get('serviceType');
  82. return serviceType && serviceType.toLowerCase()==type.toLowerCase();
  83. });
  84. }.property('alerts', 'alertsFilteredBy'),
  85. nagiosUrl: function(){
  86. return App.router.get('clusterController.nagiosUrl');
  87. }.property('App.router.clusterController.nagiosUrl'),
  88. isNagiosInstalled: function(){
  89. return App.router.get('clusterController.isNagiosInstalled');
  90. }.property('App.router.clusterController.isNagiosInstalled'),
  91. alertsCount: function() {
  92. var alerts = this.get('alerts');
  93. return alerts ? alerts.filterProperty('status', 'corrupt').length : 0;
  94. }.property('alerts')
  95. });