查看网上一些关于Cacti监控LVS文章,都说的有点复杂,还需要编译。其实直接下载就可以,然后copy三个文件和执行一条命令就哦了。
先下载MIB文件,
- [root@LVS02 /]# wget http://www.loadbalancer.org/download/SNMP/LVS-MIB.txt
- [root@LVS02 /]# wget http://www.loadbalancer.org/download/SNMP/OC-MIB.txt
或者下载压缩包,解压得到。
- wget http://www.loadbalancer.org/download/SNMP/net-snmp-lvs-module-0.0.4.tar.gz
然后copy到目录
- cp LVS-MIB.txt /usr/share/snmp/mibs/
- cp OC-MIB.txt /usr/share/snmp/mibs/
再下载so文件并复制到目录,如果是64bit的系统,需下载64bit的so文件。
- wget http://www.loadbalancer.org/download/SNMP/32bit/libnetsnmplvs.so
- cp libnetsnmplvs.so /usr/lib/libnetsnmplvs.so
再执行命令snmptranslate,如有没有,需安装net-snmp-utils
- yum install net-snmp-utils
- snmptranslate -m LVS-MIB -On -IR lvsServiceEntry
最后,编辑snmp.conf,添加如下参数。
- [root@LVS02 mibs]# vi /etc/snmp/snmpd.conf
- dlmod lvs /usr/lib/libnetsnmplvs.so
重启snmp,就可以抓到LVS的数据了。
- [root@LVS02 /]# snmpwalk -c public -v 2c -m LVS-MIB localhost 1.3.6.1.4.1.8225.4711 |more
- LVS-MIB::lvsVersion.0 = STRING: "1.2.1"
- LVS-MIB::lvsNumServices.0 = INTEGER: 11
- LVS-MIB::lvsHashTableSize.0 = INTEGER: 4096
- LVS-MIB::lvsTcpTimeOut.0 = INTEGER: 900
- LVS-MIB::lvsTcpFinTimeOut.0 = INTEGER: 120
- LVS-MIB::lvsUdpTimeOut.0 = INTEGER: 300
- LVS-MIB::lvsDaemonState.0 = INTEGER: none(0)
- LVS-MIB::lvsServiceNumber.1 = INTEGER: 1
- LVS-MIB::lvsServiceNumber.2 = INTEGER: 2
- LVS-MIB::lvsServiceNumber.3 = INTEGER: 3
- LVS-MIB::lvsServiceNumber.4 = INTEGER: 4
- LVS-MIB::lvsServiceNumber.5 = INTEGER: 5
- LVS-MIB::lvsServiceNumber.6 = INTEGER: 6
- LVS-MIB::lvsServiceNumber.7 = INTEGER: 7
- LVS-MIB::lvsServiceNumber.8 = INTEGER: 8
- LVS-MIB::lvsServiceNumber.9 = INTEGER: 9
- LVS-MIB::lvsServiceNumber.10 = INTEGER: 10
- LVS-MIB::lvsServiceNumber.11 = INTEGER: 11
- LVS-MIB::lvsServiceSchedType.1 = STRING: "rr"
- LVS-MIB::lvsServiceSchedType.2 = STRING: "rr"
- LVS-MIB::lvsServiceSchedType.3 = STRING: "rr"
- LVS-MIB::lvsServiceSchedType.4 = STRING: "rr"