Hello,
attached is the patch for the implementation of SNMPv3. I've been testing it on my system and devices, and it seems to be working properly. Since it's a core function of the soft, I guess it would be good that other people give it a try before it is committed.
I use NET-SNMP version: 5.4.3.
Be careful that a few files use direct calls to net-snmp instead of calling observium library functions. It means that those calls will not work with an snmpv3 device.
includes/discovery/cisco-mac-accounting.inc.php: $datas = shell_exec($config['snmpbulkwalk'] . " -M ".$config['mibdir']." -m CISCO-IP-STAT-MIB -Oqn -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." cipMacSwitchedBytes"); includes/discovery/cisco-pw.inc.php: $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcID"); includes/discovery/cisco-pw.inc.php: list($cpw_remote_id) = explode(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid)); includes/discovery/cisco-pw.inc.php: $interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid)); includes/discovery/temperatures/adva.inc.php: $temperature_chassis = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_chassis")); includes/discovery/temperatures/adva.inc.php: $temperature_stm16 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_stm16")); includes/discovery/temperatures/adva.inc.php: $temperature_hss1 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss1")); includes/discovery/temperatures/adva.inc.php: $temperature_hss2 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss2")); includes/discovery/cisco-vrf.inc.php: $vrf['name'] = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -Ln -Osq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfRouteDistinguisher.".$vrf['oid'])); includes/discovery/cisco-vrf.inc.php: $vrf['mplsVpnVrfDescription'] = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -Ln -Osqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfDescription.".$vrf['oid'])); includes/discovery/cisco-vrf.inc.php: $ports = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $ports_oid"); includes/polling/os/ironware.inc.php:$hardware = trim(exec($config['snmpget'] . " -M ".$config['mibdir'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " . includes/polling/os/ironware.inc.php:$version = trim(exec($config['snmpget'] . " -M ".$config['mibdir'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " . includes/polling/os/speedtouch.inc.php:$loop = shell_exec($config['snmpget'] . " -M ".$config['mibdir'] . ' -Ovq -v1 -c '.$device['community'].' '.$device['hostname'].' ifDescr.101');
I will send a patch to fix cisco-vrf after this mail, but the other files will still be incompatible with snmpv3 (keep your devices in SNMPv2 if you use any of the incompatible calls).
Guillaume
Obviously, that would be too easy if I had not left a small artifact in the patch. The includes/common.php file should not be patched, it was an attempt to optimise deletion but I have not finished it, so deleting a device/port would be broken due to this change (in fact, rrds would not be deleted).
So instead of the previous one, please apply the attached patch.
2012/3/31 Guillaume Leclanche guillaume@leclanche.net
Hello,
attached is the patch for the implementation of SNMPv3. I've been testing it on my system and devices, and it seems to be working properly. Since it's a core function of the soft, I guess it would be good that other people give it a try before it is committed.
I use NET-SNMP version: 5.4.3.
Be careful that a few files use direct calls to net-snmp instead of calling observium library functions. It means that those calls will not work with an snmpv3 device.
includes/discovery/cisco-mac-accounting.inc.php: $datas = shell_exec($config['snmpbulkwalk'] . " -M ".$config['mibdir']." -m CISCO-IP-STAT-MIB -Oqn -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." cipMacSwitchedBytes"); includes/discovery/cisco-pw.inc.php: $oids = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcID"); includes/discovery/cisco-pw.inc.php: list($cpw_remote_id) = explode(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid)); includes/discovery/cisco-pw.inc.php: $interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid)); includes/discovery/temperatures/adva.inc.php: $temperature_chassis = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_chassis")); includes/discovery/temperatures/adva.inc.php: $temperature_stm16 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_stm16")); includes/discovery/temperatures/adva.inc.php: $temperature_hss1 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss1")); includes/discovery/temperatures/adva.inc.php: $temperature_hss2 = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -O qv -$snmpver -c $community $hostname:$port $oid_hss2")); includes/discovery/cisco-vrf.inc.php: $vrf['name'] = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -Ln -Osq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfRouteDistinguisher.".$vrf['oid'])); includes/discovery/cisco-vrf.inc.php: $vrf['mplsVpnVrfDescription'] = trim(shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -Ln -Osqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " mplsVpnVrfDescription.".$vrf['oid'])); includes/discovery/cisco-vrf.inc.php: $ports = shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " $ports_oid"); includes/polling/os/ironware.inc.php:$hardware = trim(exec($config['snmpget'] . " -M ".$config['mibdir'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " . includes/polling/os/ironware.inc.php:$version = trim(exec($config['snmpget'] . " -M ".$config['mibdir'] . " -O vqs -m FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB -" . $device['snmpver'] . " -c " . $device['community'] . " " . includes/polling/os/speedtouch.inc.php:$loop = shell_exec($config['snmpget'] . " -M ".$config['mibdir'] . ' -Ovq -v1 -c '.$device['community'].' '.$device['hostname'].' ifDescr.101');
I will send a patch to fix cisco-vrf after this mail, but the other files will still be incompatible with snmpv3 (keep your devices in SNMPv2 if you use any of the incompatible calls).
Guillaume
participants (1)
-
Guillaume Leclanche