Monitor UPS workstations in Windows with Network UPS Tools

    When does the task arise to monitor workstations without failures? Squeaked - replaced, the end. Repairing UPSs is a thankless task, changing batteries — not everyone wants to mess around (or even moveton).

    So I thought, especially after a series of UPS with failed electronics. The situation was aggravated by software from manufacturers. He, as if to put it mildly, junk. And at all - APC, Ippon, Powercom, TrippLite. What server that for workstations. Trying the paid versions after the experience with free ones - no desire has arisen. But quite fun when UPS from different manufacturers.

    But still need to monitor. The advantages are obvious: 1) you can change the UPS before it gives a farewell squeak; 2) you can immediately see where the battery died, and where the electronics.
    The minus is as simple as ever: the cost of the solution, in money or man-hours.

    This problem will be solved.

    If we have a zoo, then the most adequate way is Network UPS Tools .

    According to him there is little information about Windows, but there is no GUI yet. But we will solve it .

    In fairness it should be noted that there is a similar project in Python . But I personally find it completely unnecessary to use Python (and similar technical solutions) where you can get by with a couple of lines of native scripting.

    • This is not a “turnkey solution”.
    • This is not a sentence, but a story.
    • Yes, there is Zabbix, Cacti, etc, and these are heavyweight solutions for large companies that require a dedicated server and still some kind of intermediate layer to support the appropriate UPS protocol.
    • With all of the above, the solution is quite simple, easy enough and costs 0 currency.

    Of course, to collect information will need UPS with the info port. I have problems with IPPON COM-port, everything else works with a bang.

    Usually for workstations using the connection of the UPS via USB, this case and consider. It is necessary to install NUT on all workstations with UPS.
    Possible problems with this:

    • > The libusb driver should be installed separately . Those included do not understand all UPSs;
    • If libusb suggests the standard name HID UPS Battery , you need to change it - with a standard name some systems for some reason do not see the UPS;
    • if the installation process has the message " Driver without digital signature ", then it must be reinstalled by hand , otherwise it flies;
    • if libusb did not recognize the UPS model, then the first time the driver is set to INCORRECT! This is indicated by the error "upsmon ERROR ACCESS DENIED", or the driver simply flies. It is necessary: ​​to stop the NUT service, remove the libusb driver, wait until the “USB input device” is installed, manually select the libusb driver for it again;
    • For NUT , third-party libraries are needed , which are not included in the installation kit. Setup talks about this, but who reads it :) Plus, often the systems already have software with these libraries. Exactly needed: libeay32.dll, ssleay32.dll, libgcc_s_dw2-1.dll (available in the NUT-bin folder), libusb.dll (available in the libusb distribution), msvcr71.dll (included in Net Framework 1.1). All these files must be in the Windows \ System32 folder;
    • sometimes you need to specify bus = "bus-0" for USB UPS in ups.conf;
    • on fast machines and on some network cards, the NUT service starts earlier than the driver and / or network interface. In this case, the startup type “Startup (delayed launch)” results in the error “upsc ERROR DATA STALE”. Solution: create a task that will check for the presence of the upsd process when an event with code 1 appears from the source “Network UPS Tools” and restart the Network UPS Tools service download the xml file of the task download script (must be in the NUT \ others folder).

    An example script of semi-automatic installation of NUT on clients:

    N:\NUT-Installer-2.6.5-6.msi /qncopyN:\dll\ssleay32.dllC:\Windows\System32 /YcopyN:\dll\libeay32.dllC:\Windows\System32 /YcopyN:\dll\libgcc_s_dw2-1.dllC:\Windows\System32 /YcopyN:\dll\libusb.dllC:\Windows\System32 /YcopyN:\etc\* "%programfiles%\NUT\etc"
    rem добавляем IP-адрес клиента в конфиг NUT автоматическиSETIP=
    remUncommentthefollowinglinewhenusingWindows 7 (withremoving "rem")!
    REMechoNetworkConnectionTestfor /f "usebackqtokens=2 delims=:" %%fin (`ipconfig ^| findstr /c:%ip_address_string%`) doSETIP=%%fECHOLISTEN %IP% 3493 >> "%programfiles%\NUT\etc\upsd.conf"
    rem Ставим драйвер libusb отдельноN:\libusb-win32-bin-\bin\inf-wizard.exe
    rem Правим конфиги, там буквально две строкиnotepad "%programfiles%\NUT\etc\ups.conf"
    notepad "%programfiles%\NUT\etc\upsmon.conf"
    pausenetuseN: /delete /Y

    How to understand why NUT does not work under Windows:

    • check if nut.exe processes
    • if it is, check upsd.exe and upsmon.exe
    • if upsd is not in the processes, go to nut \ sbin and start by hand:
    • “Upsd cannot be started because there is no dll” - check dll in system32, reboot just in case;
    • "Upsd error creating named pipe" - upsd is already running
    • starts and closes immediately - check the ip-address in upsd.conf in the LISTEN section, especially important if it is on a DHCP machine;
    • Upsd started, but does not see UPS - install or reinstall libusb, check libusb.dll in system32, rename the device from the HID UPS Battery;
    • if upsd started, go to bin and execute upsc our_ups @ localhost
    • “Upsc cannot be started because there is no dll” - check the libraries;
    • “Upsc failed connection unknown error” - check whether upsd and upsmon are running, carefully check the MONITOR section in upsmon.conf, check dll libraries once again;
    • “Upsc error data stale” - either the UPS started up once and no longer works, then reinstall the libusb driver and rename the HID UPS Battery, or the NUT service went up faster than the network interface or USB UPS became visible, restart the service;
    • “Upsmon error ACCESS DENIED” - reinstall the driver as described above.

    For the monitoring server are needed:

    • NUT in standalone mode;
    • any web server with php and mysql. I use Uniform Server
    • MySQL-base and folder www from the repository, and a couple of batch-scripts from the same place.

    Base SQL and www put in the appropriate directories of the web north. Scripts from batch_scripts are copied to the NUT installation folder. We start the web server, go to localhost / index_ups.php . Add any of the client UPS in the format UPS_name @ host. Run the get_ups_list_mysql.cmd script. We are checking. Enjoy What can we see useful, besides the current state? For example:


    • if the minimum battery voltage is close to 10, it is better to replace it in advance;
    • at normal voltages, the failure of the UPS will most likely be related to the failure of the electronics (yours, KO);
    • a load of more than 70 percent is undesirable, 100 is not normal, if not associated with the self-test event;
    • A minimum battery charge of less than 30% indicates a battery failure or incorrect auto shut-off settings when it is discharged on the client.

    A few points:

    • columns can be sorted by clicking on the header;
    • maximum / minimum values ​​are displayed through a slash to the current, critical values ​​are marked in red;
    • be careful with the self-test button.

    If someone has problems with the installation / operation of NUT under Windows - write, let's figure it out together.

    Thanks for attention!

    Only registered users can participate in the survey. Sign in , please.

    What software do you use to monitor UPS workstations?

    Also popular now: