<br><div class="gmail_quote">2012/10/30 Ing. Ján <span dir="ltr"><<a href="mailto:jan.ondrej@upjs.sk" target="_blank">jan.ondrej@upjs.sk</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br></blockquote><div><br>Hi Ján,<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mon, Oct 29, 2012 at 08:49:03PM +0100, Arnaud Quette wrote:<br>
> 2012/10/25 Ing. Ján <<a href="mailto:jan.ondrej@upjs.sk">jan.ondrej@upjs.sk</a>><br>
<div class="im">> On Wed, Oct 24, 2012 at 10:46:32PM +0200, Arnaud Quette wrote:<br>
</div><div class="im">> > > for now, I'll need the output of the *exact* below commands:<br>
> > > $ snmpget -v1 -c XXX 192.168.14.10 .1.3.6.1.2.1.1.2.0<br>
> > > $ snmpwalk -On -v1 -c XXX 192.168.14.10 .1.3.6.1.4.1.2254.2.4<br>
> > > $ snmpwalk -Os -v1 -c XXX 192.168.14.10 .1.3.6.1.4.1.2254.2.4<br>
> > ><br>
> > > the previous one was missing the -On (forced numeric paths), and I want<br>
> > to<br>
> > > have the 3 output taken at the same time.<br>
> ><br>
> > OK, output of this script attached:<br>
> ><br>
> > snmpget -v1 -c $C $IP .1.3.6.1.2.1.1.2.0 > /tmp/snmpget.log<br>
> > snmpwalk -On -v1 -c $C $IP .1.3.6.1.4.1.2254.2.4 \<br>
> >   | gzip > /tmp/snmpwalk-On.log.gz<br>
> > snmpwalk -Os -v1 -c $C $IP .1.3.6.1.4.1.2254.2.4 \<br>
> >   | gzip > /tmp/snmpwalk-Os.log.gz<br>
> ><br>
><br>
> you'll find attached a first version of gen-snmp-subdriver.sh<br>
> it still needs some more polishing and documentation, but should be usable.<br>
<br>
</div>OK, here are bugs (some of them maybe not important, but I will send all<br>
found bugs):<br>
<br>
./gen-snmp-subdriver.sh --help<br>
...<br>
 -m /path/to/file.mib -- location of the MIB definition file<br>
...<br>
<br>
and:<br>
<br>
./gen-snmp-subdriver.sh -m test<br>
Illegal option -m. Try --help for more info.<br></blockquote><div> <br>hem, forgotten implementation, fixed in the attachment...<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Can I define multiple MIB files with multiple arguments?<br></blockquote><div> <br>this is simply a wrapper around the 'snmpcmd' (i.e works for snmp{walk,get, ...}) "-M DIRLIST"<br><br>I've modified the option for:<br>
-m DIRLIST -- colon separated list of directories to also search for MIBs<br><br>the specified DIRLIST is appended to Net SNMP DIRLIST<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
> note that I've only with mode2 (using your files), but got compiling the<br>
> resulting files.<br>
> it would be nice if you could test the live version (mode 1), and counter<br>
> test mode 2.<br>
><br>
> from there, the mapping work is to be done. this is just an helper tool, to<br>
> facilitate the creation of a new subdriver...<br>
<br>
</div>Ignoring -m parameter will create some files and write:<br>
<br>
* add &netys_subdriver to snmp-ups.c:mib2nut[] list,<br>
<br>
This is content of my netys-mib.h:<br>
<br>
#ifndef NETYS_MIB_H<br>
#define NETYS_MIB_H<br>
#include "main.h"<br>
#include "snmp-ups.h"<br>
extern mib2nut_info_t netys;<br>
#endif /* NETYS_MIB_H */<br>
<br>
And compilation fails:<br>
<br>
snmp-ups.c:69: error: ‘netys_subdriver’ undeclared here (not in a function)<br>
<br>
Removing "_subdriver" will continut compiling.<br></blockquote><div><br>fixed<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Trying to run compiled driver:<br>
<br>
[root@test drivers]# gdb ./snmp-ups<br>
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)<br>
Copyright (C) 2010 Free Software Foundation, Inc.<br>
License GPLv3+: GNU GPL version 3 or later<br>
<<a href="http://gnu.org/licenses/gpl.html" target="_blank">http://gnu.org/licenses/gpl.html</a>><br>
This is free software: you are free to change and redistribute it.<br>
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"<br>
and "show warranty" for details.<br>
This GDB was configured as "x86_64-redhat-linux-gnu".<br>
For bug reporting instructions, please see:<br>
<<a href="http://www.gnu.org/software/gdb/bugs/" target="_blank">http://www.gnu.org/software/gdb/bugs/</a>>...<br>
Reading symbols from /root/rpmbuild/BUILD/nut-2.6.4/drivers/snmp-ups...done.<br>
(gdb) run -a local<br>
Starting program: /root/rpmbuild/BUILD/nut-2.6.4/drivers/snmp-ups -a local<br>
[Thread debugging using libthread_db enabled]<br>
<div class="im">Network UPS Tools - Generic SNMP UPS driver 0.66 (2.6.4)<br>
</div>kill: No such process<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
0x00007ffff75d305a in __strchr_sse2 () from /lib64/libc.so.6<br>
Missing separate debuginfos, use: debuginfo-install<br>
glibc-2.12-1.80.el6_3.5.x86_64 net-snmp-libs-5.5-41.el6_3.1.x86_64<br>
openssl-1.0.0-25.el6_3.1.x86_64 zlib-1.2.3-27.el6.x86_64<br>
(gdb)<br></blockquote><div><br>as told previously, it won't work out of the box!<br>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.<br>
<br>that said, I'm still interested in the test results of mode 1<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My ups.conf:<br>
<br>
[local]<br>
        driver = snmp-ups<br>
        port = 192.168.xx.xx<br>
        desc = "Socomec NETYS RT 2200VA SNMP"<br>
        #mibs = netvision<br>
        mibs = netys<br></blockquote><br>with the sysOID support, specifying "mibs" is not that useful anymore.<br></div><br clear="all">cheers,<br>Arnaud<br>-- <br>Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org" target="_blank">http://www.networkupstools.org</a><br>
Debian Developer - <a href="http://www.debian.org" target="_blank">http://www.debian.org</a><br>Free Software Developer - <a href="http://arnaud.quette.fr" target="_blank">http://arnaud.quette.fr</a><br><br>