2013-07-24 2 views
0

vCenter 서버에서 예약 된 작업으로 실행될 응용 프로그램을 작성하려고하고 클러스터의 각 호스트의 현재 시간을 모니터링합니다. 시간은 NTP에 의해 설정되지만이 호스트에서 실행중인 VM 서버가 최대 1 분 동안 나가고 어떤 일이 발생하는지 모니터링해야합니다. QueryDateTime() -VMware ESXi QueryDateTime() 방법 예

내 호스트는 문서 (http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.DateTimeSystem.html#queryDateTime) 호스트의 현재 날짜 시간을 얻는 방법이있다 따르면 ESXi를 버전 5.1을

를 실행하고 있습니다.

그래도 작동하려면 고심하고 있습니다 .... 내 샘플 코드는 아래에 있습니다. 항상 존재하지 않는 QueryDateTime 메소드에 대해 불평합니다! 이 날 SDK를 이해하지 못하는,하지만이 알아낼 수 없습니다 가능성이

.....

VimClient vimClient = new VimClient(); 
vimClient.Connect(vcenter.ServiceURL); 
vimClient.Login(vcenter.Username, vcenter.Password); 

List<EntityViewBase> hosts = vimClient.FindEntityViews(typeof(VMware.Vim.HostSystem), null, null, null); 

foreach (HostSystem host in hosts) 
{ 
    Console.WriteLine(host.Config.Network.Vnic[0].Spec.Ip.IpAddress); 

    HostConfigManager hostConfigManager = host.ConfigManager; 

    HostDateTimeSystem hostDateTimeSystem = hostConfigManager.DateTimeSystem; 

    DateTime hostDateTime = hostDateTimeSystem.QueryDateTime(); 
} 

답변

0

이 작업을 시도해야합니다.

foreach (HostSystem host in vmHosts) 
{ 
HostConfigManager hostConfigManager = host.ConfigManager; 
HostDateTimeSystem hostDateTimeSystem = (HostDateTimeSystem) vimClient.GetView(hostConfigManager.DateTimeSystem, null)); 
DateTime hostDateTime = hostDateTimeSystem.QueryDateTime(); 
} 
관련 문제