[go: up one dir, main page]

0% found this document useful (0 votes)
224 views4 pages

Cacti Creating Templates For Indexed SNMP Data

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
224 views4 pages

Cacti Creating Templates For Indexed SNMP Data

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Cacti: Creating Templates for Indexed SNMP Data

Jason Rahm, 2009-16-06

In the last Cacti article, we walked through creating a graph template off individual static oids. This time out, we're going
to look at how to build a template with a data query based on indexed SNMP mibs.

Gathering Data...

The existing Cacti template, available here, already has the wideIP stats covered. We know, however, that each wideIP
can have multiple pools, and we may want to trend the requests handled in one pool versus another. The SNMP values
we'll need to build the template are in the F5-BIGIP-GLOBAL-MIB.txt file located on the BIG-IP in
/usr/share/snmp/mibs. After searching through the mib for pools, I found the index we'll need to build the template:

[root@ltm01:Active] mibs # snmpwalk -v 2c -c public localhost gtmPoolName


F5-BIGIP-GLOBAL-MIB::gtmPoolName."gpool1" = STRING: gpool1
F5-BIGIP-GLOBAL-MIB::gtmPoolName."gpool2" = STRING: gpool2
F5-BIGIP-GLOBAL-MIB::gtmPoolName."gpool3" = STRING: gpool3

So we see we're getting our pool names, which is great, but the data is not in a helpful format for building the template,
so we need to translate gtmPoolName:

[root@ltm01:Active] mibs # snmptranslate -On F5-BIGIP-GLOBAL-MIB::gtmPoolName


.1.3.6.1.4.1.3375.2.3.6.1.2.1.1

OK, so that oid string is the index we'll need to build the other values. Translations for the data points in the pool:

[root@ltm01:Active] config # snmptranslate -On F5-BIGIP-GLOBAL-MIB::gtmPoolStatPreferred


.1.3.6.1.4.1.3375.2.3.6.2.3.1.2
[root@ltm01:Active] config # snmptranslate -On F5-BIGIP-GLOBAL-MIB::gtmPoolStatAlternate
.1.3.6.1.4.1.3375.2.3.6.2.3.1.3
[root@ltm01:Active] config # snmptranslate -On F5-BIGIP-GLOBAL-MIB::gtmPoolStatFallback
.1.3.6.1.4.1.3375.2.3.6.2.3.1.4
[root@ltm01:Active] config # snmptranslate -On F5-BIGIP-GLOBAL-MIB::gtmPoolStatDropped
.1.3.6.1.4.1.3375.2.3.6.2.3.1.5
[root@ltm01:Active] config # snmptranslate -On F5-BIGIP-GLOBAL-MIB::gtmPoolStatReturnToDns
.1.3.6.1.4.1.3375.2.3.6.2.3.1.7

