[Nut-upsdev] SNMP UPS: NETYS RT 1/1 UPS

Arnaud Quette aquette.dev at gmail.com
Tue Oct 30 20:11:16 UTC 2012


2012/10/30 Ing. Ján <jan.ondrej at upjs.sk>

> Hello,
>

Hi Ján,

On Mon, Oct 29, 2012 at 08:49:03PM +0100, Arnaud Quette wrote:
> > 2012/10/25 Ing. Ján <jan.ondrej at upjs.sk>
> > On Wed, Oct 24, 2012 at 10:46:32PM +0200, Arnaud Quette wrote:
> > > > for now, I'll need the output of the *exact* below commands:
> > > > $ snmpget -v1 -c XXX 192.168.14.10 .1.3.6.1.2.1.1.2.0
> > > > $ snmpwalk -On -v1 -c XXX 192.168.14.10 .1.3.6.1.4.1.2254.2.4
> > > > $ snmpwalk -Os -v1 -c XXX 192.168.14.10 .1.3.6.1.4.1.2254.2.4
> > > >
> > > > the previous one was missing the -On (forced numeric paths), and I
> want
> > > to
> > > > have the 3 output taken at the same time.
> > >
> > > OK, output of this script attached:
> > >
> > > snmpget -v1 -c $C $IP .1.3.6.1.2.1.1.2.0 > /tmp/snmpget.log
> > > snmpwalk -On -v1 -c $C $IP .1.3.6.1.4.1.2254.2.4 \
> > >   | gzip > /tmp/snmpwalk-On.log.gz
> > > snmpwalk -Os -v1 -c $C $IP .1.3.6.1.4.1.2254.2.4 \
> > >   | gzip > /tmp/snmpwalk-Os.log.gz
> > >
> >
> > you'll find attached a first version of gen-snmp-subdriver.sh
> > it still needs some more polishing and documentation, but should be
> usable.
>
> OK, here are bugs (some of them maybe not important, but I will send all
> found bugs):
>
> ./gen-snmp-subdriver.sh --help
> ...
>  -m /path/to/file.mib -- location of the MIB definition file
> ...
>
> and:
>
> ./gen-snmp-subdriver.sh -m test
> Illegal option -m. Try --help for more info.
>

hem, forgotten implementation, fixed in the attachment...

Can I define multiple MIB files with multiple arguments?
>

this is simply a wrapper around the 'snmpcmd' (i.e works for snmp{walk,get,
...}) "-M DIRLIST"

I've modified the option for:
-m DIRLIST -- colon separated list of directories to also search for MIBs

the specified DIRLIST is appended to Net SNMP DIRLIST

> note that I've only with mode2 (using your files), but got compiling the
> > resulting files.
> > it would be nice if you could test the live version (mode 1), and counter
> > test mode 2.
> >
> > from there, the mapping work is to be done. this is just an helper tool,
> to
> > facilitate the creation of a new subdriver...
>
> Ignoring -m parameter will create some files and write:
>
> * add &netys_subdriver to snmp-ups.c:mib2nut[] list,
>
> This is content of my netys-mib.h:
>
> #ifndef NETYS_MIB_H
> #define NETYS_MIB_H
> #include "main.h"
> #include "snmp-ups.h"
> extern mib2nut_info_t netys;
> #endif /* NETYS_MIB_H */
>
> And compilation fails:
>
> snmp-ups.c:69: error: ‘netys_subdriver’ undeclared here (not in a function)
>
> Removing "_subdriver" will continut compiling.
>

fixed


> Trying to run compiled driver:
>
> [root at test drivers]# gdb ./snmp-ups
> GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
> Copyright (C) 2010 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from
> /root/rpmbuild/BUILD/nut-2.6.4/drivers/snmp-ups...done.
> (gdb) run -a local
> Starting program: /root/rpmbuild/BUILD/nut-2.6.4/drivers/snmp-ups -a local
> [Thread debugging using libthread_db enabled]
> Network UPS Tools - Generic SNMP UPS driver 0.66 (2.6.4)
> kill: No such process
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff75d305a in __strchr_sse2 () from /lib64/libc.so.6
> Missing separate debuginfos, use: debuginfo-install
> glibc-2.12-1.80.el6_3.5.x86_64 net-snmp-libs-5.5-41.el6_3.1.x86_64
> openssl-1.0.0-25.el6_3.1.x86_64 zlib-1.2.3-27.el6.x86_64
> (gdb)
>

as told previously, it won't work out of the box!
the mapping (1rst column in the .c file, prefixed with "unmapped...") has
to be edited to use actual NUT variables name, and possibly value lookup.
there is a small example in the .c file.

that said, I'm still interested in the test results of mode 1


> My ups.conf:
>
> [local]
>         driver = snmp-ups
>         port = 192.168.xx.xx
>         desc = "Socomec NETYS RT 2200VA SNMP"
>         #mibs = netvision
>         mibs = netys
>

with the sysOID support, specifying "mibs" is not that useful anymore.

cheers,
Arnaud
-- 
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20121030/e08b2300/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gen-snmp-subdriver.sh.gz
Type: application/x-gzip
Size: 3823 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20121030/e08b2300/attachment.bin>


More information about the Nut-upsdev mailing list