Hello @Siren
To retrieve the Cisco router model from the command line, you can use the following SNMP OID:
snmpwalk -v2c -c <community_string> <router_ip> <OID>
Note that the SNMP OID `1.3.6.1.2.1.1.2` corresponds to `sysObjectID` in the SNMP MIB, which is an OID that uniquely identifies the type of system. In the case of Cisco routers, it typically returns an OID like `1.3.6.1.4.1.9.1.X`, where `X` represents the specific model.
Here's an example of how you can use this in a shell script or within a TCL script:
#!/bin/bash
router_ip="your_router_ip"
community_string="your_community_string"
model_oid=$(snmpwalk -v2c -c $community_string $router_ip 1.3.6.1.2.1.1.2 | awk '{print $NF}')
# Extract the model from the OID
model_number=$(snmptranslate -On -Td $model_oid | grep -oP '(?<=::= STRING: ).*')
echo "Router Model: $model_number"
This script uses `snmpwalk` to get the `sysObjectID` and then `snmptranslate` to convert the OID to its corresponding string value, which should include the model information.
Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.