diff options
Diffstat (limited to 'net-mgmt/argus-monitor/files/patch.001')
-rw-r--r-- | net-mgmt/argus-monitor/files/patch.001 | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/net-mgmt/argus-monitor/files/patch.001 b/net-mgmt/argus-monitor/files/patch.001 deleted file mode 100644 index 9551c635af32..000000000000 --- a/net-mgmt/argus-monitor/files/patch.001 +++ /dev/null @@ -1,180 +0,0 @@ -Index: src/Argus::SNMP.pm -=================================================================== ---- src/Argus::SNMP.pm (revision 674) -+++ src/Argus::SNMP.pm (revision 677) -@@ -19,6 +19,8 @@ - use Argus::SNMP::Helper; - my( $HAVE_MD5, $HAVE_SHA1, $HAVE_HMAC, $HAVE_DES, $HAVE_AES); - -+$::path_snmptranslate = 'snmptranslate' unless defined $::path_snmptranslate; -+ - BEGIN { - # these are used for SNMPv3 auth + priv - eval{ require Digest::MD5; $HAVE_MD5 = 1; }; -@@ -330,10 +332,13 @@ - $me->{uname} = "SNMP_$table\_$idx\_$me->{ip}{hostname}"; - - $me->helper_init($cf); -- }else{ -+ } else { - return $cf->error( "invalid OID ($me->{snmp}{oid})" ); -- } -- -+ }; -+ -+ ($me->{info}) = oid2info($oid) -+ unless defined $me->{info}; -+ - $me; - } - -@@ -1034,26 +1039,96 @@ - ################################################################ - # read-config callback - # load MIB2SCHEMA format file of name to oid translations -+# Typically generated with something like -+# snmptranslate -mALL -Tz -+# - sub load_mibfile { - my $file = shift; -+ -+ for my $f (split /\s+/, $file){ -+ # If the magic name 'auto' is used - try to create an automatic -+ # mib2schema file using a net-snmp tool. Cache this file if -+ # possible - but regenerate as needed. -+ # -+ if ($f eq 'auto') { -+ $f = "$::path_snmptranslate -mALL -Tz |"; -+ my $cache = $::datadir.'/gcache/mib2schema.txt'; -+ if ((!-r $cache) && (open MIB, '>'.$cache) && (open TRS, $f)) { -+ print MIB "# Generated from $f - ".scalar(gmtime(time))."\n"; -+ while(<TRS>) { print MIB; }; -+ close TRS; -+ close MIB and $f = $cache; -+ }; -+ }; - -- for my $f (split /\s+/, $file){ - unless( open(MIB, $f) ){ -- ::warning("cannot open mibfile '$file': $!"); -+ ::warning("cannot open mibfile '$f' (from '$file'): $!"); - next; - } -- -- while(<MIB>){ -+ -+ my($name, $oid); -+ while(<MIB>) { - chop; - s/\"//g; -- my($name, $oid) = split /\s+/; -+ s/^\s+//g; -+ s/\s+$//g; -+ s/\s+/ /g; -+ next unless ($name, $oid) = split /\s+/; - $OIDS{$name} = { oid => $oid }; # RSN more... - } - close MIB; - } - } - -+# IF-MIB::ifHCOutOctets -+# ifHCOutOctets OBJECT-TYPE -+# -- FROM IF-MIB -+# SYNTAX Counter64 -+# MAX-ACCESS read-only -+# STATUS current -+# DESCRIPTION "The total number of octets transmitted out of the -+# interface, including framing characters. This object is a -+# 64-bit version of ifOutOctets. -+# -+# Discontinuities in the value of this counter can occur at -+# re-initialization of the management system, and at other -+# times as indicated by the value of -+# ifCounterDiscontinuityTime." -+# ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) ifMIB(31) ifMIBObjects(1) ifXTable(1) ifXEntry(1) 10 } - -+my %oid2info = (); -+sub oid2info { -+ my ($oid) = @_; -+ -+ return () -+ unless $oid =~ m/^[\d\.]+$/; -+ -+ return @{$oid2info{$oid}} -+ if defined $oid2info{$oid}; -+ -+ my $cache = $::datadir.'/gcache/'.$oid.'.txt'; -+ return (<FH>) -+ if (open(FH,$cache)); -+ -+ # Intentionally ignore errors - so we 'cache' these too. -+ # -+ open(FH,"$::path_snmptranslate -mALL -Td $oid|"); -+ my $body = join('',<FH>); -+ close(FH); -+ -+ my $syn = $1 if $body =~ m/SYNTAX\s+(\w+)/s; -+ my $desc = $1 if $body =~ m/\s+DESCRIPTION\s+\"([^"]+)\"/s; -+ -+ $desc =~ s/\r?\n\r?\n/<p>/g; -+ $desc =~ s/\s+/ /g; -+ -+ # We also try to cache 'non' results -+ if (open(CH,'>'.$cache)) { print CH "$desc\n$syn\n";close(CH); }; -+ $oid2info{$oid} = \[$desc,$syn]; -+ return ($desc,$syn); -+}; -+ -+ - ################################################################ - - Doc::register( $doc ); -Index: src/Conf.pm -=================================================================== ---- src/Conf.pm (revision 674) -+++ src/Conf.pm (revision 677) -@@ -84,10 +84,10 @@ - }, - - mibfile => { -- descr => 'pathname of SNMP MIB translation file (MIB2SCHEMA format)', -+ descr => 'pathname of SNMP MIB translation file (MIB2SCHEMA format). Use "auto" to create one on the fly based on "snmptranslate" its mALL MIB collection. "auto" requires the net snmp package to be installed.', - attrs => ['config', 'top', 'multi'], - versn => '3.5', -- callback => \&SNMP::load_mibfile, -+ callback => \&Argus::SNMP::load_mibfile, - }, - - resolv_timeout => { -Index: src/Service.pm -=================================================================== ---- src/Service.pm (revision 674) -+++ src/Service.pm (revision 677) -@@ -676,7 +676,7 @@ - if( $k eq 'ovstatus' || $k eq 'flags' ){ - $vv = "<L10N $v>"; - } -- print $fh "<TR><TD><L10N $kk></TD><TD$x>$vv</TD></TR>\n" if defined($v); -+ print $fh "<TR><TD VALIGN=TOP><L10N $kk></TD><TD$x>$vv</TD></TR>\n" if defined($v); - if( $k eq 'ovstatus' && $v eq 'down' && $s->{showreason} && $s->{reason} ){ - print $fh "<TR><TD>...<L10N because></TD><TD>$me->{srvc}{reason}</TD></TR>\n"; - } -Index: examples/config-new-features -=================================================================== ---- examples/config-new-features (revision 674) -+++ examples/config-new-features (revision 677) -@@ -348,3 +348,13 @@ - notifyaudit: auditlog: - - -+# Load a MIB2SCHEMA translation file (white space separated OID/human-readable name). Typically -+# generated with the 'snmptranslate' command form toolkits such at net-snmp. -+# -+mibfile: /var/argus/mibs.txt -+ -+# The magic filename 'auto' will generate above (and cache such in gcache) using -+# the 'ALL' mibs known to net-snmp. Requires the latter to be installed. -+# -+mibfile: auto -+ |