rgc2000 / nutclient-esxi Goto Github PK
View Code? Open in Web Editor NEWNetwork UPS Tools client for VMware ESXi
Home Page: https://rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/
License: GNU General Public License v3.0
Network UPS Tools client for VMware ESXi
Home Page: https://rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/
License: GNU General Public License v3.0
Network UPS Tools client for VMWare ESXi 5.0-8.0 ------------------------------------------------ Author : Rene Garcia Date : 04-04-2024 Release: 2.6.2 Licence: GPLv3 PURPOSE Provide UPS connectivity to a single vSphere Hypervisor 5.0 to 8.0 Will shut down properly the host and VMs with vmware-tools installed if a NUT server tells that the power supply has gone and the UPS battery level is critical. INSTALL The old way, for all ESXi versions from 5 to 8 - Enable SSH on the hypervisor. - Copy via scp this TAR archive to /tmp directory on the hypervisor - Connect via ssh to the hypervisor and type the followind commands cd /tmp tar -xzvf NutClient-ESXi-2.8.2-2.6.2.x86_64.tar.gz ./upsmon-install.sh - No need to reboot, upsmon can be started immediatly but you need to configure it first - You can delete tmp files and disable SSH on the hypervisor The modern way, for ESXi 6 and above - Enable SSH on the Hypervisor. - Copy via scp the offline bundle ZIP file to /tmp directory on host - Connect via ssh to the host and type the following command esxcli software vib install -d /tmp/NutClient-ESXi-2.8.2-2.6.2-offline_bundle.zip UPDATE - Same as install but use ./upsmon-update.sh - Or use esxcli software vib update -d /tmp/NutClient-ESXi-2.8.2-2.6.2-offline_bundle.zip UNINSTALL - Same as install but use ./upsmon-remove.sh - Or use esxcli software vib remove -n upsmon CONFIGURATION - Open ESXi UI web interface and log in. In 'navigator', select 'Manage' item in 'Host' - In 'System' tab select 'Advanced Settings' and you can filter with "UserVars.Nut" - Configure these parameters to match your needs : UserVars.NutUpsName : UPS name on remote NUT server (ups_name@server_name), can be a space separated list of NUT servers. UserVars.NutUser : Username to connect to NUT server. If you are using more than one NUT server, they all need to accept the same user/password. UserVars.NutPassword : User password on NUT server. UserVars.NutFinalDelay : Seconds to wait on low battery event before shutting down. UserVars.NutOnBatteryDelay : Seconds to wait running on battery before shutting down. Default is 0 to disable this feature and wait for low battery event before shutting down. UserVars.NutMinSupplies : Number of power supplies needed to keep the system running. UserVars.NutSendMail : Set to 1 if you want a mail to be sent on UPS events. Set to 2 for a more detailled mail report with all UPS status. Set to 0 for no mail UserVars.NutMailTo : Email address to send mail to on UPS events. UserVars.NutSmtpRelay : Optional SMTP relay to send mail. keep it empty for no relay (the default) - If you don't see the UserVars parameters restart hostd service on hypervisor only if you have no vmware job running /etc/init.d/hostd restart You will need to reconnect with the client - Now you can start and enable NUT client on hypervisor boot - On ESXi UI web interface select 'Manage' item in 'Host'. The select 'Services' tab. - Highlight NutClient service, in actions enable 'Start and stop with host' - Start the NutClient service once configured. - Everytime you change a value in the UserVars you MUST restart NUT client service to reload the configuration. WARNING This module is provided "as is" and is not approved by VMWare, you may lose VMWare support if you install it. Use it at your own risks. This module was designed for standalone ESXi servers. You should not use it for ESXi nodes in an HA cluster, otherwise the virtual machines will be abruptly stopped by the NUT client in the event of a power outage (no clean shutdown/standby in HA mode). REVISIONS Version notation is X.Y.Z where Z is for minor evolutions and bug fixes with no new features. Y is for new features and X is for major evolutions with possible break of ascending compatibility. 1.0.0 - 26/05/2012 - internal beta release 1.0.1 - 28/05/2012 - initial release 1.0.2 - 27/06/2012 - nut updated to version 2.6.4 1.1.0 - 23/02/2013 - nut updated to version 2.6.5 - messages to syslog 1.2.0 - 01/09/2013 - finaldelay is configurable - date in emails is RFC-2822 compliant 1.3.0 - 22/10/2014 - nut updated to version 2.7.2 - multi NUT servers support 1.4.0 - 16/04/2016 - nut updated to version 2.7.4 - SSL support with embeded libressl 2.3.0 2.0.0 - 27/01/2017 - compliant with community level on ESXi 6.x 2.0.1 - 23/05/2019 - set security policy for ESXi 6.7 update 2 2.1.0 - 26/05/2019 - libressl 2.9.2 - vib compatible with ISO integration 2.1.1 - 01/06/2020 - libressl 3.1.2 - fixed FROM value on smtp protocol for email notifications 2.1.2 - 11/01/2021 - libressl 3.2.3 - tested on ESXi 7.0 2.1.3 - 22/03/2021 - libressl 3.2.5 2.1.4 - 21/04/2021 - build also an offline depot for image builder, keep nut tools version 2.1.5 - 07/05/2021 - libressl 3.3.3 2.1.6 - 29/08/2021 - libressl 3.3.4 2.1.7 - 29/12/2021 - libressl 3.4.2 2.2.0 - 14/02/2022 - minsupplies is configurable 2.2.1 - 17/02/2022 - typo on parameter description 2.2.2 - 17/02/2022 - naming issue fixed in offline bundle, no changes in code 2.3.0 - 02/05/2022 - nut 2.8.0, libressl 3.5.2 2.3.1 - 23/08/2022 - libressl 2.5.3 - ESXi 8.0 support 2.3.2 - 19/10/2022 - ESXi 8.0 support, 64-bit binaries 2.4.0 - 23/10/2022 - New feature: Configurable shutdown delay when running on battery 2.4.1 - 21/11/2022 - libressl 3.6.1 - Fix on battery delay shutdown with multiple ups setup 2.4.2 - 19/02/2023 - libressl 3.6.2 2.5.0 - 01/11/2023 - nut updated to version 2.8.1 - libressl 3.7.3 - UserVars description 2.6.0 - 17/11/2023 - new SMTP relay feature for mail notifications - verbose mail option 2.6.1 - 05/12/2023 - Fix default SMPT value to 'none' to be supported on ESXi 6.7 and previous 2.6.2 - 04/04/2024 - nut 2.8.2, libressl 3.9.1
Premise:
I have some energy-intensive VMs running on ESXi but they're are not "mission critical".
Request:
It would be nice to programmatically shutdown energy-intensive or non-critical VMs first (maybe in different priority groups) and if energy supply is not resumed, the host is shut down at T - x (margin before batteries are empty)
/opt/nut/bin/upsc [email protected]
./upsc: /lib64/libc.so.6: version GLIBC_2.16' not found (required by /opt/nut/lib/libupsclient.so.6) ./upsc: /lib64/libc.so.6: version
GLIBC_2.14' not found (required by /opt/nut/lib/libupsclient.so.6)
Hi,
First off, thank you so much for this.
Looks like Release 2.4.1 is the last build you included the .tar.gz for.
I am assuming you meant to include the .tar.gz for these releases too?
I tried to install 2.6.2 and 2.6.1 offline_bundle.zip verion but it fails:
[will@esxi:~] esxcli software vib install -d NutClient-ESXi-2.8.1-2.6.1-offline_bundle.zip
[MetadataDownloadError]
Could not download from depot at zip:/var/log/vmware/NutClient-ESXi-2.8.1-2.6.1-offline_bundle.zip?index.xml, skipping (('zip:/var/log/vmware/NutClient-ESXi-2.8.1-2.6.1-offline_bundle.zip?index.xml', '', "Error extracting index.xml from /var/log/vmware/NutClient-ESXi-2.8.1-2.6.1-offline_bundle.zip: [Errno 2] No such file or directory: '/var/log/vmware/NutClient-ESXi-2.8.1-2.6.1-offline_bundle.zip'"))
url = zip:/var/log/vmware/NutClient-ESXi-2.8.1-2.6.1-offline_bundle.zip?index.xml
Please refer to the log file for more details.
This is on ESXi 8.0 Update 2b.
2.4.1 NutClient-ESXi-2.8.0-2.4.1.x86_64.tar.gz release installed fine:
[will@esxi:~] ./upsmon-install.sh
Installation Result
Message: Operation finished successfully.
VIBs Installed: Margar_bootbank_upsmon_2.8.0-2.4.1
VIBs Removed:
VIBs Skipped:
Reboot Required: false
DPU Results:
Best,
Will
Hi,
I am trying this for the first time on a new server, I installed the latest version 2.8.2 on ESXi 8.0 and configured the UserVars, trying to connect to the nut server running on my homeassistant installation. I am able to connect from other machines to that nut server, but not from ESXi.
ESXI configuration:
UserVars.NutUpsName = homeassistant
UserVars.NutUser = esxi
UserVars.NutPassword = mypassword
but I get this error in ESXi's syslog.log
:
[root@esxi02:/opt/nut/etc] grep upsmon /var/log/syslog.log | tail
2024-04-24T21:57:03.005Z In(30) upsmon[3238608]: Startup successful
2024-04-24T21:57:03.005Z In(30) upsmon[3238608]: Warning: running as one big root process by request (upsmon -p)
2024-04-24T21:57:03.015Z Db(31) upsmon[3238608]: upsnotify: failed to notify about state 2: no notification tech defined, will not spam more about it
2024-04-24T21:57:03.019Z Er(27) upsmon[3238608]: Login on UPS [fsp@homeassistant] failed - got [ERR ACCESS-DENIED]
But if I run upsc, I can successfully connect (without supplying credentials???)
[root@esxi02:/opt/nut/etc] /opt/nut/bin/upsc fsp@homeassistant
battery.charge: 100
battery.energysave: no
battery.packs: 1
battery.protection: yes
battery.runtime: 5820
battery.voltage: 82.10
battery.voltage.nominal: 72.0
...etc
Is there any obvious mistake I am making?
I don't understand why upsc
can connect (without credentials) and upsmon
cannot.
My ESXi host can take a good few minutes to shut down and I would like to specify a threshold of, say, 40% battery charge level at which I would like to initiate a shutdown.
I used to have the following settings when my TrueNAS was running on the same UPS and I would like to reproduce them with my NutClient on my now ESXi host:
override.battery.charge.low = 40
override.battery.charge.warning = 60
How could the above be achieved?
Dear Rene,
The version of my ESXi host is ESXi-7.0U3d-19482537
I am installed actual NutClient-ESXi module and its working fine with the default timers:
After NUT notified the ESXi host of the low battery, it immediately shut down.
I tryed to change the UserVars.NutOnBatteryDelay parameter to 10 seconds and restarted the server:
Everething is fine, NUT client was runned:
After 55 seconds ESXi continued to work:
Of course, while I was running the test, all the VMs were down. And I expected the host to shut down immediately after 10 seconds. But it still worked.
Do you think that I missed something? Or this is a bug?
Hi René
I'm French but keep english for all users.
Synology can make an UPS Server but we can't add user and password, just with IP address source.
It's possible to implement a variable to bypass this ?
I can't leave blank user/password, the service not start.
Tk a lot!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.