If you do an snmpwalk on one of the data points above, you'll see that the pool name is appended to the strings above
to make the oid string necessary to poll the statistic for that pool (text & numeric shown, in the numeric representation,
I've highlighted the root in blue and the indexed value in red):

[root@ltm01:Active] config # snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.3375.2.3.6.2.3.1.2


F5-BIGIP-GLOBAL-MIB::gtmPoolStatPreferred."gpool1" = Counter64: 33
F5-BIGIP-GLOBAL-MIB::gtmPoolStatPreferred."gpool2" = Counter64: 68
F5-BIGIP-GLOBAL-MIB::gtmPoolStatPreferred."gpool3" = Counter64: 101
[root@ltm01:Active] config # snmpwalk -v 2c -c public -On localhost .1.3.6.1.4.1.3375.2.3.6.2.3.1.2
.1.3.6.1.4.1.3375.2.3.6.2.3.1.2.6.103.112.111.111.108.49 = Counter64: 33
.1.3.6.1.4.1.3375.2.3.6.2.3.1.2.6.103.112.111.111.108.50 = Counter64: 68
.1.3.6.1.4.1.3375.2.3.6.2.3.1.2.6.103.112.111.111.108.51 = Counter64: 101

Create the XML Query File


Create the XML Query File

Now that we have our data, we need to build the XML file that Cacti will reference for building the oid strings for the
graphs. The oid index is the string we discovered that returns the pool names. The input values are the index and the
pool name, the output values are the data points we want to graph. Following Cacti's SNMP Query XML Syntax, we can
generate our file:

<interface>
<name>Get F5 GTM Pool Statistics</name>
<oid_index>.1.3.6.1.4.1.3375.2.3.6.1.2.1.1</oid_index>
<oid_index_parse>OID/REGEXP:^.*\.3375\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.
[0-9]{1,3}\.[0-9]{1,3}\.(.*)$</oid_index_parse>
<index_order>gtmPoolIndex</index_order>
<index_order_type>alphabetic</index_order_type>
<fields>
<gtmPoolIndex>
<name>Index</name>
<source>index</source>
<direction>input</direction>
</gtmPoolIndex>
<gtmPoolName>
<name>Name</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.3375.2.3.6.1.2.1.1</oid>
</gtmPoolName>
<gtmPoolStatPreferred>
<name>Preferred</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.3375.2.3.6.2.3.1.2</oid>
</gtmPoolStatPreferred>
<gtmPoolStatAlternate>
<name>Alternate</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.3375.2.3.6.2.3.1.3</oid>
</gtmPoolStatAlternate>
<gtmPoolStatFallback>
<name>Fallback</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.3375.2.3.6.2.3.1.4</oid>
</gtmPoolStatFallback>
<gtmPoolStatDropped>
<name>Dropped</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.3375.2.3.6.2.3.1.5</oid>
</gtmPoolStatDropped>
<gtmPoolStatReturnedToDNS>
<name>ReturnedToDNS</name>
<method>walk</method>
<source>value</source>
</gtmPoolStatDropped>
<gtmPoolStatReturnedToDNS>
<name>ReturnedToDNS</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.3375.2.3.6.2.3.1.7</oid>
</gtmPoolStatReturnedToDNS>
</fields>
</interface>

This file needs to be saved to the <cacti_path>/resource/snmp_queries/ directory. I called it f5_gtm_poolStat.xml. Make
sure the permissions are such that Cacti can read the file.

Into the Cacti GUI

The work under the hood is complete, now we can move into the Cacti GUI. For this step, I've recorded a video of the
process.

The scripts I used in perl and powershell to generate the DNS requests are below. Note that the perl script I saved as a
file for reuse, whereas the powershell script is a one-liner at the command line.

Perl:
#!/usr/bin/perl
use strict;
use warnings;
my $host = ARGV[0];
my $wip = ARGV[1];
my $count_max = ARGV[2];
for( my $count = 0; $count <= $count_max; $count++ ) {
system("dig \@$host @wip +nocomments +noquestion +nocmd +nocl +noauthority | grep $wip.*A
| cut -f 5");
}

Powershell:
for($i=0; $i -le 50000; $i++) { nslookup test.wip.com 10.10.20.5 }
F5 Networks, Inc. | 401 Elliot Avenue West, Seattle, WA 98119 | 888-882-4447 | f5.com
F5 Networks, Inc. F5 Networks F5 Networks Ltd. F5 Networks
Corporate Headquarters Asia-Pacific Europe/Middle-East/Africa Japan K.K.
info@f5.com apacinfo@f5.com emeainfo@f5.com f5j-info@f5.com

©2016 F5 Networks, Inc. All rights reserved. F5, F5 Networks, and the F5 logo are trademarks of F5 Networks, Inc. in the U.S. and in certain other countries. Other F5
trademarks are identified at f5.com. Any other products, services, or company names referenced herein may be trademarks of their respective owners with no
endorsement or affiliation, express or implied, claimed by F5. CS04-00015 0113

You might also like