I'm trying to write a snmp script from scratch to retrieve information about the equipments in the network (not using the ready made modules/libraries due to security policy in the organisation).
I've been using $variable = `snmpget ip oid` so the values will be returned to the variable and allow me to write it to a .xls file. This works perfectly for existing equipments until I come upon some equipments which no longer exist int he network. The snmpget command will then return a snmp error message within the Dos Prompt.
Is there anyway I can prevent the error from appearing? Or may I capture the error message so I can write that IP to a invalid equipment excel file.
Any suggestions will be appreciated.