Declarative snmp metrics

This blueprint wants to add a mechanism so we can add new snmp metrics in a declarative way instead of writing new source code for new pollsters.

Problem description

Currently, we use a generic snmp hardware inspector and a python dict which defines the mapping between snmp oid/operations and the metrics value the caller wants(See the following link for the description of that mapping).

On top of that generic snmp inspector, we still have separate hardware pollsters doing things like setting multiple fields in the Sample object. It’s ok to add a dozen of new metrics. But if want to add hundreds of new snmp metrics, we need to do it in a declarative way, instead of writing new pollster code for every new snmp metrics added.

Proposed change

While keeping the current snmp related hardware.* pollsters intact for backward compatibility, we’ll add a new generic snmp pollster, which can return different types of snmp related metrics based on user request.

This generic snmp pollster will load a definition from a yaml definition file which defines the parameters used to call into the generic snmp inspector, and also other fields in the final Sample object the pollster returns, like name/unit/type. However, the resource_id/user_id/project_id will still be read from the resources returned by the discover just like what we do today.

The yaml definition would be something like the followings:

- counter_name: hardware.cpu.load.15min
  unit: process
  type: gauge
    matching_type:  type_exact,
    oid:  "",
    type: float
    metadata: { }

- counter_name:
  unit: B
  type: cumulative
    matching_type: type_prefix
    metric_oid:  ""
    metadata: {
            name: {
                     oid: "",
                     type: "str",
            speed: {
                     oid: "",
                     type: "lambda x: int(x) / 8",
    post_op: "_post_op_net"

Please see the following link for the detailed explanation of the snmp_inspector dict in the definition:

When adding new snmp metrics, we only needs to add the new definitions into the yaml definition. No need to writing new code.

Because the new generic snmp pollster could return multiple different types of meters, it would bring the following changes to the current polling agent implementation:

1. Currently, because of the mapping of meter pollster plugin one meter, when deciding whether a pollster is needed for a given pipeline, we use the pollster plugin’s entry point name. This will be changed. We’ll add a new helper function which could return all the meters that pollster could return, and use that helper function in the above process to decide whether a pollster is needed for a given pipeline.

2. When calling the pollster plugin to get the samples, we’ll pass the pipeline definition as a new parameter to get_samples() call. So instead of return all the samples, the pollster can only return what the pipeline source asks for.



Data model impact


REST API impact


Security impact


Pipeline impact

No changes for the admin in how to configure the pipeline yaml file.

Other end user impact


Performance/Scalability Impacts


Other deployer impact

Need to deploy a new yaml definition file on the system running polling agent.

Developer impact




Primary assignee:


Ongoing maintainer:


Work Items

  • enhance the pipeline to support new source definition

  • implement the generic snmp pollster and its yaml definition file

Future lifecycle

To be maintained by <lianhao-lu>




The functionality test should be covered in the 3rd party CI of Intel Hradware-Meters CI.

Documentation Impact

Need to update the openstack-manual admin manual about the change to the pipeline definition.