Вы находитесь на странице: 1из 20

Infoblox SNMP Enterprise MIB

Tech Note Abstract


Most network appliances support the Simple Network Management Protocol (SNMP), and many include an enterprise Management Information Base (MIB) which provides access to vendor-specific objects. Infoblox NIOS software includes a rich enterprise MIB which is documented in the Infoblox Administrator Guide. However, there are currently few examples of how administrators can leverage the data available to perform custom monitoring and reporting. This document presents two specific and practical examples that use data available via SNMP to perform reporting, monitoring and trending of DNS and DHCP messages.
Date: 7/7/07 | Version: 1.1

Methodology for report creation


First we define a simple approach or methodology that we will follow to implement our solutions. This provides us with a guide to the steps we will use for our examples: 1. Given a data source, identify the data to report. 2. Extract the data from its source. 3. Store the data in a database over time. 4. Generate reports using the data.

Example Problem Statement


Next we define a problem statement for our examples: We currently have little visibility of the number and rate of DNS and DHCP messages that our Infoblox appliances are processing. We want to leverage the Infoblox enterprise MIB to graph the DNS and DHCP messages processed by our Infoblox appliances over time. Sample DHCP graph The following is a sample graph we will create that provides a daily view of DHCP messages per second:

Infoblox SNMP Enterprise MIB


The Infoblox Administrator Guide [1] describes how to monitor an Infoblox appliance with SNMP, and documents the Infoblox enterprise MIB objects in detail.

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

The Infoblox enterprise MIB modules are available from the Infoblox support site [2] in the downloads section. A single tar file contains the following MIB modules: IB-SMI-MIB.txt IB-TRAP-MIB.txt IB-PLATFORMONE-MIB.txt IB-DNSONE-MIB.txt IB-DHCPONE-MIB.txt These files should be placed in a directory that your SNMP manager will search for MIB modules. Given our problem statement, we are most interested in IB-DNSONE-MIB and IB-DHCPONE-MIB.

Report Creation
Next we will follow the general steps in our methodology. Our focus in this document is steps 1 and 2. 1. Given a data source, identify the data to report A simple method to view all enterprise MIB objects available is to walk the MIB tree from the enterprise node in the tree. The Private Enterprise Code [3] assigned to Infoblox is 7779. The numerical Object Identifier (OID) is .1.3.6.1.4.1.7779 and the textual form is iso.org.dod.internet.private.enterprise.7779. We can perform the MIB tree walk using the snmpwalk utility from the Net-SNMP suite of applications [4]. After the MIB modules have been installed where snmpwalk can find them (see the snmp.conf(5) man page), and SNMP has been enabled on the appliance, you can perform the following: $ snmpwalk -m all -v2c -c public 192.168.1.2 .1.3.6.1.4.1.7779 NOTE: In our example, host 192.168.1.2 is an appliance with DNS and DHCP enabled. This should result in output similar to the following: IB-PLATFORMONE-MIB::ibCPUTemperature.0 = STRING: +45.00 C IB-PLATFORMONE-MIB::ibNetworkMonitorDNSActive.0 = INTEGER: active(1) IB-PLATFORMONE-MIB::ibNetworkMonitorDNSNonAAT1AvgLatency.0 = INTEGER: 28235 [output deleted] IB-DNSONE-MIB::ibBindZoneName."summary" = STRING: summary IB-DNSONE-MIB::ibBindZoneName."infoblox.com" = STRING: infoblox.com IB-DNSONE-MIB::ibBindZoneName."10.in-addr.arpa" = STRING: 10.in-addr.arpa [output deleted] IB-DHCPONE-MIB::ibDHCPSubnetNetworkAddress."10.0.1.0" = STRING: "10.0.1.0" IB-DHCPONE-MIB::ibDHCPSubnetNetworkAddress."10.0.4.0" = STRING: "10.0.4.0" IB-DHCPONE-MIB::ibDHCPSubnetNetworkAddress."10.10.0.0" = STRING: "10.10.0.0" [output deleted]

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

