generic-exporter-operator

Generic Exporter

Channel Revision Published Runs on
dev/edge 58 Today
Ubuntu 24.04 Ubuntu 22.04
dev/edge 57 Today
Ubuntu 24.04 Ubuntu 22.04
dev/edge 56 Today
Ubuntu 24.04 Ubuntu 22.04
dev/edge 55 Today
Ubuntu 24.04 Ubuntu 22.04
dev/edge 54 Today
Ubuntu 24.04 Ubuntu 22.04
dev/edge 53 Today
Ubuntu 24.04 Ubuntu 22.04
dev/edge 52 Today
Ubuntu 24.04 Ubuntu 22.04
dev/edge 51 Today
Ubuntu 24.04 Ubuntu 22.04
juju deploy generic-exporter-operator --channel dev/edge
Show information

Platform:

Ubuntu
24.04 22.04

Attach alert rules from a resource

This guide describes how to provide custom Prometheus alert rules to the Generic Exporter operator using a Juju resource. The charm will:

  • Read the attached resource file (YAML)
  • Write it into an alerts rules directory under /run/<app>-<unit-id>/
  • Expose those rules via the cos-agent relation to Grafana Agent and COS Lite

Requirements

  • Generic Exporter operator deployed and running.
  • (Optional) Opentelemetry Collector and COS Lite are already integrated, as described in the previous how-to.

Prepare an alerts resource

Create a local file alerts.yaml containing one or more Prometheus alerting rules. For example:

groups:
  - name: generic-exporter.rules
    rules:
      - alert: ExporterDown
        expr: up{job="node-exporter"} == 0
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "Exporter is down on {{ $labels.instance }}"
          description: "The node-exporter exporter has not been scraping successfully for 5 minutes."

Ensure the file is valid YAML and follows Prometheus alert rule syntax.

Attach the resource

Attach the resource to the Generic Exporter application. Assuming the app is called node-exporter:

juju attach-resource node-exporter alerts=./alerts.yaml

The charm will:

  • Fetch the alerts resource
  • Write it to a rules directory, for example:
    /run/node-exporter-0/alerts.yaml
    
  • Notify Grafana Agent via the cos-agent relation so that alerts are reloaded.

Use the dump-alerts action

To verify which rules the charm has loaded, use the dump-alerts action (provided by the charm):

juju run node-exporter/0 dump-alerts --wait

The action prints the effective path on the machine and dumps the alert rules. This is useful for validating that the uploaded resource is being parsed and consumed correctly.

Update or remove alerts

To update alert rules, modify alerts.yaml and re-attach:

juju attach-resource node-exporter alerts=./alerts.yaml

To effectively remove alerts:

  • Attach an empty rules file, or
  • Use a minimal file that defines an empty rule group.

The charm will refresh the rules directory and inform Grafana Agent via its refresh_events configuration.


Help improve this document in the forum (guidelines). Last updated 17 hours ago.