[rancid] snmp-server host on nx-os

Brandon Ewing nicotine at warningg.com
Fri Dec 23 21:39:35 UTC 2016


Looks like the snmp-server host stuff got missed when nxos.pm got created.
One can still set an SNMP string in a snmp-server host <ip> trap statement,
so we should probably match and filter if filterstr is set.  

Patch (cut 'n pasted from ios.pm) attached.

-- 
Brandon Ewing                                     (nicotine at warningg.com)
-------------- next part --------------
--- lib/nxos.pm.in.orig	2016-12-23 15:14:26.035813372 -0600
+++ lib/nxos.pm.in	2016-12-23 15:16:06.626807943 -0600
@@ -847,6 +847,34 @@
 		}
 	    }
 	}
+    if (/^snmp-server host (\d+\.\d+\.\d+\.\d+) /) {
+	    if ($filter_commstr) {
+		my($ip) = $1;
+		my($line) = "snmp-server host $ip";
+		my(@tokens) = split(' ', $');
+		my($token);
+		while ($token = shift(@tokens)) {
+		    if ($token eq 'version') {
+			$line .= " " . join(' ', ($token, shift(@tokens)));
+			if ($token eq '3') {
+			    $line .= " " . join(' ', ($token, shift(@tokens)));
+			}
+		    } elsif ($token eq 'vrf') {
+			$line .= " " . join(' ', ($token, shift(@tokens)));
+		    } elsif ($token =~ /^(informs?|traps?|(no)?auth)$/) {
+			$line .= " " . $token;
+		    } else {
+			$line = "!$line " . join(' ', ("<removed>",
+						 join(' ', at tokens)));
+			last;
+		    }
+		}
+		ProcessHistory("SNMPSERVERHOST","ipsort","$ip","$line\n");
+	    } else {
+		ProcessHistory("SNMPSERVERHOST","ipsort","$1","$_");
+	    }
+	    next;
+    }
 
 	# Why was this commented out? It shows up in the raw text...
 	if (/^(snmp-server community) (\S+)/) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20161223/69e5e8a4/attachment.sig>


More information about the Rancid-discuss mailing list