DHCP Statistics We next examine the complete output from snmpwalk more thoroughly to identify any objects containing statistics related to DHCP messages. We see the following interesting objects in IB-DHCPONE-MIB: IB-DHCPONE-MIB::ibDhcpTotalNoOfDiscovers.0 = Counter32: 1693 IB-DHCPONE-MIB::ibDhcpTotalNoOfRequests.0 = Counter32: 10669 IB-DHCPONE-MIB::ibDhcpTotalNoOfReleases.0 = Counter32: 243 IB-DHCPONE-MIB::ibDhcpTotalNoOfOffers.0 = Counter32: 1170 IB-DHCPONE-MIB::ibDhcpTotalNoOfAcks.0 = Counter32: 10353 IB-DHCPONE-MIB::ibDhcpTotalNoOfNacks.0 = Counter32: 119 IB-DHCPONE-MIB::ibDhcpTotalNoOfDeclines.0 = Counter32: 0 IB-DHCPONE-MIB::ibDhcpTotalNoOfInforms.0 = Counter32: 20932 IB-DHCPONE-MIB::ibDhcpTotalNoOfOthers.0 = Counter32: 0 These objects contain a counter for each type of DHCP message sent and received. DNS Statistics Determining which objects we might use for DNS statistics requires a bit more investigation. We see the following per-zone counters in IB-DNSONE-MIB: IB-DNSONE-MIB::ibBindZoneSuccess IB-DNSONE-MIB::ibBindZoneReferral IB-DNSONE-MIB::ibBindZoneNxRRset IB-DNSONE-MIB::ibBindZoneNxDomain IB-DNSONE-MIB::ibBindZoneRecursion IB-DNSONE-MIB::ibBindZoneFailure These are statistics maintained by BIND 9, and are documented as follows in the BIND 9 Administrator Reference Manual [5]: success referral nxrrset The number of successful queries made to the server or zone. A successful query is defined as a query which returns a NOERROR response with at least one answer RR. The number of queries which resulted in referral responses. The number of queries which resulted in NOERROR responses with no data. The number of queries which resulted in a failure response other than those above. The number of queries which caused the server to perform recursion in order to find the final answer.

nxdomain The number of queries which resulted in NXDOMAIN responses. failure recursion

Each query received by the server will cause exactly one of success, referral, nxrrset, nxdomain, or failure to be incremented, and may additionally cause the recursion counter to be incremented. There is a pseudo-zone named "summary" (the textual name includes the quotes) that contains a counter with the total for all zones for each query type. We can obtain the counter for a specific query type using snmpget: $ snmpget -m all -v2c -c public 192.168.1.2 'IB-DNSONEMIB::ibBindZoneFailure."summary"' IB-DNSONE-MIB::ibBindZoneFailure."summary" = Counter32: 2893

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

NOTE: The single quotes are needed in the above ('IB-DNSONEMIB::ibBindZoneFailure."summary"') to quote the double quotes which are part of the object name. 2. Extract the data from its source We have now identified two sets of symbolic OIDs that we will want to query from the SNMP agent on the appliance: DNS IB-DNSONE-MIB::ibBindZoneSuccess."summary" IB-DNSONE-MIB::ibBindZoneReferral."summary" IB-DNSONE-MIB::ibBindZoneNxRRset."summary" IB-DNSONE-MIB::ibBindZoneNxDomain."summary" IB-DNSONE-MIB::ibBindZoneRecursion."summary" IB-DNSONE-MIB::ibBindZoneFailure."summary" DHCP IB-DHCPONE-MIB::ibDhcpTotalNoOfDiscovers.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfRequests.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfReleases.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfOffers.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfAcks.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfNacks.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfDeclines.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfInforms.0 IB-DHCPONE-MIB::ibDhcpTotalNoOfOthers.0 In the next step we will write a small Perl program to query each of these OIDs every minute. We want to use the same program for each set of OIDs, so we will have an argument which specifies a file of OIDs to query. While we could load the MIB modules, and query the symbolic OIDs, in this case the input file will be numeric OIDs, so we want to convert the OID values above to their numerical form. One way to covert these values is using the snmptranslate utility from Net-SNMP. For example: $ snmptranslate -m all -On 'IB-DNSONE-MIB::ibBindZoneSuccess."summary"' .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.2.7.115.117.109.109.97.114.121 $ snmptranslate -m all -On IB-DHCPONE-MIB::ibDhcpTotalNoOfDiscovers.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.1.0 The complete numeric OIDs are as follows: DNS .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.2.7.115.117.109.109.97.114.121 .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.3.7.115.117.109.109.97.114.121 .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.4.7.115.117.109.109.97.114.121 .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.5.7.115.117.109.109.97.114.121 .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.6.7.115.117.109.109.97.114.121 .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.7.7.115.117.109.109.97.114.121 DHCP .1.3.6.1.4.1.7779.3.1.1.4.1.3.1.0

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

