Check-in Number:
|
4664 | |
Date: |
2004-Jul-30 11:37:04 (local)
2004-Jul-30 09:37:04 (UTC) |
User: | thl |
Branch: | |
Comment: |
add swBind probe and MIB for named(8) |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/snmpdx/snmpdx.d/swBind.pm -> 1.1
*** /dev/null Sat Nov 23 05:12:54 2024
--- - Sat Nov 23 05:13:30 2024
***************
*** 0 ****
--- 1,93 ----
+ ##
+ ## OSSP snmpdx - SNMP Daemon Extension
+ ## Copyright (c) 2003 The OSSP Project <http://www.ossp.org/>
+ ## Copyright (c) 2003 Ralf S. Engelschall <rse@engelschall.com>
+ ## Copyright (c) 2003 Cable & Wireless <http://www.cw.com/>
+ ##
+ ## This file is part of OSSP snmpdx, a SNMP daemon extension which
+ ## can be found at http://www.ossp.org/pkg/tool/snmpdx/.
+ ##
+ ## This program is free software; you can redistribute it and/or
+ ## modify it under the terms of the GNU General Public License
+ ## as published by the Free Software Foundation; either version
+ ## 2.0 of the License, or (at your option) any later version.
+ ##
+ ## This program is distributed in the hope that it will be useful,
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ## General Public License for more details.
+ ##
+ ## You should have received a copy of the GNU General Public License
+ ## along with this file; if not, write to the Free Software
+ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ## USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
+ ##
+ ## swBind.pm: probe for Software, Bind (aka named)
+ ##
+
+ package My::Probe::swBind;
+ our @ISA = qw(My::Probe);
+
+ sub oids ($) {
+ my ($self) = @_;
+ return $self->{-ctx}->{-mib}->oids("*.snmpdx.host.software.swBind.*");
+ }
+
+ sub probe ($$) {
+ my ($self, $obj) = @_;
+ my $openpkg = $self->{-ctx}->{-opt}->{openpkg};
+
+ # local workspace
+ my $out; my $raw;
+ my $rndc = "$openpkg/sbin/rndc";
+ my $file = "$openpkg/var/bind/named.stats"; #"statistics-file" setting in "option" section in named.conf
+
+ ### query status via rndc(8)
+ $out = $self->{-ctx}->{-sys}->run("$rndc status 2>/dev/null", "1m");
+ $raw = $out->{-stdout};
+ my $swBindStatusNumberOfZones = $1 if ($raw =~ m/number of zones: (\d+)/s );
+ my $swBindStatusDebugLevel = $1 if ($raw =~ m/debug level: (\d+)/s );
+ my $swBindStatusXfersRunning = $1 if ($raw =~ m/xfers running: (\d+)/s );
+ my $swBindStatusXfersDeferred = $1 if ($raw =~ m/xfers deferred: (\d+)/s );
+ my $swBindStatusSoaQueries = $1 if ($raw =~ m/soa queries in progress: (\d+)/s);
+ my $swBindStatusQueryLogging = $1 if ($raw =~ m/query logging is (^\n)+/s );
+
+ ## query stats via rndc(8)
+ $self->{-ctx}->{-sys}->run("$rndc stats 2>/dev/null", "1m");
+ $raw = "";
+ open(STATS, "<$file");
+ if (defined STATS) {
+ while (<STATS>) {
+ if (m/^\+\+\+/) {
+ $raw = ""
+ } else {
+ $raw .= $_
+ }
+ }
+ close(STATS);
+ };
+ my $swBindStatsSuccess = $1 if ($raw =~ m/success (\d+)/s );
+ my $swBindStatsReferral = $1 if ($raw =~ m/referral (\d+)/s );
+ my $swBindStatsNxrrset = $1 if ($raw =~ m/nxrrset (\d+)/s );
+ my $swBindStatsNxdomain = $1 if ($raw =~ m/nxdomain (\d+)/s );
+ my $swBindStatsRecursion = $1 if ($raw =~ m/recursion (\d+)/s);
+ my $swBindStatsFailure = $1 if ($raw =~ m/failure (\d+)/s );
+
+ # provide results
+ if ($obj->{-name} =~ m|\.swBindStatusNumberOfZones$|) { $obj->{-value} = $swBindStatusNumberOfZones ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatusDebugLevel$| ) { $obj->{-value} = $swBindStatusDebugLevel ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatusXfersRunning$| ) { $obj->{-value} = $swBindStatusXfersRunning ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatusXfersDeferred$|) { $obj->{-value} = $swBindStatusXfersDeferred ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatusSoaQueries$| ) { $obj->{-value} = $swBindStatusSoaQueries ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatusQueryLogging$| ) { $obj->{-value} = $swBindStatusQueryLogging ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatsSuccess$| ) { $obj->{-value} = $swBindStatsSuccess ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatsReferral$| ) { $obj->{-value} = $swBindStatsReferral ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatsNxrrset$| ) { $obj->{-value} = $swBindStatsNxrrset ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatsNxdomain$| ) { $obj->{-value} = $swBindStatsNxdomain ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatsRecursion$| ) { $obj->{-value} = $swBindStatsRecursion ; }
+ elsif ($obj->{-name} =~ m|\.swBindStatsFailure$| ) { $obj->{-value} = $swBindStatsFailure ; }
+ return;
+ }
+
+ 1;
+
|
|
ossp-pkg/snmpdx/snmpdx.mib/snmpdx.mib 1.13 -> 1.14
--- snmpdx.mib 2004/07/30 09:35:44 1.13
+++ snmpdx.mib 2004/07/30 09:37:05 1.14
@@ -673,4 +673,108 @@
DESCRIPTION "time package was installed"
::= { swOpPkgENTRY 6 }
+--
+-- BIND
+--
+
+swBind OBJECT IDENTIFIER
+ ::= { software 3 }
+
+--
+-- BIND status ("rndc status")
+--
+
+swBindStatus OBJECT IDENTIFIER
+ ::= { swBind 1 }
+
+swBindStatusNumberOfZones OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "number of zones"
+ ::= { swBindStatus 1 }
+
+swBindStatusDebugLevel OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "debug level"
+ ::= { swBindStatus 2 }
+
+swBindStatusXfersRunning OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "xfers running"
+ ::= { swBindStatus 3 }
+
+swBindStatusXfersDeferred OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "xfers deferred"
+ ::= { swBindStatus 4 }
+
+swBindStatusSoaQueries OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "SOA queries in progress"
+ ::= { swBindStatus 5 }
+
+swBindStatusSoaQueries OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "SOA queries in progress"
+ ::= { swBindStatus 6 }
+
+--
+-- BIND statistics ("rndc stats")
+--
+swBindStats OBJECT IDENTIFIER
+ ::= { swBind 2 }
+
+swBindStatsSuccess OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "Successful Queries"
+ ::= { swBindStats 1 }
+
+swBindStatsReferral OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "Referrals"
+ ::= { swBindStats 2 }
+
+swBindStatsNxrrset OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "Nx RR Set"
+ ::= { swBindStats 3 }
+
+swBindStatsNxdomain OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "Nx Domain"
+ ::= { swBindStats 4 }
+
+swBindStatsRecursion OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "Recursion"
+ ::= { swBindStats 5 }
+
+swBindStatsFailure OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION "Failed Queries"
+ ::= { swBindStats 6 }
+
END
|
|