SNMP - Plugin - Basics

Hi @MrD

This is where the discovery and check functions come into play. The first one discovery the available service. The section parameter will get the parsed output and should yield one Service per discovered volume.

def discover_ani(section):
    for name section.keys():
        yield Service(item=name)

The check functions gets the same input as section but in addition the item you raised. In this example this could be something like VOLUME_0. It then should yield at least one Result.

def check_ani(item, section):
    volume = section[item]
    yield Result(state=State.OK, summary="Name %s" % volume["Name"])

    if volume["Used"] >= volume["Size"]:
        yield Result(state=State.CRIT summary="Volume is full")

However you usually the check logic is much more complex and may includes checking levels which may even are configurable with rules. However this is quiet a bit more advanced. An example which could help is the proxmox_ve_disk_usage. But keep in mind that this check expects only a single service per host. Therefore it has no item parameter in the check section but demonstrated how disk metrics and the result could be handled. The custom configuration rule for this check is found in proxmox_ve_disk_usage_params.py, the CheckParameterRulespecWithoutItem you would need to change to CheckParameterRulespecWithItem for sure as you have more the one instance of the service.

Regards Marius