hdfs.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
  20. templateName:require('templates/main/dashboard/service/hdfs'),
  21. serviceName:'hdfs',
  22. data:{
  23. "namenode_addr":"ec2-23-21-1-25.compute-1.amazonaws.com:50070",
  24. "secondary_namenode_addr":"ec2-23-21-1-25.compute-1.amazonaws.com:50090",
  25. "namenode_starttime":1348935028,
  26. "total_nodes":"1",
  27. "live_nodes":1,
  28. "dead_nodes":0,
  29. "decommissioning_nodes":0,
  30. "dfs_blocks_underreplicated":145,
  31. "safemode":false,
  32. "pending_upgrades":false,
  33. "dfs_configured_capacity":885570207744,
  34. "dfs_percent_used":0.01,
  35. "dfs_percent_remaining":95.09,
  36. "dfs_total_bytes":885570207744,
  37. "dfs_used_bytes":104898560,
  38. "nondfs_used_bytes":43365113856,
  39. "dfs_free_bytes":842100195328
  40. },
  41. Chart:App.ChartPieView.extend({
  42. data:function () {
  43. return [ this.get('_parentView.data.dfs_used_bytes') + this.get('_parentView.data.nondfs_used_bytes'), this.get('_parentView.data.dfs_free_bytes') ];
  44. }.property('_parentView.data')
  45. }),
  46. nodeUptime:function () {
  47. var uptime = this.get('data.namenode_starttime');
  48. var formatted = uptime.toDaysHoursMinutes();
  49. return this.t('dashboard.services.uptime').format(formatted.d, formatted.h, formatted.m);
  50. }.property("data"),
  51. nodeHeap:function () {
  52. return this.t('dashboard.services.hdfs.nodes.heapUsed').format("?", "?", "?");
  53. }.property('data'),
  54. summaryHeader:function () {
  55. var text = this.t("dashboard.services.hdfs.summary");
  56. return text.format(this.get('data.live_nodes'), this.get('data.total_nodes'), this.get('data.dfs_percent_remaining'));
  57. }.property('data'),
  58. capacity:function () {
  59. var text = this.t("dashboard.services.hdfs.capacityUsed");
  60. var total = this.get('data.dfs_total_bytes') + 0;
  61. var used = this.get('data.dfs_used_bytes') + this.get('data.nondfs_used_bytes');
  62. return text.format(used.bytesToSize(2), total.bytesToSize(2), this.get('data.dfs_percent_used'));
  63. }.property('data')
  64. });