The final battle in my quest for properly integrated UPS Monitoring was to get my ESXi 4.1 box into the mix.
Some rummaging around online turned up a NUT Client for ESXi 5 (french) which doesn’t work for ESXi 4, fortunately the same guy has also done a NUT Client for ESXi 4 (french) which will work, but takes some effort.
The tricky part is that it seems that the only way to customise an ESXi 4 install is via oem.tgz, whereas in ESXi 5 we have the concept of “packages”, I broke my ESXi box several times figuring out how to actually do this properly so I figure I might as well write it up for others (also it’s probably good to have a native English version rather than having to go through the peril of Google Translate.) Enable SSH access on your ESXi box;
- Login to vSphere
- Select host
- Configuration -> Security Profile
- Firewall -> Properties…
- Remote Tech Support (SSH) -> Options…
- Click Start
SSH into your ESXi box and do the following;
Once that’s done you’ve got a “merged” tree of the existing oem.tgz and the NUT oem.tgz, next step is to go edit etc/ups/upsmon.conf to add a MONITOR clause for your UPS, and then update etc/ups/notify.sh if you want email notifications (If you don’t want notifications, just comment out the NOTIFYCMD line in upsmon.conf).
Once you’re happy with the config you need to re-pack the oem.tgz, the trick here (took several attempts and one ESXi rebuild to get this right…) is that your .tgz must NOT have leading ./ in the paths, the way to do this is pretty simple;
Now reboot, and if all’s well ESXi will boot up happily, if it doesn’t consult the troubleshooting section below.
Once ESXi has booted up, SSH back in and run;
It you’re seeing that then it looks like you’re all good, now to test the shutdown script issue the following;
ESXi should shut itself down shortly thereafter.
If that all works then you’re done.
If your ESXi box pink screens, you probably cocked up the oem.tgz, at the loading screen do a “Shift+O” and give the additional option “noOem”, this will prevent ESXi from loading the oem.tgz, then you can SSH back in and try again.
If the above doesn’t work then you’ve REALLY screwed something up (like say, when I DELETED the oem.tgz file… Protip: DON’T DO THAT) for that “Shift+R” will switch you over to the “altbootbank” (actually it swaps the contents of bootbank and altbootbank), which will revert you to the original state (assuming you did the backup as suggested in the above code), SSH in and try again.
If that doesn’t work you can boot the install CD, switch to a console with “Alt-F1” and copy the oem.tgz.orig file back to oem.tgz.
If that doesn’t work then you’ve done something REALLY special and I can’t help ;)