87 lines
2.4 KiB
Plaintext
87 lines
2.4 KiB
Plaintext
Desc: Using upsmon to make On Screen Display (OSD) notification
|
|
File: osd-notify.txt
|
|
Date: 12 April 2003
|
|
Auth: Arnaud Quette <arnaud.quette@free.fr>
|
|
|
|
This document presents how to display NUT notification using
|
|
an On Screen Display (OSD) system.
|
|
|
|
It is a complement to Russell Kroll's pager.txt, which
|
|
can be found on NUT website, or in NUT source tree. Have
|
|
a look at this document before reading more.
|
|
|
|
Pre requisites
|
|
--------------
|
|
|
|
You must have a running NUT installation (driver, upsd and upsmon).
|
|
Refer, if necessary, to NUT documentation for installing
|
|
and configuring those.
|
|
|
|
You also need X OSD to be installed. You can either:
|
|
- get it on: http://www.ignavus.net/software.html
|
|
- Debian: apt-get install xosd-bin
|
|
- Mandrake: urpmi xosd
|
|
- Others RPM based: get and install xosd (for example, from
|
|
http://rpmfind.net/linux/rpm2html/search.php)
|
|
|
|
Creating osd-notify shell script
|
|
--------------------------------
|
|
|
|
X OSD provides a really nice program, called osd_cat.
|
|
For more information on osd_cat, look at its manpage.
|
|
|
|
For convenience, I've written a small script called
|
|
osd-notify which should be available with the present
|
|
file.
|
|
|
|
You can adjust osd-notify settings to match your needs.
|
|
In particular, you must put a valid font in "FONT".
|
|
Use xfontsel to find one.
|
|
|
|
|
|
Configuring upsmon to use osd-notify
|
|
------------------------------------
|
|
|
|
1) You need to set EXEC flags on the event you want to
|
|
be osd-displayed in upsmon.conf. For example
|
|
|
|
NOTIFYFLAG ONBATT EXEC
|
|
NOTIFYFLAG ONLINE EXEC
|
|
|
|
You can of course set other actions, like WALL or SYSLOG,
|
|
and other events. Look at upsmon.conf manual page.
|
|
|
|
2) Copy osd-notify somewhere on your system (/usr/local/bin
|
|
or whatever).
|
|
|
|
3) Test osd-notify script by calling:
|
|
$> osd-notify NUT
|
|
|
|
4) Tell upsmon where your script is
|
|
|
|
NOTIFYCMD /path/to/osd-notify
|
|
|
|
Show time
|
|
---------
|
|
|
|
You need to adjust X11 access right to allow upsmon's
|
|
user to display OSD notification on your screen. This
|
|
is done with, from within a xterm, by using:
|
|
|
|
$> xhost +local:nutmon
|
|
|
|
Don't forget to adjust upsmon's user name according to
|
|
your system settings. This must match the value of the
|
|
"RUN_AS_USER" field in upsmon.conf
|
|
|
|
Now, restart upsmon, pull the plug, and see what happens...
|
|
|
|
For screenshots, have a look at X OSD website:
|
|
http://www.ignavus.net/software.html
|
|
|
|
Conclusion
|
|
----------
|
|
|
|
What great things we can do with a small nut ;-)
|
|
Feel free to send me your comments and enhancements.
|