basically i need to graph In/Out Bytes with Total Bandwidth but not per interface but per ip address.
(testing is done in ubuntu 12.04 lts on virtualbox)
cacti installed via aptitude.
Code: Select all
root@local:~# dpkg -l cacti
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-===========================-===========================-======================================================================
ii cacti 0.8.7i-2ubuntu1 Frontend to rrdtool for monitoring systems and services
root@local:~#
Code: Select all
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:03:07:02 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.105/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.101/24 brd 192.168.0.255 scope global secondary eth0:0
inet6 fe80::a00:27ff:fe03:702/64 scope link
valid_lft forever preferred_lft forever
Cacti by default can monitor eth0 without a problem but when it comes to virtual interfaces net-snmp doesn't seem to provide the necessary outputs.
So, i have created a workaround, but nonetheless i am stuck.
I made 2 chains in iptables trafficin/out in which i use a couple of scripts to automatically add any new eth0:* ip addresses for monitoring purposes and also with the help of iptables i count the sent/received bytes.
Code: Select all
root@local:~# iptables -L -nvx
Chain INPUT (policy ACCEPT 104600 packets, 10653581 bytes)
pkts bytes target prot opt in out source destination
137028 14449962 traffic_in all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 109092 packets, 14312008 bytes)
pkts bytes target prot opt in out source destination
140801 20163171 traffic_out all -- * * 0.0.0.0/0 0.0.0.0/0
Chain traffic_in (1 references)
pkts bytes target prot opt in out source destination
30202 4353440 all -- * !lo 0.0.0.0/0 192.168.0.105
17 1066 all -- * !lo 0.0.0.0/0 192.168.0.101
74200 6284957 all -- * !lo 0.0.0.0/0 127.0.0.1
Chain traffic_out (1 references)
pkts bytes target prot opt in out source destination
34865 8025313 all -- !lo * 192.168.0.105 0.0.0.0/0
27 1738 all -- !lo * 192.168.0.101 0.0.0.0/0
74200 6284957 all -- !lo * 127.0.0.1 0.0.0.0/0
Code: Select all
root@local:~# snmpwalk -v1 -c public localhost .1.3.6.1.4.1.8072.1.3
NET-SNMP-EXTEND-MIB::nsExtendNumEntries.0 = INTEGER: 4
NET-SNMP-EXTEND-MIB::nsExtendCommand."ip_t-iplist" = STRING: /usr/local/sbin/snmp_ips/iptables_traffic_iplist.sh
NET-SNMP-EXTEND-MIB::nsExtendCommand."ip_t-ipindex" = STRING: /usr/local/sbin/snmp_ips/iptables_traffic_iplist.sh
NET-SNMP-EXTEND-MIB::nsExtendCommand."ip_t-traffic_in" = STRING: /usr/local/sbin/snmp_ips/iptables_traffic_eval.sh
NET-SNMP-EXTEND-MIB::nsExtendCommand."ip_t-traffic_out" = STRING: /usr/local/sbin/snmp_ips/iptables_traffic_eval.sh
NET-SNMP-EXTEND-MIB::nsExtendArgs."ip_t-iplist" = STRING: -g
NET-SNMP-EXTEND-MIB::nsExtendArgs."ip_t-ipindex" = STRING: -i
NET-SNMP-EXTEND-MIB::nsExtendArgs."ip_t-traffic_in" = STRING: in
NET-SNMP-EXTEND-MIB::nsExtendArgs."ip_t-traffic_out" = STRING: out
NET-SNMP-EXTEND-MIB::nsExtendInput."ip_t-iplist" = STRING:
NET-SNMP-EXTEND-MIB::nsExtendInput."ip_t-ipindex" = STRING:
NET-SNMP-EXTEND-MIB::nsExtendInput."ip_t-traffic_in" = STRING:
NET-SNMP-EXTEND-MIB::nsExtendInput."ip_t-traffic_out" = STRING:
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."ip_t-iplist" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."ip_t-ipindex" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."ip_t-traffic_in" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."ip_t-traffic_out" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendExecType."ip_t-iplist" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendExecType."ip_t-ipindex" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendExecType."ip_t-traffic_in" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendExecType."ip_t-traffic_out" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."ip_t-iplist" = INTEGER: run-on-read(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."ip_t-ipindex" = INTEGER: run-on-read(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."ip_t-traffic_in" = INTEGER: run-on-read(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."ip_t-traffic_out" = INTEGER: run-on-read(1)
NET-SNMP-EXTEND-MIB::nsExtendStorage."ip_t-iplist" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStorage."ip_t-ipindex" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStorage."ip_t-traffic_in" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStorage."ip_t-traffic_out" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStatus."ip_t-iplist" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendStatus."ip_t-ipindex" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendStatus."ip_t-traffic_in" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendStatus."ip_t-traffic_out" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ip_t-iplist" = STRING: 192.168.0.105
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ip_t-ipindex" = STRING: 1
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ip_t-traffic_in" = STRING: 4405492
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."ip_t-traffic_out" = STRING: 8344465
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ip_t-iplist" = STRING: 192.168.0.105
192.168.0.101
127.0.0.1
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ip_t-ipindex" = STRING: 1
2
3
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ip_t-traffic_in" = STRING: 4405492
1066
6565910
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ip_t-traffic_out" = STRING: 8344465
1738
6566101
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."ip_t-iplist" = INTEGER: 3
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."ip_t-ipindex" = INTEGER: 3
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."ip_t-traffic_in" = INTEGER: 3
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."ip_t-traffic_out" = INTEGER: 3
NET-SNMP-EXTEND-MIB::nsExtendResult."ip_t-iplist" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendResult."ip_t-ipindex" = INTEGER: 3
NET-SNMP-EXTEND-MIB::nsExtendResult."ip_t-traffic_in" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendResult."ip_t-traffic_out" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-iplist".1 = STRING: 192.168.0.105
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-iplist".2 = STRING: 192.168.0.101
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-iplist".3 = STRING: 127.0.0.1
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-ipindex".1 = STRING: 1
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-ipindex".2 = STRING: 2
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-ipindex".3 = STRING: 3
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-traffic_in".1 = STRING: 4405492
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-traffic_in".2 = STRING: 1066
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-traffic_in".3 = STRING: 6565910
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-traffic_out".1 = STRING: 8344465
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-traffic_out".2 = STRING: 1738
NET-SNMP-EXTEND-MIB::nsExtendOutLine."ip_t-traffic_out".3 = STRING: 6566101
root@local:~#
now i need to add an xml file to cacti and i dont really know what to do there.
i've read this http://docs.cacti.net/howto:data_query_ ... is_present
and it does give some info on what i need but i can't seem to figure it out.
i need a data query that gets data from snmp and i need it to return the ip address the bytes in and bytes out.
i've followed this guide http://www.roth.lu/cacti-snmp-tut.htm
my xml looks like this
Code: Select all
<interface>
<name>Get SNMP IPs</name>
<description>Queries a host for a list of IPs with traffic monitored by iptables</description>
<oid_index>.1.3.6.1.4.1.8072.1.3.2.3.1.2.11.105.112.95.116.45.105.112.108.105.115.116</oid_index>
<oid_num_indexes>.1.3.6.1.4.1.8072.1.3.2.3.1.4.12.105.112.95.116.45.105.112.105.110.100.101.120</oid_num_indexes>
<index_order>ipIP:ipIndex</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<ipIndex>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.4.12.105.112.95.116.45.105.112.105.110.100.101.120</oid>
</ipIndex>
<ipIP>
<name>IP Address</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.2.11.105.112.95.116.45.105.112.108.105.115.116</oid>
</ipIP>
<ipInBytes>
<name>Incoming Traffic</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.2.15.105.112.95.116.45.116.114.97.102.102.105.99.95.105.110</oid>
</ipInBytes>
<ipOutBytes>
<name>Outgoing Traffic</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.8072.1.3.2.3.1.2.16.105.112.95.116.45.116.114.97.102.102.105.99.95.111.117.116</oid>
</ipOutBytes>
</fields>
</interface>
Code: Select all
+ Running data query [11].
+ Found type = '3' [SNMP Query].
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/ips.xml'
+ XML file parsed ok.
+ Executing SNMP get for num of indexes @ '.1.3.6.1.4.1.8072.1.3.2.3.1.4.12.105.112.95.116.45.105.112.105.110.100.101.120' Index Count: 3
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.8072.1.3.2.3.1.2.11.105.112.95.116.45.105.112.108.105.115.116' Index Count: 0
+ No SNMP data returned
Success [6 Items, 3 Rows] - 3 ip addresses with in/out bytes each
can i please get a hint ?
thank you