|
@@ -66,310 +66,4 @@ describe('App.hostsMapper', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- var hosts = {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/disk_info,Hosts/cpu_count,Hosts/total_mem,Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components,metrics/disk,metrics/load/load_one",
|
|
|
- "items" : [
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal",
|
|
|
- "metrics" : {
|
|
|
- "disk" : {
|
|
|
- "disk_total" : 896.17,
|
|
|
- "disk_free" : 846.304936111
|
|
|
- },
|
|
|
- "load" : {
|
|
|
- "load_one" : 0.786194444444
|
|
|
- },
|
|
|
- "memory" : {
|
|
|
- "mem_total" : 7514116.0,
|
|
|
- "swap_free" : 0.0,
|
|
|
- "mem_buffers" : 114389.877778,
|
|
|
- "mem_shared" : 0.0,
|
|
|
- "mem_free" : 4320263.07778,
|
|
|
- "swap_total" : 0.0,
|
|
|
- "mem_cached" : 2229920.77778
|
|
|
- },
|
|
|
- "cpu" : {
|
|
|
- "cpu_speed" : 2266.0,
|
|
|
- "cpu_num" : 2.0,
|
|
|
- "cpu_wio" : 0.393055555556,
|
|
|
- "cpu_idle" : 85.9025,
|
|
|
- "cpu_nice" : 0.0,
|
|
|
- "cpu_aidle" : 0.0,
|
|
|
- "cpu_system" : 2.75111111111,
|
|
|
- "cpu_user" : 10.9405555556
|
|
|
- }
|
|
|
- },
|
|
|
- "Hosts" : {
|
|
|
- "host_status" : "HEALTHY",
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "public_host_name" : "ec2-107-21-192-172.compute-1.amazonaws.com",
|
|
|
- "cpu_count" : 2,
|
|
|
- "total_mem" : 7518289,
|
|
|
- "os_arch" : "x86_64",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal",
|
|
|
- "disk_info" : [
|
|
|
- {
|
|
|
- "available" : "5431780",
|
|
|
- "used" : "2403168",
|
|
|
- "percent" : "31%",
|
|
|
- "size" : "8254240",
|
|
|
- "type" : "ext4",
|
|
|
- "mountpoint" : "/"
|
|
|
- },
|
|
|
- {
|
|
|
- "available" : "3757056",
|
|
|
- "used" : "0",
|
|
|
- "percent" : "0%",
|
|
|
- "size" : "3757056",
|
|
|
- "type" : "tmpfs",
|
|
|
- "mountpoint" : "/dev/shm"
|
|
|
- },
|
|
|
- {
|
|
|
- "available" : "411234588",
|
|
|
- "used" : "203012",
|
|
|
- "percent" : "1%",
|
|
|
- "size" : "433455904",
|
|
|
- "type" : "ext3",
|
|
|
- "mountpoint" : "/grid/0"
|
|
|
- },
|
|
|
- {
|
|
|
- "available" : "411234588",
|
|
|
- "used" : "203012",
|
|
|
- "percent" : "1%",
|
|
|
- "size" : "433455904",
|
|
|
- "type" : "ext3",
|
|
|
- "mountpoint" : "/grid/1"
|
|
|
- }
|
|
|
- ],
|
|
|
- "ip" : "10.83.54.214",
|
|
|
- "os_type" : "centos6",
|
|
|
- "last_heartbeat_time" : 1369829865123
|
|
|
- },
|
|
|
- "host_components" : [
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HDFS_CLIENT",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "HDFS_CLIENT",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HBASE_REGIONSERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "HBASE_REGIONSERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HIVE_METASTORE",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "HIVE_METASTORE",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/DATANODE",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "DATANODE",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HIVE_SERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "HIVE_SERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HBASE_MASTER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "ha_status" : "passive",
|
|
|
- "component_name" : "HBASE_MASTER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/MYSQL_SERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "MYSQL_SERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/ZOOKEEPER_SERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "ZOOKEEPER_SERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/OOZIE_SERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "OOZIE_SERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/MAPREDUCE_CLIENT",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "MAPREDUCE_CLIENT",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/NAMENODE",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "NAMENODE",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/GANGLIA_SERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "GANGLIA_SERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/TASKTRACKER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "TASKTRACKER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/SQOOP",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "SQOOP",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/GANGLIA_MONITOR",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "GANGLIA_MONITOR",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HIVE_CLIENT",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "HIVE_CLIENT",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/JOBTRACKER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "JOBTRACKER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/ZOOKEEPER_CLIENT",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "ZOOKEEPER_CLIENT",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/SECONDARY_NAMENODE",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "SECONDARY_NAMENODE",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HBASE_CLIENT",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "HBASE_CLIENT",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/OOZIE_CLIENT",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "OOZIE_CLIENT",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/WEBHCAT_SERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "WEBHCAT_SERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/HCAT",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "HCAT",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/PIG",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "PIG",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "href" : "http://ec2-107-21-192-172.compute-1.amazonaws.com:8080/api/v1/clusters/tdk/hosts/ip-10-83-54-214.ec2.internal/host_components/NAGIOS_SERVER",
|
|
|
- "HostRoles" : {
|
|
|
- "cluster_name" : "tdk",
|
|
|
- "component_name" : "NAGIOS_SERVER",
|
|
|
- "host_name" : "ip-10-83-54-214.ec2.internal"
|
|
|
- }
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
-
|
|
|
- describe('#parse', function() {
|
|
|
- var result = App.hostsMapper.parse(hosts.items);
|
|
|
- it('Hosts are loaded', function() {
|
|
|
- expect(result.length).to.equal(1);
|
|
|
- });
|
|
|
- var host = result[0];
|
|
|
- it('Disk Usage calculated', function() {
|
|
|
- expect(host.disk_usage).to.equal('5.6');
|
|
|
- });
|
|
|
- it('CPU Usage calculated', function() {
|
|
|
- expect(host.cpu_usage).to.equal('13.7');
|
|
|
- });
|
|
|
- it('Memory Usage calculated', function() {
|
|
|
- expect(host.memory_usage).to.equal('42.5');
|
|
|
- });
|
|
|
- it('Host Complonents loaded', function() {
|
|
|
- expect(host.host_components.length).to.equal(hosts.items[0].host_components.length);
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
});
|