SNMP - Plugin - Basics

Hi Mr.D

If you enter the OID of the Table you are interested as base and a list of entries/columns you are interested in as oids you will get a list of rows back.

register.snmp_section(
  name = 'ANI',
  detect = exists('.1.3.6.1.4.1.123.0'),
  fetch = SNMPTree(
    base = '.1.3.6.1.4.1.2021.9.1',
    oids = [
      '2', # dskPath
      '3', # dskDevice
      '6', # dskTotal
      '7', # dskAvail
 
     ),
  parse_function=parse_sessions,
  )

This should result in somthing like te following as string_table

[['/pl2', '/dev/vda1', '5070464', '3488988'], ['/data', '/dev/vda2', '20575868', '20029132'], ['/statistics/partitions/internal', '/dev/vda2', '20575868', '20029132']], 

This would enable you to loop through like in the following example

for path, device, total, avail in string_table:
  pass

Regards Marius

2 Likes