.1.3.6.1.4.1.7779.3.1.1.4.1.3.2.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.3.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.4.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.5.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.6.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.7.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.8.0 .1.3.6.1.4.1.7779.3.1.1.4.1.3.9.0 We can perform a test request using a sample OID from each set using the snmpget utility: $ snmpget -v2c -c public 192.168.1.2 .1.3.6.1.4.1.7779.3.1.1.3.1.1.1.2.7.115.117.109.109.97.114.121 SNMPv2-SMI::enterprises.7779.3.1.1.3.1.1.1.2.7.115.117.109.109.97.114.121 = Counter32: 5527390 $ snmpget -v2c -c public 192.168.1.2 .1.3.6.1.4.1.7779.3.1.1.4.1.3.1.0 SNMPv2-SMI::enterprises.7779.3.1.1.4.1.3.1.0 = Counter32: 1878 NOTE: In this case we did not have to specify the -m option to load the MIB modules. 3. Store the data in a database over time Next we will need to periodically query the OIDs we have identified and store them in a database. For our examples, we will use the RRDtool [6] utility, which is a very flexible data logging and graphing application. As stated previously, our focus in this document is on the 2 items above. We will provide complete working examples, however we will not spend much time discussing the details of RRDtool. We first need to create the RRDtool Round Robin Databases (RRDs) that we will store the results of the SNMP queries in. We create one each for DHCP and DNS as follows: DHCP $ rrdtool create dhcp1.rrd --step 60 \ DS:discovers:DERIVE:120:0:4294967295 \ DS:requests:DERIVE:120:0:4294967295 \ DS:releases:DERIVE:120:0:4294967295 \ DS:offers:DERIVE:120:0:4294967295 \ DS:acks:DERIVE:120:0:4294967295 \ DS:nacks:DERIVE:120:0:4294967295 \ DS:declines:DERIVE:120:0:4294967295 \ DS:informs:DERIVE:120:0:4294967295 \ DS:others:DERIVE:120:0:4294967295 \ RRA:AVERAGE:0.5:1:60 \ RRA:AVERAGE:0.5:5:288 \ RRA:AVERAGE:0.5:15:672 \ RRA:AVERAGE:0.5:60:720 DNS $ rrdtool create dns1.rrd --step 60 \ DS:success:DERIVE:120:0:4294967295 \ DS:referral:DERIVE:120:0:4294967295 \ DS:nxrrset:DERIVE:120:0:4294967295 \ DS:nxdomain:DERIVE:120:0:4294967295 \

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

DS:recursion:DERIVE:120:0:4294967295 \ DS:failure:DERIVE:120:0:4294967295 \ RRA:AVERAGE:0.5:1:60 \ RRA:AVERAGE:0.5:5:288 \ RRA:AVERAGE:0.5:15:672 \ RRA:AVERAGE:0.5:60:720 The rrdcreate(1) man page provides exact details on creating RRDs and the arguments used above. We have created each RRD with a step size of 1 minute. This is the approximate interval in which we plan to add data into the RRD. We specify a data source (DS) for each of the object counters we will store, give it a name, specify its data source type (DST) as DERIVE, define the heartbeat as 2 minutes and the range as 0-4294967295 (4294967295 is 2^32-1 or the maximum value for a Counter32 variable). We plan to graph this data hourly, daily, weekly and monthly, so we specify a round robin archive (RRA) configuration for each. The data averages for our graphs and the calculation used to determine the rows argument for each RRA are as follows: 1 minute average for 1 hour 60 / 1 = 60 5 minute average for 1 day (24 * 60) / 5 = 288 15 minute average for 1 week (24 * 60 * 7) / 15 = 672 60 minute average for 1 month (24 * 60 * 30) / 60 = 720

