summaryrefslogtreecommitdiff
path: root/perl/SNMP/examples/mibwalk.pl
diff options
context:
space:
mode:
Diffstat (limited to 'perl/SNMP/examples/mibwalk.pl')
-rw-r--r--perl/SNMP/examples/mibwalk.pl17
1 files changed, 17 insertions, 0 deletions
diff --git a/perl/SNMP/examples/mibwalk.pl b/perl/SNMP/examples/mibwalk.pl
new file mode 100644
index 0000000..d62dc68
--- /dev/null
+++ b/perl/SNMP/examples/mibwalk.pl
@@ -0,0 +1,17 @@
+# snmpwalk of entire MIB
+# stop on error at end of MIB
+
+use SNMP 1.8;
+$SNMP::use_sprint_value = 1;
+my $host = shift || localhost;
+my $comm = shift || public;
+
+$sess = new SNMP::Session(DestHost => $host, Community => $comm);
+
+$var = new SNMP::Varbind([]);
+
+do {
+ $val = $sess->getnext($var);
+ print SNMP::Varbind::tag($var).".".SNMP::Varbind::iid($var)." = ".
+ SNMP::Varbind::val($var)."\n";
+} until ($sess->{ErrorStr});