[Nut-upsuser] NUT Windows port questions
Denis Serov
dns-srv at yandex.ru
Wed Jan 4 20:26:50 UTC 2012
Hello NUT Team!
I've got some questions about NUT (Windows port), which I couldn't resolve
by myself.
I have a test environment that contains:
1. NUT network server (OS: Debian 6.0.3, x64, NUT 2.4.3)
2. Linux clients (OS: different, NUT 2.4.3, 2.6.1)
3. Windows clients (OS: Windows Standard Server Core 2008 R1 SP1, Windows 7
x64 Ultimate SP1, NUT-Installer-2.6.1-1.msi)
4. APC Back-UPS ES 550 connected to network server
Currently, network server and Linux clients are working well. I can see UPS
variables via "upsc" (server/clients), can shutdown slaves and masters via
"upsmon -c fsd", no problem with timers and early shutdown script, etc...
Now, I am trying to set the same configuration on Windows Server as on Linux
clients and have no success. I use the following configuration (don't carry
about credentials =):
nut.conf
MODE = netclient
upsmon.conf
RUN_AS_USER user
MONITOR mainups at 192.168.10.2 1 monuser secret slave MINSUPPLIES 1
SHUTDOWNCMD "shutdown.exe -s -t 0 -c \"Bla-bla-bla.\""
NOTIFYCMD upssched.exe
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG "C:\\killpower.flag"
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
upsd.users
[user]
password = 123qweASD
[mainups]
password = secret
upsmon slave
upssched.conf
CMDSCRIPT upsscript.cmd
PIPEFN C:\\NUT\\NUT\\upssched.pipe
LOCKFN C:\\NUT\\NUT\\upssched.lock
..
In this configuration, I can see UPS variables, Windows Server is shutting
down on "upsmon -c fsd".
For example:
upsc mainups at 192.168.10.2
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2011/12/30
battery.mfr.date: 2011/12/30
battery.runtime: 6675
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 13.5
battery.voltage.nominal: 12.0
device.mfr: American Power Conversion
device.model: Back-UPS ES 525
..
1. It seems that it is impossible to use long file names with spaces in
PIPEFN/LOCKFN/NOTIFYCMD/... (like "C:\Program Files
(x86)\NUT\sbin\upssched.exe") or I couldn't find the way (error: cannot find
"C:\Program "). Environment variables are not supported too (it would be
great to use %ProgramFiles% in the paths).
This problem is the reason, why I had to use "C:\NUT\NUT" directory for pipe
& lock. Moreover, to start "upssched.exe" via NOTIFYCMD, I included
"C:\Program Files (x86)\NUT\bin" and "C:\Program Files (x86)\NUT\sbin" into
%PATH% variable.
2. I added line "AT ONBATT * EXECUTE Dennis" into end of "upssched.conf".
Then "mainups" is going to battery, NUT writes proper event into Application
Log: "upsmon - UPS mainups at 192.168.10.2 on battery.". It is OK, but strange
thing is that the script "upsscript.cmd" was not executed. I have checked it
several times (even using Process Monitor from sysinternals - process
"upssched.exe" is not started at all). The next interesting thing: I started
"upsmon -DDD" and ... at the next battery event, "upssched.exe" was executed
and "upsscript.cmd" has been executed too.
By default, there are "nut.exe" and one "upsmon.exe" processes in Windows
Server (after its starting). There are two "upsmon" in Linux client. It is
correct situation? Should I start one more instance of "upsmon" to execute
CMDSCRIPT successfully or have I problem in my configs or something else?
3. I have tried to use timers. If remove previous line from "upssched.conf"
and add "AT ONBATT * START-TIMER onbattwarn 3", "AT ONLINE * CANCEL-TIMER
onbattwarn", the behavior will be like in previous item: no running
"upssched.exe" without second instance of "upsmon", but with additional
effects =). "upssched.exe" is starting, "upssched.lock" file is created,
then process is terminated with event "upssched.exe - Failed to connect to
parent and failed to create parent: Permission denied.".
I couldn't fix this problem =(. I've checked the permissions, user's
accounts for all NUT processes/FS/etc. It seems that everything is OK. I
think that the problem is in get_lock function in "upssched.c". No ideas
why, anyway, GetLastError returns "permission denied" strongly.
4. A few times, I've got error "upssched.exe - open /dev/null: No such file
or directory." during my experiments, but I have no idea how to reproduce it
=(
The main question: is there someone who has success with timers on Windows
x64 platform? I would like to use them...
Thanks!
With the best wishes,
Dennis
More information about the Nut-upsuser
mailing list