Next we will write a Perl program which uses the Net::SNMP [7] module to query each OID in an input file and store the results in an RRD using the RRDp module. The program will perform the following: 1. Parse its command line arguments, including SNMP host, SNMP community, SNMP timeout, path to RRD, path to OID file. 2. Perform a test query for the OID SNMPv2-MIB::sysDescr.0 3. Become a daemon 4. Initialize the RRDp module 5. Every 60 seconds, obtain each OID in the OID input file 6. Add the OID counter values to the RRD using RRDp::cmd The entire program is included in Appendix A. rrdoid.pl usage $ ./rrdoid.pl Usage: rrdoid.pl [-df] [-h host] [-c community] [-t timeout] -r rrdpath -f oidpath OID input files We place the OIDs from above into 2 input files, for example dhcpoid.txt and dnsoid.txt. The order of the OIDs in the file is important: they must be in the same order as the data sources specified when the RRD was created.

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

Starting the Daemons You will need to start an instance of rrdoid.pl for each OID set and Infoblox appliance you will be monitoring. In our example, this requires two running daemons: $ ./rrdoid.pl -h 192.168.1.2 -c public -d -r /var/rrdtool/dns1.rrd -o dnsoid.txt $ ./rrdoid.pl -h 192.168.1.2 -c public -d -r /var/rrdtool/dhcp1.rrd -o dhcpoid.txt NOTE: rrdoid.pl does not need to be run as root, and should not be run as root. We started rrdoid.pl with the -d argument to perform more verbose logging. Logs are written to syslog with the local5 facility. We can verify it is functioning by examine syslog: Jun 13 08:54:05 snmp rrdoid.pl[5105]: "update /var/rrdtool/dns1.rrd N:10854303:3310:2232113:9506402:660676:6031" [delta 1412] Jun 13 08:54:07 snmp rrdoid.pl[4601]: "update /var/rrdtool/dhcp1.rrd N:3468:22925:579:2231:21201:337:0:51579:0" [delta 24] 4. Generate on-demand reports using the data Now we can create graphs from the RRDs using the graph function of RRDtool (see the rrdgraph(1) man page). We provide the complete sample graphs in Appendix B for DNS and DHCP which use rrdcgi to generate updated graphs on-demand. In these examples, we will invoke rrdtool from the command line. DHCP First, let's create an hourly graph using our DHCP data: rrdtool graph dhcphourly1.png \ --start -1h \ --width 700 --height 175 \ --units-exponent 0 \ --vertical-label 'DHCP Messages per Second' \ --title 'DHCP Messages Hourly (1 Minute Average)' \ DEF:d1=dhcp1.rrd:discovers:AVERAGE \ DEF:d2=dhcp1.rrd:requests:AVERAGE \ DEF:d3=dhcp1.rrd:releases:AVERAGE \ DEF:d4=dhcp1.rrd:offers:AVERAGE \ DEF:d5=dhcp1.rrd:acks:AVERAGE \ DEF:d6=dhcp1.rrd:nacks:AVERAGE \ DEF:d7=dhcp1.rrd:declines:AVERAGE \ DEF:d8=dhcp1.rrd:informs:AVERAGE \ DEF:d9=dhcp1.rrd:others:AVERAGE \ AREA:d1#00ff00:Discovers \ STACK:d2#228b22:Requests \ STACK:d3#87ceff:Releases \ STACK:d4#00bfff:Offers \ STACK:d5#ffff00:Acks \ STACK:d6#ff0000:Nacks \ STACK:d7#ffa500:Declines \ STACK:d8#0000ff:Informs \ STACK:d9#708090:Others

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

This creates dhcphourly1.png:

