Advice for Creating SNMP Based Discovery and Check with Multiple Metrics for Broadworks

If I understand your plugin code correctly, you are creating a service for each OID in your OID list. In your metrics, you want to have some charts created from a set of those OIDs. This is not going to work that way. The metrics in a chart need to come from the same service. So you need to change the way you are creating the services. In my opinion you have 3 possibilities:

  1. one check/service (without item) with all metrics
  2. one check with several services (items) and a group of metrics
  3. multiple checks (without item) with a group of metrics

For option 1:

  • remove the item from your service definition
  • in the discover function create a service without an item
  • in the check function, iterate over the items in the section and output them as metrics

for option 2:

  • modify your parse function so that you have a two-level dictionary
    i.e.:
   section = {
    'networkorigattempt': {
        "networkorigattempt": fulllist[0],
        "networktermattempt": fulllist[1],
        "networktermanswered": fulllist[2],
        "networktotalcalls": fulllist[3],
    },
    'usertempts': {
        "UserOrigAttempt": fulllist[4],
        "UserTermAttempt": fulllist[5],
        "UserTermAnswered": FullList[6],
        "UserTotalCalls": fulllist[7],
      }
   }
  • in the dicover function, the services are created from the top level of the dictionary
  • in the check function provide the metrics under the item (top level) of the section

for option 3:

  • split your check according to the related OIDs
  • use a different name for each check
  • rest like option 1

One word about the item. Take a look at the documentation 3. Checks with more than one service (items) per host (here you will find also some basic information how to write a plugin :slight_smile: ). Basically, the item is for when your check has to deal with multiple instances of the same type (i.e. interfaces → one check → one service per interface). Keeping this in mind, Option 1 and 2 are “by the book”, while option 2 works but is a bit outside of the design guide.

Cheers
Thomas

1 Like