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 = 126.96.36.199.188.8.131.52.0
switch_stuff2 = 184.108.40.206.220.127.116.11.0
switch_stuff3 = 18.104.22.168.22.214.171.124.0
switch_stuff4 = 126.96.36.199.188.8.131.52.0
switch_stuff5 = 184.108.40.206.220.127.116.11.0
router_stuff1 = 18.104.22.168.22.214.171.124.0
router_stuff2 = 126.96.36.199.188.8.131.52.0
router_stuff3 = 184.108.40.206.220.127.116.11.0
db_stuff1 = 18.104.22.168.22.214.171.124.0
db_stuff2 = 126.96.36.199.188.8.131.52.0
switch_stuff1 = 184.108.40.206.*
switch_stuff2 = 1.45.*.12
220.127.116.11.0 – found, continue
18.104.22.168.1 – found, continue
22.214.171.124.2 – not found, stop
126.96.36.199 – found, continue
188.8.131.52 – found, continue
184.108.40.206 – found, continue
220.127.116.11 – not found, stop
For entries like
switch_stuff1 = 18.104.22.168.* 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.