Daily, weekly and monthly graphs can be generated by changing the --start and --title arguments. For example, to create a daily graph we use --start -1d and --title 'DHCP Messages Daily (5 Minute Average):

The weekly and monthly graphs would use --start -1w and --start -1m:

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

DNS The DNS graph is very similar to the DHCP graph; the difference is we do not stack the recursion variable because it will be incremented in addition to one of the other variables if recursion is performed for the answer: rrdtool graph dnsdaily1.png \ --start -1d \ --width 700 --height 175 \ --units-exponent 0 \ --vertical-label 'DNS Query Responses per Second' \ --title 'DNS Query Responses Daily (5 Minute Average)' \ DEF:d1=dns1.rrd:success:AVERAGE \ DEF:d2=dns1.rrd:referral:AVERAGE \ DEF:d3=dns1.rrd:nxrrset:AVERAGE \ DEF:d4=dns1.rrd:nxdomain:AVERAGE \ DEF:d5=dns1.rrd:recursion:AVERAGE \ DEF:d6=dns1.rrd:failure:AVERAGE \ AREA:d1#00ff00:Success \ STACK:d2#87ceff:Referral \ STACK:d3#ffff00:NxRRset \ STACK:d4#ff8c00:NxDomain \ STACK:d6#ff0000:Failure \

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

LINE2:d5#0000ff:Recursion This creates dnsdaily1.png:

Lastly, a sample HTML page which allows you to generate and view current graphs on-demand is provided in Appendix C.

Conclusion
The Infoblox SNMP Enterprise MIB provides access to a large set of variables related to the operating state of an appliance. This data can be used to create custom reports, monitoring applications and trending applications. In this document we have demonstrated this flexibility by creating 2 custom reports that graph DNS and DHCP messages processed by an appliance.

References
[1] The Infoblox Administrator Guide is available from the Infoblox Support Site and also via Help->Download Admin Guide in the Infoblox Grid Manager. http://www.infoblox.com/support/ [2] Infoblox Support Site. http://www.infoblox.com/support/ [3] SMI Network Management Private Enterprise Codes. http://www.iana.org/assignments/enterprise-numbers [4] Net-SNMP suite of applications. http://net-snmp.sourceforge.net/ [5] BIND 9 Administrator Reference Manual. http://www.isc.org/sw/bind/arm93/ [6] RRDtool, logging and graphing application. http://oss.oetiker.ch/rrdtool/

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
[7] Net::SNMP, Object oriented interface to SNMP. http://search.cpan.org/~dtown/Net-SNMP-5.2.0/
Date: 7/7/07 | Version: 1.1

Appendix A: rrdoid.pl
#!/usr/bin/perl -w # # # # # # # # # # # # # # #

Copyright (c) 2007 Infoblox Inc. <info@infoblox.com> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

use strict; use use use use my my my my my my my my Getopt::Std; Net::SNMP qw/:snmp :asn1/; RRDp; FindBin ();

$hostname = 192.168.1.2; $community = 'public'; $timeout = 5; $interval = 60; $foreground = 0; $debug = 0; $rrdpath = ''; $oidpath = '';

my %opts; getopts('dfh:c:t:r:o:', \%opts); $debug = 1 if $opts{'d'}; $foreground = 1 if $opts{'f'}; $hostname = $opts{'h'} if $opts{'h'}; $community = $opts{'c'} if $opts{'c'}; $timeout = $opts{'t'} if $opts{'t'}; $rrdpath = $opts{'r'} if $opts{'r'}; $oidpath = $opts{'o'} if $opts{'o'}; unless ($rrdpath) { print STDERR "Usage: $FindBin::Script [-df] [-h host] [-c community] " . "[-t timeout] -r rrdpath -f oidpath\n";

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

exit 1; } unless (-w $rrdpath) { print STDERR "$rrdpath doesn't exist or not writable\n"; exit 1; } my ($msg, $errmsg); my $oidsref = read_list($oidpath); my ($session, $error) = Net::SNMP->session(-hostname => $hostname, -version => 'v2c', -community => $community, -timeout => $timeout, ); unless (defined $session) { $msg = "Net::SNMP->session(): $error"; chomp $msg; log_fatal($msg); exit 1; } my $testoid = '1.3.6.1.2.1.1.1.0'; # SNMPv2-MIB::sysDescr.0 my $sys = get_request($testoid); unless ($sys) { print STDERR "Can't get SNMPv2-MIB::sysDescr.0 from $hostname\n"; exit 1; } log_info("$hostname: $sys"); my $exit = 0; $SIG{TERM} = \&sig_term_handler; daemon() unless $foreground; RRDp::start 'rrdtool'; $RRDp::error_mode = 'catch'; my ($lastsum, $cursum); GET: while (1) { cleanup_exit() if $exit; my $counters = get_request_list($oidsref); if ($counters && @$counters) {

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

