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 = 188.8.131.52.184.108.40.206.0
switch_stuff2 = 220.127.116.11.18.104.22.168.0
switch_stuff3 = 22.214.171.124.126.96.36.199.0
switch_stuff4 = 188.8.131.52.184.108.40.206.0
switch_stuff5 = 220.127.116.11.18.104.22.168.0
router_stuff1 = 22.214.171.124.126.96.36.199.0
router_stuff2 = 188.8.131.52.184.108.40.206.0
router_stuff3 = 220.127.116.11.18.104.22.168.0
db_stuff1 = 22.214.171.124.126.96.36.199.0
db_stuff2 = 188.8.131.52.184.108.40.206.0
switch_stuff1 = 220.127.116.11.*
switch_stuff2 = 1.45.*.12
18.104.22.168.0 – found, continue
22.214.171.124.1 – found, continue
126.96.36.199.2 – not found, stop
188.8.131.52 – found, continue
184.108.40.206 – found, continue
220.127.116.11 – found, continue
18.104.22.168 – not found, stop
For entries like
switch_stuff1 = 22.214.171.124.* 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.