通过vcenter管理导出宿主机列表时可能信息不太全,可以通过内部数据查到想要的结果。
--host 宿主机信息
select * from vpxv_hosts;
--vm 虚拟机信息
select * from vpxv_vms;
--my vm 包含集群信息的虚拟机
select e2.name,
v.DESCRIPTION,
h.IP_ADDRESS host_ip,
v.name,
v.IP_ADDRESS,
v.power_state,
num_vcpu,
round(mem_size_mb / 1024) mem_g,
v.guest_os,
v.guest_state,
v.DNS_NAME,
v.VMMWARE_TOOL,
trunc(sysdate-v.BOOT_TIME) start_day
from vpxv_vms v, vpxv_hosts h, vpx_entity e, vpx_entity e2
where h.HOSTID = v.HOSTID
and h.HOSTID = e.id
and e.parent_id = e2.id
order by e2.id;
--my host
select e2.name,
h.ip_address,
h.host_vendor,
h.host_model,
h.cpu_count,
--h.cpu_model,
round(h.mem_size / 1024 / 1024 / 1024) mem_g,
h.nic_count,
h.hba_count,
trunc(sysdate-h.boot_time) start_days,
h.product_fullname,
case h.POWER_STATE when 0 then 'Off' when 1 then 'On' when 2 then 'Suspended' end as zt,
CASE h.MAINTENANCE_MODE when 0 then 'NO' when 1 then 'YES' end as MMode
from vpx_host h, vpx_entity e, vpx_entity e2
where h.id = e.id
and e.parent_id = e2.id;
-- datastore used 使用率
select name,
round(capacity / 1024 / 1024 / 1024) size_g,
round(free_space / 1024 / 1024 / 1024) free_g
from vpxv_datastore t
order by free_g;
--entity 条目(各类名称:数据中心名、集群名等)
select * from vpxv_entity;
-- user define label 自定义字段
select * from VPXV_VM_FIELDS t;
--查询日志文件大小
SELECT * FROM (select VM_ID,KEY_VAL,NAME,round(to_number(FILE_SIZE)/1024/1024/1024) FILE_SIZE,FILE_UNIQUESIZE,TYPE from vpxadmin.VPX_VM_FLE_FILE_INFO where type='log' ORDER BY to_number(FILE_SIZE) DESC) WHERE ROWNUM<11;
阅读(2970) | 评论(0) | 转发(0) |