[tornado/snmptrapd_collector] Small code refinements.
@@ -55,7 +55,7 @@ sub my_receiver {
"src_port" => $src_port,
"dest_ip" => $dest_ip,
"PDUInfo" => $PDUInfo,
- "VarBinds" => \%VarBindData,
+ "oids" => \%VarBindData,
},
};
@@ -66,6 +66,9 @@ sub my_receiver {
eval{$socket->send($json);};
print $@ if $@;
}
+
+ # We should return NETSNMPTRAPD_HANDLER_OK but this does not work in strict mode.
+ # return NETSNMPTRAPD_HANDLER_OK;
return 1;
}
@@ -81,8 +84,6 @@ sub getCurrentDate {
return $now;
}
-#die "cannot connect to the server $!\n" unless $socket;
-
NetSNMP::TrapReceiver::register("all", \&my_receiver) ||
warn "Failed to register the perl snmptrapd_collector\n";
