Index: ossp-pkg/snmpdx/snmpdx.d/swBind.pm RCS File: /v/ossp/cvs/ossp-pkg/snmpdx/snmpdx.d/swBind.pm,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/snmpdx/snmpdx.d/swBind.pm,v' | diff -u /dev/null - -L'ossp-pkg/snmpdx/snmpdx.d/swBind.pm' 2>/dev/null --- ossp-pkg/snmpdx/snmpdx.d/swBind.pm +++ - 2025-04-05 07:39:36.084754662 +0200 @@ -0,0 +1,93 @@ +## +## OSSP snmpdx - SNMP Daemon Extension +## Copyright (c) 2003 The OSSP Project +## Copyright (c) 2003 Ralf S. Engelschall +## Copyright (c) 2003 Cable & Wireless +## +## 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 . +## +## 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 () { + 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; + Index: ossp-pkg/snmpdx/snmpdx.mib/snmpdx.mib RCS File: /v/ossp/cvs/ossp-pkg/snmpdx/snmpdx.mib/snmpdx.mib,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/snmpdx/snmpdx.mib/snmpdx.mib,v' 2>/dev/null --- 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