lost and found ( for me ? )

how to install libvirt-snmp on Ubuntu 12.10


# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.10
Release:        12.10
Codename:       quantal

# uname -ri
3.5.0-22-generic x86_64

# libvirtd --version
libvirtd (libvirt) 0.9.13

# kvm --version
QEMU emulator version 1.2.0 (qemu-kvm-1.2.0+noroms-0ubuntu2.12.10.2, Debian), Copyright (c) 2003-2008 Fabrice Bellard

[ install libvirt-snmp ]

download libvirt-snmp via git
#  git clone git://libvirt.org/libvirt-snmp.git

# cd libvirt-snmp

error
# ./autobuild.sh
<snip>
checking for LIBVIRT... no
configure: error: Package requirements (libvirt >= 0.8.0) were not met:

No package 'libvirt' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBVIRT_CFLAGS
and LIBVIRT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

no libvirt traces..
# pkg-config --list-all | grep libvirt
#

it seems that I need to install libvirt library
# apt-get install libvirt-dev

# pkg-config --list-all | grep libvirt
libvirt                        libvirt - libvirt library

again .. error
# ./autobuild.sh
<snip>
config.status: creating config.h
config.status: executing depfiles commands

Now type 'make' to compile libvirt-snmp.

make
make  all-recursive
make[1]: Entering directory `/root/libvirt-snmp/build'
Making all in src/
make[2]: Entering directory `/root/libvirt-snmp/build/src'
gcc -DHAVE_CONFIG_H -I. -I../../src -I..     -DNETSNMP_ENABLE_IPV6 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.14/CORE -D_FORTIFY_SOURCE=2 -I/usr/include     -g -O2 -MT libvirtMib_subagent-libvirtGuestTable_data_get.o -MD -MP -MF .deps/libvirtMib_subagent-libvirtGuestTable_data_get.Tpo -c -o libvirtMib_subagent-libvirtGuestTable_data_get.o `test -f 'libvirtGuestTable_data_get.c' || echo '../../src/'`libvirtGuestTable_data_get.c
../../src/libvirtGuestTable_data_get.c:24:38: fatal error: net-snmp/net-snmp-config.h: No such file or directory
compilation terminated.
make[2]: *** [libvirtMib_subagent-libvirtGuestTable_data_get.o] Error 1
make[2]: Leaving directory `/root/libvirt-snmp/build/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/libvirt-snmp/build'
make: *** [all] Error 2


I forgot installing snmp related packages which are required to build libvirt-snmp.
install snmp packages which are required to build libvirt-snmp
# apt-get install snmp snmpd libsnmp-dev libsnmp-perl –y

# ./autobuild.sh


libvirt-snmp.tgz will be created under “libvirt-snmp/build” directory.
# ls ~/libvirt-snmp/build/*.tar.gz
/root/libvirt-snmp/build/libvirt-snmp-0.0.3.tar.gz


build
# cp libvirt-snmp/build/libvirt-snmp-0.0.3.tar.gz /root/
# tar xzvf libvirt-snmp-0.0.3.tar.gz
# cd libvirt-snmp-0.0.3/
# ./configure
# make
# make install

# which libvirtMib_subagent
/usr/local/bin/libvirtMib_subagent


[ snmp configuration ]
# cat /etc/snmp/snmpd.conf
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1
access  notConfigGroup ""      any       noauth    exact  systemview systemview none
access MyRWGroup ""      any       noauth    0      all    all    all
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
master agentx
agentX Socket /var/agentx/master
trap2sink localhost public


restart snmpd
# /etc/init.d/snmpd restart
* Restarting network management services:


start libvirtMib_subagent
# LIBVIRT_DEFAULT_URI="qemu:///system" libvirtMib_subagent -f -L
NET-SNMP version 5.4.3 AgentX subagent connected


send snmp packets
nnn , can’t find MIBs..
# snmpbulkwalk -c public -v2c localhost . -m ALL | head -5
MIB search path: /root/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (SNMPv2-SMI): At line 10 in /usr/share/mibs/netsnmp/LIBVIRT-MIB.txt
Cannot find module (SNMPv2-TC): At line 14 in /usr/share/mibs/netsnmp/LIBVIRT-MIB.txt
Did not find 'enterprises' in module #-1 (/usr/share/mibs/netsnmp/LIBVIRT-MIB.txt)
<snip>

check MIB path
# net-snmp-config --default-mibdirs
/root/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp

download MIBs
# apt-get install -y snmp-mibs-downloader

some errors were displayed , however I was able to translate SNMP GET replies with MIBs.
# snmpbulkwalk -v 2c -c public localhost -OX libvirtMIB -m all
Undefined OBJECT-GROUP (diffServMIBMultiFieldClfrGroup): At line 2195 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Undefined OBJECT-GROUP (diffServMultiFieldClfrNextFree): At line 2157 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Undefined OBJECT-GROUP (diffServMIBMultiFieldClfrGroup): At line 2062 in /usr/share/mibs/ietf/IPSEC-SPD-MIB
Bad operator (INTEGER): At line 73 in /usr/share/mibs/ietf/SNMPv2-PDU
Unlinked OID in IPATM-IPMC-MIB: marsMIB ::= { mib-2 57 }
Undefined identifier: mib-2 near line 18 of /usr/share/mibs/ietf/IPATM-IPMC-MIB
Expected "::=" (RFC5644): At line 493 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Expected "{" (EOF): At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad object identifier: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
Bad parse of OBJECT-IDENTITY: At line 651 in /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB
LIBVIRT-MIB::libvirtGuestName[STRING: 4866b0fd-b782-45ad-3b73-c480960ea08f] = STRING: "ubuntu12-04-vm1"
LIBVIRT-MIB::libvirtGuestName[STRING: 486887f5-2501-75ec-33a7-9985911fe0a1] = STRING: "ubuntu12-04-vm2"
<snip>

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.