Utilisation de smidump

Compilation de smidump

La compilation du package libsmi-0.4.3 ne pose pas de soucis :
$ cd libsmi-0.4.3
$ ./configure
$ make
$ sudo make install

Les application sont installees dans /usr/local/bin :

$ cd /usr/local/lib
$ ls -lsa libsmi*
1064 -rwxr-xr-x 1 philippe philippe 544568 Nov 3 17:10 libsmi.2.0.23.dylib
8 lrwxr-xr-x 1 root wheel 19 Nov 3 17:10 libsmi.2.dylib -> libsmi.2.0.23.dylib
1240 -rw-r--r-- 1 root wheel 633936 Nov 3 17:10 libsmi.a
8 lrwxr-xr-x 1 root wheel 19 Nov 3 17:10 libsmi.dylib -> libsmi.2.0.23.dylib
8 -rwxr-xr-x 1 philippe philippe 811 Nov 3 17:10 libsmi.la

Une fois le package compile, vous pouvez voir qu'il a installe beaucoup de MIB standard dans le repertoire /usr/local/share. Plus exactement les repertoires mibs et pibs

$ cd /usr/local/share
$ ls
aclocal doc gettext locale mibs snmp
curl emacs glib-2.0 man pibs
$ cd mibs/
$ ls
iana ietf irtf site tubs
$ cd ietf/
$ ls IF*

Utilisation typique de smidump

Il convient de regarder les options qui sont proposees :
$ /usr/local/bin/smidump -h

We want to use netsnmp library and generate a code for a client (not an agent), we need the following flags :
-f netsnmp --netsnmp-no-agt-stubs

$ /usr/local/bin/smidump -f netsnmp  --netsnmp-no-agt-stubs -o iftable /usr/local/share/mibs/ietf/IF-MIB
/usr/local/share/mibs/ietf/IF-MIB:1112: index element `ifRcvAddressAddress' of row `ifRcvAddressEntry' must have a size restriction
smidump: module `/usr/local/share/mibs/ietf/IF-MIB' contains errors, expect flawed output

We now have two files :
$ ls if*
iftable-mgr-stub.c iftable.h

Des MIB utiles sont :
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o snmpv2_mib /usr/local/share/mibs/ietf/SNMPv2-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o entity_mib /usr/local/share/mibs/ietf/ENTITY-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o host_resources_mib /usr/local/share/mibs/ietf/HOST-RESOURCES-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o bridge_mib /usr/local/share/mibs/ietf/BRIDGE-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o disman_script_mib /usr/local/share/mibs/ietf/DISMAN-SCRIPT-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o printer_mib /usr/local/share/mibs/ietf/Printer-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o tcp_mib /usr/local/share/mibs/ietf/TCP-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o ip_forward_mib /usr/local/share/mibs/ietf/IP-FORWARD-MIB
$ /usr/local/bin/smidump -f netsnmp --netsnmp-no-agt-stubs -o rfc1213_mib /usr/local/share/mibs/ietf/RFC1213-MIB

Web philippe.laval.free.fr

© Philippe Laval, 2003-2006