hubblo-org / cabestan

Gather and normalize ICT inventory data from multiple sources, to enable automation of ICT carbon and environmental impacts (LCA-inspired) assessments.
Apache License 2.0
13 stars 2 forks source link

SNMP network scanner #7

Open da-ekchajzer opened 2 years ago

da-ekchajzer commented 2 years ago

Problem

As a network administrator, I monitor my network with SNMP. I want to use cabestan to inventories the devices on my network from an SNMP network scan

Solution

We could use net-SNMP client with a wrapper to gather multiple information.

Device discovery

Discovering devices with SNMP enable can be done throught the [nmp snmp-brute script]()

Exemple : nmap -sU -p161 --script snmp-brute --script-args snmplist=community.lst 192.168.1.0/24

User should be able to provide a collection of IPs referring to SNMP devices.

Device type

Device type could be retrieved from the OID

Devices data

Documentation : easysnmp.com/tutorial/getting-snmp-data/

We could use snmpwalk to list available values given though the SNMP interface

command:snmpwalk -v 1 -c public 10.0.1.1 1.3.6.1.2.1

SNMPv2-MIB::sysContact.0 = STRING: Network Admin
SNMPv2-MIB::sysName.0 = STRING: My Router
SNMPv2-MIB::sysLocation.0 = STRING: Main Office
SNMPv2-MIB::sysServices.0 = INTEGER: 14IF-MIB::ifPhysAddress.1 = STRING:
IF-MIB::ifPhysAddress.2 = STRING: 44:d9:e7:7:40:68
IF-MIB::ifPhysAddress.3 = STRING:
IF-MIB::ifPhysAddress.4 = STRING: 44:d9:e7:7:40:62
IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifAdminStatus.2 = INTEGER: up(1)
IF-MIB::ifAdminStatus.3 = INTEGER: up(1)
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)...

Additional context