I have a Perl script that monitors any SNMP enabled service.
The way it works is I have a config file with multiple services, and each service has a list of metrics to collect.
switch_stuff1 = 220.127.116.11.18.104.22.168.0
switch_stuff2 = 22.214.171.124.126.96.36.199.0
switch_stuff3 = 188.8.131.52.184.108.40.206.0
switch_stuff4 = 220.127.116.11.18.104.22.168.0
switch_stuff5 = 22.214.171.124.126.96.36.199.0
router_stuff1 = 188.8.131.52.184.108.40.206.0
router_stuff2 = 220.127.116.11.18.104.22.168.0
router_stuff3 = 22.214.171.124.126.96.36.199.0
db_stuff1 = 188.8.131.52.184.108.40.206.0
db_stuff2 = 220.127.116.11.18.104.22.168.0
switch_stuff1 = 22.214.171.124.*
switch_stuff2 = 1.45.*.12
126.96.36.199.0 – found, continue
188.8.131.52.1 – found, continue
184.108.40.206.2 – not found, stop
220.127.116.11 – found, continue
18.104.22.168 – found, continue
22.214.171.124 – found, continue
126.96.36.199 – not found, stop
For entries like
switch_stuff1 = 188.8.131.52.* you could simply send first request and after that loop through
get_next_request as long as you get data.
However, with config like
switch_stuff2 = 1.45.*.12 it is not so simple any more. You can't use
get_next_request and you have to iterate over possible values yourself. The problem is that numbers are "usually" continuous but not always and in latter case it makes it quite stressful for the system to just try all possible numbers. At least if you really need to do this then I suggest to cache somehow OIDs that exists and not scan them every time you collect data.