[Nut-upsdev] The new formalism : you can try it
Jonathan Dion
dion.jonathan at gmail.com
Mon Aug 7 14:47:42 UTC 2006
Hi ups-dev !
I bring you some news about my work : it works ^_^
you can now try out the new configuration formalism. I modified upsd,
the drivers and upsmon to use the new formalism and the new parser
(via the libupsconfig library)
The SVN link :
svn co svn://svn.debian.org/nut/branches/JD-NewConf
How to use it :
To test it, I propose that you execute the following commands :
Go to the JD-NewConf directory,
do for instance :
./configure --prefix=/usr/local/nut-new-conf --with-user=nut
Take care, if you use a bad prefix (for instance the same your current
NUT configuration use), your configurations files could be overwritten
! Best idea is to choose a new directory that don't already exist on
your computer.
then :
make && [make usb &&] make install-conf
It compile the sources, copy the base configurations files, et make a
configuration file "nut.conf" in /usr/local/nut-new-con/etc (or
whatever directory you used). This configuration file is on mode none,
that is to say that NUT is not configured yet.
To configure it easilly, use the upsconfig tool (in utils directory)
type :
utils/upsconfig -h
to see the option
For a standard "standalone" configuration using the driver mydriver on
port myport for instance, type :
upscondif --mode standalone --driver mydriver --port myport
(or shorter : upsconfig -d mydriver -p myport).
See more about upsconfig below
you can now launch the driver :
drivers/mydriver -a myups [all options you need]
The upsd server :
server/upsd
and then upsmon
client/upsmon
And use of course all of the others clients.
About upsconfig
Note the upsconfig can only make configuration for simple
configuration : only 1 UPS. It is none interactive, so if you make a
net_server configuration, you'll have to manually modify the acl
value, the allowfrom, and so on.
Whatever mode you use, don't forget to modify passwords in the created
files (users section, either in users.conf or in nut.conf if you used
the single file mode).
By default, the UPS declared by upsconfig is nammed myups, the admin
nutadmin, the upsmon master monmaster and the upsmon slave is nammed
monslave, and the passwords are put to "!", that is to say invalide
password, and users having such a password (or an empty password) will
be ignored.
By default, upsconfig use CONFPATH/base_config directory to find the
nut.conf template to generate the configuration file
(/usr/local/nut-new-conf/etc/base_config in the example).
It use CONFPATH/base_config/comments directory to make the comments in
the configuration file. The comments files must be nammed conf.comm.*
where * correspond to the language, and upsconfig will find the better
for your system.
For instance, if you have conf.comm.C, conf.comm.fr and
conf.comm.fr_BE and your locale LANG is fr_FR.UTF-8, the conf.comm.fr
file will be used. If no match, conf.comm.C will be used (english
language). if this file don't exist, the configuration file will not
be commented
You can change those directories by using -b
<mydir>(--base_config_dir) option. It will then look in mydir for
template and in mydir/comments for comments files.
By defaults, upsconfig save the output file(s) in CONFPATH and
OVERWRITE existent files (nut.conf, ups.conf, upsd.conf, users.conf
and upsmon.conf files only). If you make a configuration in single
file mode and that a file nammed ups.conf existed in CONFPATH, it will
be erased (to prevent to have the confusing situation where all the
configuration is in nut.conf, but there still are some old ups.conf
file).
You can change this directory with the option -t (--target_dir)
Upsconfig will tell you the files it'll use. If you want it to shut
off, just use -q (--quiet). No need to hit it ;-)
The new formalism use "include" directive. You can then make your
configuration file how you want. upsconfig propose two mode : the
"standard" mode, with nut.conf, ups.conf, upsd.conf, users.conf and
upsmon.conf, and the single file mode (only nut.conf). The single file
mode can be use with the option -s (--single).
If you make a net_client configuration, don't forget to use the -u
(for --upsd_server) to set the name (or IP) of the computer which run
upsd in the standard servername[:port] format.
I think it is all for upsconfig
If you find what you think is a bug, please tell me.
I'd be pleasured to hear any suggestion or criticism you could have.
Please feel free to send your feel back.
Cheer,
Jonathan Dion
More information about the Nut-upsdev
mailing list