Skip to main content

OpenMetrics

Prerequisites

Centreon Plugin

Install this plugin on each needed poller:

yum install centreon-plugin-Applications-Monitoring-Openmetrics

Centreon Configuration

Create a host using the appropriate template

Checking using a web page

Go to Configuration > Hosts and click Add. Then, fill the form as shown by the following table:

FieldValue
NameName of the host
AliasDescription
IP Address / DNSCan be localhost
Monitored fromPoller used to monitor
TemplatesApp-Monitoring-Openmetrics-Web

The following host macros should be set as shown:

MacroValue
OPENMETRICSPORTOpenMetrics web page port
OPENMETRICSPROTOOpenMetrics web page protocol
OPENMETRICSURLPATHOpenMetrics web page url path
OPENMETRICSUSERNAMEOpenMetrics web page username (if needed)
OPENMETRICSPASSWORDOpenMetrics web page password(if needed)

Check the Create Services linked to the Template too box and click on the Save button.

The following service will be created:

  • Scrape-Metrics

Checking using a remote file

Go to Configuration > Hosts and click Add. Then, fill the form as shown by the following table:

FieldValue
NameName of the host
AliasDescription
IP Address / DNSCan be localhost
Monitored fromPoller used to monitor
TemplatesApp-Monitoring-Openmetrics-File

The following host macros should be set as shown:

MacroValue
OPENMETRICSFILEPATHOpenMetrics file path on remote host

Check the Create Services linked to the Template too box and click on the Save button.

The following service will be created:

  • Scrape-Metrics

Set the service macros

The following service macros should be set as shown:

MacroValue
FILTERMETRICSName of the metrics to filter on
WARNINGWarning threshold
CRITICALCritical threshold
INSTANCELabel from dimensions to get the instance value from
FILTERINSTANCEFilter on some instance
SUBINSTANCESet the label from dimensions to get the subinstance value from
FILTERSUBINSTANCEFilter on some subinstance

Examples on command line:

# perl centreon_plugins.pl --plugin=apps::monitoring::openmetrics::plugin --mode=scrape-metrics --custommode=web --hostname=10.2.3.4 --port=9100 --verbose --filter-metrics='node_network_up' --critical='0:0' --instance='device' --new-perfdata

# perl centreon_plugins.pl --plugin=apps::monitoring::openmetrics::plugin --mode=scrape-metrics --custommode=web --hostname=10.2.3.4 --port=9100 --verbose --filter-metrics='node_cpu_seconds_total' --instance='cpu' --subinstance='mode' --filter-subinstance='idle'

# perl centreon_plugins.pl --plugin=apps::monitoring::openmetrics::plugin --mode=scrape-metrics --custommode=file --command-options='/tmp/metrics' --filter-metrics='cpu' --verbose

# perl centreon_plugins.pl --plugin=apps::monitoring::openmetrics::plugin --mode=scrape-metrics --custommode=file --hostname=10.2.3.4 --ssh-option='-l=centreon-engine' --ssh-option='-p=52' --command-options='/my/app/path/metrics' --verbose

Duplicate service to monitor more metrics

You can now duplicate the service to monitor several metrics.