$cursum = 0; foreach my $n (@$counters) { if ($n =~ /^\d+$/) { $cursum += $n; } else { log_warn("non-numeric counter: $n"); sleep $interval; next GET; } } my $counters = join(':', @$counters); my $cmd = "update $rrdpath N:$counters"; $msg = "\"$cmd\""; RRDp::cmd $cmd; if (defined $lastsum) { $msg .= sprintf " [delta %d]", $cursum - $lastsum; } $lastsum = $cursum; log_debug($msg); my $answer = RRDp::read; log_warn($RRDp::error) if $RRDp::error; } else { $msg = "no sample: $errmsg"; log_warn($msg); } sleep $interval; } sub read_list { my $path = shift; open(F, "<$path") or die "Can't open $path: $!"; my @l; my $line; while ($line = <F>) { chomp $line; next if $line =~ /^\s*#/; next if $line =~ /^\s*$/; push(@l, $line); } close F; return \@l; } sub get_request_list { my $oids = shift; my @counters; foreach my $oid (@$oids) { my $counter = get_request($oid); return undef unless defined $counter;

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

push @counters, $counter; } return \@counters; } sub get_request { my $oid = shift; my $result = $session->get_request(-varbindlist => [ $oid ] ); unless (defined $result) { $errmsg = "get_request($oid): " . $session->error; chomp $errmsg; return undef; } $errmsg = ''; return $result->{$oid}; } sub log_error { _log('error', @_); } sub log_warn { _log('warn', @_); } sub log_info { _log('info', @_); } sub log_debug { _log('debug', @_) if $debug; } sub _log { my ($level, $msg) = @_; use Sys::Syslog qw/:DEFAULT setlogsock/; if ($foreground) { print "$msg\n"; } else { my $facility = 'local5'; setlogsock('unix'); # XXX openlog $FindBin::Script, 'pid', $facility; # XXX do once my $_level; $_level = 'err' if $level eq 'error'; $_level = 'warning' if $level eq 'warn'; $_level = 'info' if $level eq 'info'; $_level = 'debug' if $level eq 'debug';

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

syslog $_level, "%s", $msg; closelog; } } sub daemon { use POSIX qw(setsid); defined(my $pid = fork) or die "fork: $!"; exit if $pid; setsid or die "setsid: $!"; chdir '/' or die "chdir(\"/\"): $!"; umask 022; open STDIN, '+>/dev/null' or die "open /dev/null: $!"; open STDOUT, '>&STDIN' or die "dup to STDOUT: $!"; open STDERR, '>&STDIN' or die "dup to STDERR: $!"; } sub sig_term_handler { $exit = 1; } sub cleanup_exit { log_info("exiting"); exit 0; }

Appendix B: dhcp-graph, dns-graph


dhcp-graph #!/usr/local/rrdtool/bin/rrdcgi <RRD::GOODFOR 60> <RRD::SETVAR imagedir /var/rrdtool/png> <RRD::SETVAR rrddir /var/rrdtool> <html> <head> <title>Infoblox: Utility Grade Core Network Services</title> </head> <body> <h2><RRD::CV host> DHCP Statistics</h2> <RRD::GRAPH <RRD::GETVAR imagedir>/hourly-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

