dashboard.js 3.8 KB

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