Tutorial

Centreon Plugins - Discover Collection modes

  • 15 November 2021
  • 8 replies
  • 1191 views

Userlevel 6
Badge +19

The Centreon Plugins team recently introduced a new fashion of scraping monitoring indicators. It’s called Collection.

 

These modes could be seen as 'dumb' boiler-plates, allowing you to monitor 'things' over various protocols or APIs while abstracting some of their complexity. Collection modes rely on a JSON configuration file describing the data you want to get and the processing or mapping you may wish to apply.

 

This kind of mode is handy if you are in one of the following situations:

  • You can't find an existing plugin to monitor what you want or fulfill your particular need.
  • You need to gather data from a in-house, black box, or third-party application and transform it to be easier to analyze.
  • Writing (or asking for) a dedicated plugin appears overkill because you simply want to monitor values and apply thresholds over them.

 

Currently, Collection modes are available for:

In other words, you can use these on any device supporting SNMP and any SQL-Based databases (DB2, MariaDB, MSSQL, Oracle, etc.).

Give them a try and share your feedback about it in the comments! We would love to hear what protocol(s) or API(s) you would like to see supporting a collection mode.


8 replies

Badge +1

It could be useful another one for custum api request, when you ca not find a connector and not snmp request is possible, in my case, I have to write a specific shell script to collect data and execute it as command in Centreon configuration.

It could include generic methods of authentication and 2fa so, and the common request functions.

Userlevel 4
Badge +12

Hi @toti69o,

There is actually a mode in the http plugin that does what you say (except MFA in my understanding).

It shall be documented quite soon.

Badge

When you can't find an existing plugin that monitors what you need or fulfills a particular requirement. When you need to do crm data enrichment from in-house, black box, or third-party applications and transform it to make it easier to analyze. When writing or asking for a dedicated plugin seems like overkill because you simply want to monitor values and apply thresholds.Currently, Collection modes are available for SNMP (Simple Network Management Protocol) and SQL-based databases (including DB2, MariaDB, MSSQL, Oracle, etc.). This means you can use these modes on any device supporting SNMP or any SQL-based database.

Userlevel 4
Badge +12

Collections (which exist for HTTP as well) can meet most needs, but there are also simpler modes for simpler needs. You may find helpful tips here.

Badge +2

Could someone please explain the map function? The rest is pretty straightforward. I have an idea of what it is good for, but cannot figure out how to use it

Userlevel 4
Badge +12

Hi @derEdu,

Are you talking about Perl’s map function of about the mapping attribute of our collections?

Badge +2

Hi @omercier!

You are right, this was ambiguous. I’m talking about your code snippet:

      "functions": [
{
"_comment_type": "The type of computation can be: map, scale, second2human, date2epoch, epoch2date, count, replace, assign, capture, scientific2number.",
"type": "count",
"_comment_src": "Expression pointing to the data to compute.",
"src": "%(http.tables.hostsRequestEntries)",
"_comment_filter": "Only the data for which the given expression is true will be processed.",
"filter": "%(src.state) != 0",
"_comment_save": "Name of the variable that will store the computed value.",
"save": "%(downCount)"
},

scale, second2human, date2epoch, epoch2date, count, assing are pretty straightforward, whereas map and probably the others need more explanation
They are not used in any of the tutorials, so people left figuring. 

Userlevel 4
Badge +12

No problem!

To use the map transformation keyword, you first need to define a mapping table (example here with poolState) and then use it as value for the map attribute in the entries definition section (example here, where I think it is not a good choice to have the same name for the entry and the mapping rule, they don’t need to be the same).

This will result in converting the raw value given by the SNMP OID into a more understandable status.

I hope it’s clearer now!

Reply