Does anybody know how to manage the maintenance mode by command line?
I want to create a script which puts the host into maintenance mode automatically.
I think esxcfg-advcfg -j is the key but I don´t know what option it could be.
\[root@XXX root]# vimsh
\[2007-02-28 09:33:42.897 'App' 3076460672 info] Current working directory: /usr/lib/vmware/hostd
\[2007-02-28 09:33:42.899 'BaseLibs' 3076460672 info] Using system libcrypto, version 90709F
\[2007-02-28 09:33:42.899 'App' 3076460672 info] Vmacore::InitSSL: doVersionCheck = true, handshakeTimeoutUs = 120000000
\[2007-02-28 09:33:42.926 'BaseLibs' 5442480 warning] \[Vmdb_Unset] Unsetting unknown path: /vmomi/
hostsvc/ ? csls pinfo puse
internalsvc/ argtype csuimport pload quit
solo/ cls echo ploadpath sleep
vimsvc/ csimport exit pls source
vmsvc/ csinfo help puload
advopt/ cpuinfo pci_add
autostartmanager/ hostconfig pci_remove
datastore/ hosthardware queryconnectioninfo
datastorebrowser/ hostsummary querydisabledmethods
net/ login refresh_firewall
rsrc/ logout refresh_services
storage/ maintenance_mode_enter runtimeinfo
vmotion/ maintenance_mode_exit set_hostid
connect memoryinfo task_list
advopt/ cpuinfo pci_add
autostartmanager/ hostconfig pci_remove
datastore/ hosthardware queryconnectioninfo
datastorebrowser/ hostsummary querydisabledmethods
net/ login refresh_firewall
rsrc/ logout refresh_services
storage/ maintenance_mode_enter runtimeinfo
vmotion/ maintenance_mode_exit set_hostid
connect memoryinfo task_list
$ hostsvc/maintenance_mode_exit
(vim.fault.InvalidState) {
msg = "The operation is not allowed in the current state."
}
Check this thread:
http://www.vmware.com/community/thread.jspa?messageID=502871񺱗
See this thread
http://www.vmware.com/community/message.jspa?messageID=534412
In summary, mittell suggests using the SDK because ..."no built in scripts exists that will put a host into maintenance mode"
I don´t want to use the sdk.
And I´m sure that there should be a configuration setting to do that.
After a reboot the host still remains in maintenance mode so it have to exist a pointer to do so.
\[root@XXX root]# vimsh
\[2007-02-28 09:33:42.897 'App' 3076460672 info] Current working directory: /usr/lib/vmware/hostd
\[2007-02-28 09:33:42.899 'BaseLibs' 3076460672 info] Using system libcrypto, version 90709F
\[2007-02-28 09:33:42.899 'App' 3076460672 info] Vmacore::InitSSL: doVersionCheck = true, handshakeTimeoutUs = 120000000
\[2007-02-28 09:33:42.926 'BaseLibs' 5442480 warning] \[Vmdb_Unset] Unsetting unknown path: /vmomi/
hostsvc/ ? csls pinfo puse
internalsvc/ argtype csuimport pload quit
solo/ cls echo ploadpath sleep
vimsvc/ csimport exit pls source
vmsvc/ csinfo help puload
advopt/ cpuinfo pci_add
autostartmanager/ hostconfig pci_remove
datastore/ hosthardware queryconnectioninfo
datastorebrowser/ hostsummary querydisabledmethods
net/ login refresh_firewall
rsrc/ logout refresh_services
storage/ maintenance_mode_enter runtimeinfo
vmotion/ maintenance_mode_exit set_hostid
connect memoryinfo task_list
advopt/ cpuinfo pci_add
autostartmanager/ hostconfig pci_remove
datastore/ hosthardware queryconnectioninfo
datastorebrowser/ hostsummary querydisabledmethods
net/ login refresh_firewall
rsrc/ logout refresh_services
storage/ maintenance_mode_enter runtimeinfo
vmotion/ maintenance_mode_exit set_hostid
connect memoryinfo task_list
$ hostsvc/maintenance_mode_exit
(vim.fault.InvalidState) {
msg = "The operation is not allowed in the current state."
}
Interesting script, am a little bit new to some of the esx scripting, how do you call the vimsh script to initiate host maintenance mode ? Could possibly use this as a basis for taking a esx blade out of service when our HP SIM server notices a possible problem.
the vimsh can also run predefined commands:
try from your shell:
vimsh -n -e /hostsvc/maintenance_mode_enter
vimsh -n -e /hostsvc/maintenance_mode_exit
During the VMware TTT DSA class in march 2007 two of my fellow VMware trainers discovered how to use the vim sh command to put an ESX server into maintenance mode. After the information was posted in the Dutch VMware user group I discovered that there are a lot of other undocumented possibilitys regarding he vim sh command. I tried to squeeze some extra information from Jeremy van Doorn during an interview I recorded at the TSX in Nice. After a lot of hacking I created a script witch you can use to lookup witch hardware is in your ESX server. Last week Gavin Jolliffe and Paul Davey from Xtravirt published the Guide to VMware vimsh white paper. This paper discusses the currently undocumented VMware ESX vimsh command and seeks to explore its options and possibilities at a high level. This paper assumes the reader has good technical knowledge of VMWare Virtual Infrastructure 3 together with some basic scripting experience.
Regards,
Eric Sloof
http://www.ntpro.nl/blog/archives/134-Guide-to-VMware-vimsh.html
Fantastic, thanks for sharing.
If anyone figures out how to do this via SDK and if possible VB I would love to talk you
Steve,
I've created a PDF with a VB-SDK jumpstart.
http://www.ntpro.nl/blog/archives/130-Building-VMware-Visual-Basic-Applications.html
That has been a great reference for me I just reverse engineer much better then I create. I have an app that will connect I just can not for the life of me figure out all that is needed to make maintenancemode_task work yet