On 04/04/17 15.19, Arnaud Quette wrote:


2017-04-04 14:18 GMT+02:00 Jon Bendtsen <jon.bendt...@jonix.dk
<mailto:jon.bendt...@jonix.dk>>:

[cuuuuut]



there is a Github issue: https://github.com/networkupstools/nut/issues/415
+ a branch with the implementation:
https://github.com/networkupstools/nut/tree/upsmon_alarm

For now:
- upsmon can react on the ALARM notify type, as with other events, and
WALL+SYSLOG+EXEC...
- I've also fixed the CGI to expose the ALARM flag, which was not done.

A possible improvement would be to send the content of ups.alarm, but that
requires more thinking and time.
And the current implementation already points at this data.

@Jon: would you be able to test this branch and ack? (including the "covers (or
not) my needs...)

I have some trouble installing it, but I succeeded running it from the build directory, see below.

[cuuuuut]

libtool: install: /usr/bin/install -c .libs/libnutclient.so.0.0.0 /usr/local/ups/lib/libnutclient.so.0.0.0 /usr/bin/install: cannot stat '.libs/libnutclient.so.0.0.0': No such file or directory
Makefile:580: recipe for target 'install-libLTLIBRARIES' failed
make[2]: *** [install-libLTLIBRARIES] Error 1
make[2]: Leaving directory '/usr/local/src/nut/clients'
Makefile:1029: recipe for target 'install-am' failed




root@dkvideobackup:/usr/local/src/nut# ls -la clients/.libs/
total 2112
drwxr-sr-x 2 root staff   4096 Apr 10 14:32 .
drwxr-sr-x 4 root staff   4096 Apr 10 14:55 ..
-rw-r--r-- 1 root staff 468820 Apr 10 14:32 libnutclient.a
lrwxrwxrwx 1 root staff     18 Apr 10 14:32 libnutclient.la -> 
../libnutclient.la
-rw-r--r-- 1 root staff    984 Apr 10 14:32 libnutclient.lai
lrwxrwxrwx 1 root staff     21 Apr 10 14:32 libnutclient.so -> 
libnutclient.so.0.0.0
lrwxrwxrwx 1 root staff 21 Apr 10 14:32 libnutclient.so.0 -> libnutclient.so.0.0.0
-rw-r--r-- 1 root staff 237182 Apr 10 14:28 libupsclient.a
lrwxrwxrwx 1 root staff     18 Apr 10 14:28 libupsclient.la -> 
../libupsclient.la
-rw-r--r-- 1 root staff    984 Apr 10 14:28 libupsclient.lai
lrwxrwxrwx 1 root staff     21 Apr 10 14:28 libupsclient.so -> 
libupsclient.so.4.0.0
lrwxrwxrwx 1 root staff 21 Apr 10 14:28 libupsclient.so.4 -> libupsclient.so.4.0.0
-rwxr-xr-x 1 root staff 158768 Apr 10 14:28 libupsclient.so.4.0.0
-rw-r--r-- 1 root staff 419208 Apr 10 14:32 nutclient.o
-rwxr-xr-x 1 root staff  61376 Apr 10 14:32 upsc
-rw-r--r-- 1 root staff  62432 Apr 10 14:28 upsclient.o
-rwxr-xr-x 1 root staff  63968 Apr 10 14:32 upscmd
-rwxr-xr-x 1 root staff 106680 Apr 10 14:32 upsimage.cgi
-rwxr-xr-x 1 root staff  75760 Apr 10 14:32 upslog
-rwxr-xr-x 1 root staff 137408 Apr 10 14:32 upsmon
-rwxr-xr-x 1 root staff  91392 Apr 10 14:32 upsrw
-rwxr-xr-x 1 root staff 113208 Apr 10 14:32 upsset.cgi
-rwxr-xr-x 1 root staff 124888 Apr 10 14:32 upsstats.cgi




So I ran it from the build directory, and here is the WALL I get


Broadcast message from jonbendtsen@dkvideobackup (somewhere) (Mon Apr 10 15:07:

Communications with UPS apc1500@localhost established


Broadcast message from jonbendtsen@dkvideobackup (somewhere) (Mon Apr 10 15:07:

UPS apc1500@localhost has one or more alarms (check ups.alarm)




got CGI scripts up and running, and the status field is indeed now red and says:
ALARM
ONLINE


Network UPS Tools upsstats 2.7.4-367-gf7de20a
Mon Apr 10 15:19:22 CEST 2017
System  Model   Status  Battery         Input (VAC)     Output (VAC)    Load 
(%)        UPS
Temp    Battery
Runtime         Data
Tree
old broken ups  Smart-UPS 1500  ALARM
ONLINE
        100 %   230.4   230.4   0.0 %   32.4 °C         02:05:00        All data


the tree data looks the same old
ups.alarm       :       No battery installed!
ups.status      :       ALARM OL
battery.charge  :       100




I'd say your change is a success :-)



JonB

_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to