Prometheus Grok Exporter

juju deploy cs:prometheus-grok-exporter
Show information
Channel Version Base
latest/stable 0
20.04 18.04 16.04

Base:

About

Export Prometheus metrics from arbitrary unstructured log data. Read more


Relevant links


Discuss this charm

Share your thoughts on this charm with the community on discourse.

Join the discussion

Juju prometheus-grok-exporter charm

grok_exporter allows to export Prometheus metrics from arbitrary unstructured log data.

This charm can be related to the prometheus2 charm, to nrpe charm and to grafana

Build

Optionally export the CHARM_BUILD_DIR env var or the default /tmp/charm-builds will be used.

To build the charm run:

make build 

Configuration

Using the default configuration of the charm, prometheus-grok-exporter won't start until the metrics and global paths are set.

  • global_paths is comma separated list of files to monitor. All metrics not specifying an individual path are applied to all log files defined by this option.

  • metrics is a yaml file defining valid metrics for the prometheus-grok-exporter. Refer to the metrics documentation from the grok_exporter git repository.

Example of a valid configuration:

  prometheus-grok-exporter:
    options:
      global-paths: "/var/log/syslog"
      metrics: |
        metrics:
        - type: counter
          name: syslog_msgs_total
          help: Total number of syslog msgs, by program (ie daemon)
          match: '%{SYSLOGBASE}'
          labels:
            program: '{{.program}}'

Deploy

Add as subordinate of an existing charm.

i.e.

    juju deploy cs:ubuntu --series bionic
    juju deploy cs:prometheus2 prometheus --series bionic
    juju deploy cs:prometheus-grok-exporter --series bionic
    juju add-relation ubuntu prometheus-grok-exporter
    juju add-relation prometheus-grok-exporter:prometheus-client prometheus:target
    juju add-relation prometheus:grafana-source grafana:grafana-source
    juju add-relation prometheus-grok-exporter grafana

Grafana Dashboard

The charm will send a default dashboard to Grafana stored in files/grafana-dashboards/grok-exporter-dashboard.json. The dashboard assumes that in Grafana is set a datasource called prometheus - Juju generated source.

If the datasource is called differently in grafana (i.e. prometheus2 - Juju generated source), you will need to provide a new dashboard through Grafana.

Then you can proceed with deleting the old dashboard manually from the Grafana web interface.

Testing

Juju should be installed and bootstrapped on the system to run functional tests.

    export MODEL_SETTINGS=<semicolon-separated list of "juju model-config" settings>
    make test

NOTE: If you are behind a proxy, be sure to export a MODEL_SETTINGS variable as described above. Note that you will need to use the juju-http-proxy, juju-https-proxy, juju-no-proxy and similar settings.

Contact Information