Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 180329

Getting ESXi Server EventLog for Host Going into Maintenance Mode

$
0
0

Hi All,

 

I have a Python code when run it displays the Machines that are currently in Maintenance Mode:

but unsure how to work with getting the Events for when it was placed into Maintenance Mode.

 

from pyVim.connect import SmartConnect

 

from pyVmomi import vim

import ssl

import os


s=ssl.SSLContext(ssl.PROTOCOL_TLSv1)

s.verify_mode=ssl.CERT_NONE

si=SmartConnect(host=" ", user=" ", pwd=" ",sslContext=s)

content=si.content

 

defget_all_objs(content, vimtype):

        obj = {}

        container = content.viewManager.CreateContainerView(content.rootFolder, vimtype, True)

        for managed_object_ref in container.view:

                obj.update({managed_object_ref: managed_object_ref.name})

        return obj


 

getESXi=get_all_objs(content, [vim.HostSystem])


for vm in getESXi:

        if vm.summary.runtime.inMaintenanceMode ==1 :

                # To- DO getting Events for Maintance;

 


Viewing all articles
Browse latest Browse all 180329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>