--width 700 --height 175 --start -1h --units-exponent 0 --vertical-label 'DHCP Messages per Second' --title 'DHCP Messages Hourly (1 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:discovers:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:requests:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:releases:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:offers:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:acks:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nacks:AVERAGE DEF:d7=<RRD::GETVAR rrddir>/<RRD::CV rrd>:declines:AVERAGE DEF:d8=<RRD::GETVAR rrddir>/<RRD::CV rrd>:informs:AVERAGE DEF:d9=<RRD::GETVAR rrddir>/<RRD::CV rrd>:others:AVERAGE AREA:d1#00ff00:Discovers STACK:d2#228b22:Requests STACK:d3#87ceff:Releases STACK:d4#00bfff:Offers STACK:d5#ffff00:Acks STACK:d6#ff0000:Nacks STACK:d7#ffa500:Declines STACK:d8#0000ff:Informs STACK:d9#708090:Others><p> <RRD::GRAPH <RRD::GETVAR imagedir>/daily-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy --width 700 --height 175 --start -1d --units-exponent 0 --vertical-label 'DHCP Messages per Second' --title 'DHCP Messages Daily (5 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:discovers:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:requests:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:releases:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:offers:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:acks:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nacks:AVERAGE DEF:d7=<RRD::GETVAR rrddir>/<RRD::CV rrd>:declines:AVERAGE DEF:d8=<RRD::GETVAR rrddir>/<RRD::CV rrd>:informs:AVERAGE DEF:d9=<RRD::GETVAR rrddir>/<RRD::CV rrd>:others:AVERAGE AREA:d1#00ff00:Discovers STACK:d2#228b22:Requests STACK:d3#87ceff:Releases STACK:d4#00bfff:Offers STACK:d5#ffff00:Acks STACK:d6#ff0000:Nacks STACK:d7#ffa500:Declines STACK:d8#0000ff:Informs STACK:d9#708090:Others><p>

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

<RRD::GRAPH <RRD::GETVAR imagedir>/weekly-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy --width 700 --height 175 --start -1w --units-exponent 0 --vertical-label 'DHCP Messages per Second' --title 'DHCP Messages Weekly (15 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:discovers:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:requests:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:releases:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:offers:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:acks:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nacks:AVERAGE DEF:d7=<RRD::GETVAR rrddir>/<RRD::CV rrd>:declines:AVERAGE DEF:d8=<RRD::GETVAR rrddir>/<RRD::CV rrd>:informs:AVERAGE DEF:d9=<RRD::GETVAR rrddir>/<RRD::CV rrd>:others:AVERAGE AREA:d1#00ff00:Discovers STACK:d2#228b22:Requests STACK:d3#87ceff:Releases STACK:d4#00bfff:Offers STACK:d5#ffff00:Acks STACK:d6#ff0000:Nacks STACK:d7#ffa500:Declines STACK:d8#0000ff:Informs STACK:d9#708090:Others><p> <RRD::GRAPH <RRD::GETVAR imagedir>/monthly-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy --width 700 --height 175 --start -1m --units-exponent 0 --vertical-label 'DHCP Messages per Second' --title 'DHCP Messages Monthly (60 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:discovers:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:requests:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:releases:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:offers:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:acks:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nacks:AVERAGE DEF:d7=<RRD::GETVAR rrddir>/<RRD::CV rrd>:declines:AVERAGE DEF:d8=<RRD::GETVAR rrddir>/<RRD::CV rrd>:informs:AVERAGE DEF:d9=<RRD::GETVAR rrddir>/<RRD::CV rrd>:others:AVERAGE AREA:d1#00ff00:Discovers STACK:d2#228b22:Requests STACK:d3#87ceff:Releases STACK:d4#00bfff:Offers STACK:d5#ffff00:Acks STACK:d6#ff0000:Nacks

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

STACK:d7#ffa500:Declines STACK:d8#0000ff:Informs STACK:d9#708090:Others><p> </body> </html> dns-graph #!/usr/local/rrdtool/bin/rrdcgi <RRD::GOODFOR 60> <RRD::SETVAR imagedir /var/rrdtool/png> <RRD::SETVAR rrddir /var/rrdtool> <html> <head> <title>Infoblox: Utility Grade Core Network Services</title> </head> <body> <h2><RRD::CV host> DNS Statistics</h2> <RRD::GRAPH <RRD::GETVAR imagedir>/hourly-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy --width 700 --height 175 --start -1h --units-exponent 0 --vertical-label 'DNS Query Responses per Second' --title 'DNS Query Responses Hourly (1 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:success:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:referral:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxrrset:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxdomain:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:recursion:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:failure:AVERAGE AREA:d1#00ff00:Success STACK:d2#87ceff:Referral STACK:d3#ffff00:NxRRset STACK:d4#ff8c00:NxDomain STACK:d6#ff0000:Failure LINE2:d5#0000ff:Recursion><p> <RRD::GRAPH <RRD::GETVAR imagedir>/daily-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy --width 700 --height 175 --start -1d --units-exponent 0

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

--vertical-label 'DNS Query Responses per Second' --title 'DNS Query Responses Daily (5 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:success:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:referral:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxrrset:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxdomain:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:recursion:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:failure:AVERAGE AREA:d1#00ff00:Success STACK:d2#87ceff:Referral STACK:d3#ffff00:NxRRset STACK:d4#ff8c00:NxDomain STACK:d6#ff0000:Failure LINE2:d5#0000ff:Recursion><p> <RRD::GRAPH <RRD::GETVAR imagedir>/weekly-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy --width 700 --height 175 --start -1w --units-exponent 0 --vertical-label 'DNS Query Responses per Second' --title 'DNS Query Responses Weekly (15 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:success:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:referral:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxrrset:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxdomain:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:recursion:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:failure:AVERAGE AREA:d1#00ff00:Success STACK:d2#87ceff:Referral STACK:d3#ffff00:NxRRset STACK:d4#ff8c00:NxDomain STACK:d6#ff0000:Failure LINE2:d5#0000ff:Recursion><p> <RRD::GRAPH <RRD::GETVAR imagedir>/monthly-<RRD::CV image> --imginfo '<IMG SRC=/images/%s WIDTH=%lu HEIGHT=%lu>' --lazy --width 700 --height 175 --start -1m --units-exponent 0 --vertical-label 'DNS Query Responses per Second' --title 'DNS Query Responses Monthly (60 Minute Average)' DEF:d1=<RRD::GETVAR rrddir>/<RRD::CV rrd>:success:AVERAGE DEF:d2=<RRD::GETVAR rrddir>/<RRD::CV rrd>:referral:AVERAGE DEF:d3=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxrrset:AVERAGE DEF:d4=<RRD::GETVAR rrddir>/<RRD::CV rrd>:nxdomain:AVERAGE DEF:d5=<RRD::GETVAR rrddir>/<RRD::CV rrd>:recursion:AVERAGE DEF:d6=<RRD::GETVAR rrddir>/<RRD::CV rrd>:failure:AVERAGE

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Infoblox SNMP Enterprise MIB


Tech Note
Date: 7/7/07 | Version: 1.1

AREA:d1#00ff00:Success STACK:d2#87ceff:Referral STACK:d3#ffff00:NxRRset STACK:d4#ff8c00:NxDomain STACK:d6#ff0000:Failure LINE2:d5#0000ff:Recursion><p> </body> </html>

Appendix C: infoblox.html
<head> <title>Infoblox Appliance Statistics</title> </head> <body> <h3>DHCP Statistics</h3> <ul> <li><a href="/cgi-bin/dhcp-graph?rrd=dhcp1.rrd&image=dhcp1.png&host=infoblox1"> infoblox1 (192.168.1.2)</a> </ul> <h3>DNS Statistics</h3> <ul> <li><a href="/cgi-bin/dns-graph?rrd=dns1.rrd&image=dns1.png&host=infoblox1"> infoblox1 (192.168.1.2)</a> </ul> </body>

2007 Infoblox Inc. All Rights Reserved. All registered trademarks are property of their respective owners. FOR INTERNAL USE ONLY PROPRIETARY AND CONFIDENTIAL

Page #

Вам также может понравиться