nut client for netware

This is a simple nut client for NetWare (NLM). I use it to shutdown my NetWare server in case of power failure. I have my UPS connected to a linux machine where Network UPS Tools are running. The UPS is connected to the linux machine.
Upsd (and upsmon) is running on the linux machine. The NetWare client will connect to upsd and polls the ups status.



In case upsd signals low Battery (or force shutdown), the NetWare server will shutdown. It can also be configured to shutdown the NetWare server if % battery goes below a certain vailue.

The client (nutmon.nlm) will run on NetWare 4.11 to 6.50, i have it currently running on 5.1. In case you want to use NetWare 4.11, winsock has to be installed. A description on how to install winsock on NetWare 4.11 can be found on the latest support pack in \TOOLS\COREDUMP.

Installation


Copy nutmon.nlm and nutmon.ini to sys:system. Edit sys:system/nutmon.ini and change at least host, user, password and upsname. (User and Password needs to be in /etc/ups/upsd.users on linux) This example
[nw] password = netware allowfrom = acl_netware upsmon slave will define a user nw with password netware and allow connections from acl_netware (as defined in /etc/ups/upsd.conf on linux)

An example nutmon.ini:
[nutmon] ; host-ip where upsd is running host=10.127.33.129 ; username and password for upsd user=nw password=netware ; poll frequency in seconds pollfreq=5 ; poll frequency in seconds (state on_batt) pollfrqalert=5 ; reconnect every x seconds in case of connection failures reconnectFreq=30 ; name of the ups (as in ups.conf) upsname=ups ; debug=1 will show all communication between nutmon and upsd debug=0 ; command to execute after DownFileServer was executed, for ; netware 6.5 this has to be down, for netware 4 exit ; should force netware to return to dos commandAfterDown=down ; this file can be created before the server goes down and will ; be deleted on numon startup. Can be used in autoexec.bat to ; power off the server after netware returns to dos ; if you use APMPWOFF.EXE, specify -f c:\poweroff createPoweroffFile=c:\poweroff ; ; if not 0, down server if on battery and % battery capacity is lower than downIfCapacityBelow=40 After that, load nutmon.nlm, you should see something like (for nw6 on the logger screen):
DAGOBERT:load nutmon Loading module NUTMON.NLM nut ups monitor - clib Version 1.00 21 December 2004 Copyright 2004 Armin Diehl <armin@freepascal.org> nutmon console commands available: ups status - show ups status ups testshutdown - shutdown as if a low power condition is reached nutmon: will shutdown if battery < 40% nutmon: connected to ups@10.127.33.129 nutmon: ups status change from disconnected to online 22.12.2004 21.17.14 : NUTMON-1.0-0 Power/communication Restored, UPS is online
NetWare 6.5 con be configured to power off after a shutdown. For other versions, this can be done with APMPWOFF.EXE (inlcuded in zip-file). APMPWOFF can be added to autoexec.bat after executing SERVER.EXE. To power off only if the shutdown was initiated by a power failure, APMPWOFF has the -f file parameter. If specified, power will only swiched off if the specified file exists. To create that file, edit nutmon.ini and specify i.e. createPoweroffFile=c:\poweroff
The autoexec can be: CD \NWSERVER server -nl cd \ apmpwoff -f \poweroff
To shutdown the server, nutmon uses the DownFileServer api. That api will do the shutdown but will not return to dos and allow APMPWOFF to power off the system. To do that, an additional command that is executed after DownFileServer is finished has to be specified in nutmon.ini. (commandAfterDown=) On netware 6.5 and 5.1 this command should be DOWN, on NetWare 4.11 EXIT.

nutmon will not work if loaded into protected address space because (at least on NetWare 6.5):
1) The DownFileServer api will create an Abend in protected space
2) The ups command will not work in protected space
However, for testing communications with upsd, you can load nutmon into protected space.

Download

The download contains the pre compiled nlm, apmpwoff as well as the nutmon sources for FreePascal and the apmpwoff sources for turbo pascal 7.
Before you ask, the nlm is so big because debug symbols are included. Most of the symbols will not be loaded into memory, they will be used to show a nice call trace in case of a failure.

Download nutmon.zip

License

nutmon is free software distributed under the GNU General Public License.
However, i would appreciate if you drop me a note in case you use this software (or not because it fails or is otherwise ususable for you ;-).


last Update Dec 22, 2004 Armin. Impressum