How to Define a Custom Metric

Bleemeo agent can relay your custom metrics to Bleemeo Cloud platform. Several ways to gather custom metrics exists:

Poll metrics by HTTP

Bleemeo agent could query your application for custom metrics. It only requires that your application talks HTTP (or HTTPS) and that you have one URL per metric.

Each metric must have its own URL, that returns one number: the metric value.

To configure custom metrics, you just need to add the following to your Bleemeo agent configuration (/etc/bleemeo/agent.conf.d/50-pulled-metrics.conf):

metric:
    pull:
        myapplication_users_count:
            url: https://myapp.example.com/metrics/users_count
            item: server1
            interval: 60
            username: monitoring-user
            password: secret
            ssl_check: True
        myapplication_metric2:
            [...]

Restart your agent to apply the new configuration.

The result from your application will be appended to metric myapplication_users_count every 60 seconds.

The name of the metric (myapplication_users_count and myapplication_metric2 in this example) must be unique for one Bleemeo agent. You could define any number of custom metrics.

Only url field is mandatory, all other fields have default values.

Fields are:

  • url: HTTP(s) URL to the page which return the metric value. The page must return only one number (float number).

    URL could also be a file path, like /var/lib/mymetric. This file must contain only one number (float number).

  • item: Associated item value. When a metrics has multiple item (example: disk usage for multiple partition: /, /home…). Default is no item associated.

  • ssl_check: When your URL is an httpS one, if this value is True, then server certificate must be valid. If this value is False, unverified certificate are accepted. Default value is True.

  • interval: Query the metric every N seconds. Default is every 10 seconds.

  • username / password: Credentials used when querying URL. Used in HTTP basic authentication. Default is no authentication.

Send metrics with StatsD

Default installation will listen for StatsD metrics and forward them to Bleemeo Cloud platform.

It uses the StatD listener of Telegraf.

The following StatsD metric types are supported:

  • counter: The metric will be “statsd_NAME”. It’s a rate per second.

  • gauge: The metric will be “statsd_NAME”.

  • timing: Multiple metrics will be created:

    • “statsd_NAME_90_percentile”: 90 percentile in millisecond. It means 90% of the events took less than this time to complete.
    • “statsd_NAME_count”: Rate per second.
    • “statsd_NAME_lower”: Minimum time in millisecond.
    • “statsd_NAME_mean”: Average time in millisecond.
    • “statsd_NAME_stddev”: Standard deviation in millisecond.
    • “statsd_NAME_upper”: Maximum time in millisecond.

Send metrics with Prometheus

Bleemeo agent could query a Prometheus exporter for custom metrics.

To configure Prometheus metrics, you just need to add the following to your Bleemeo agent configuration (/etc/bleemeo/agent.conf.d/50-prometheus-metrics.conf):

metric:
    prometheus:
        my_application:
            url: http://localhost:8080/metrics
        other_application:
            [...]

Restart your agent to apply the new configuration.

Metrics exported by the application will be available on Bleemeo Cloud platform prefixed by the application name (my_application).

The name of the applications (my_application and other_application in this example) must be unique for one Bleemeo agent. You could define any number of Prometheus exporter.

Send metrics with JMX

Bleemeo agent could gather metrics of Java application using JMX. See Java Monitoring for setup instruction.