doomdevice
Enthusiast
Enthusiast

manage maintenance mode by command line

Jump to solution

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.

VI PowerScripter [http://www.powerscripter.net] Every Click can be a customized function within VI client
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal

\[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/

$ help

hostsvc/ ? csls pinfo puse

internalsvc/ argtype csuimport pload quit

solo/ cls echo ploadpath sleep

vimsvc/ csimport exit pls source

vmsvc/ csinfo help puload

$ hostsvc/

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/

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."

}

$

View solution in original post

0 Kudos
11 Replies
jsintz
Enthusiast
Enthusiast

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"

0 Kudos
doomdevice
Enthusiast
Enthusiast

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.

VI PowerScripter [http://www.powerscripter.net] Every Click can be a customized function within VI client
0 Kudos
admin
Immortal
Immortal

\[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/

$ help

hostsvc/ ? csls pinfo puse

internalsvc/ argtype csuimport pload quit

solo/ cls echo ploadpath sleep

vimsvc/ csimport exit pls source

vmsvc/ csinfo help puload

$ hostsvc/

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/

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."

}

$

0 Kudos
dphowes
Enthusiast
Enthusiast

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.

0 Kudos
kri-2
Hot Shot
Hot Shot

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

esloof
Expert
Expert

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 possibility’s 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

0 Kudos
MR-T
Immortal
Immortal

Fantastic, thanks for sharing.

0 Kudos
sbeaver
Leadership
Leadership

If anyone figures out how to do this via SDK and if possible VB I would love to talk you

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
esloof
Expert
Expert
0 Kudos
sbeaver
Leadership
Leadership

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

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos