Charmed prometheus-grok-exporter tutorial - getting started

Getting Started

Deploy as a subordinate charm of an existing charm.

    juju deploy ubuntu --series focal
    juju deploy prometheus2 prometheus --series focal
    juju deploy prometheus-grok-exporter --series focal
    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

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}}'

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 data source 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.