The Charm Store will undergo scheduled database maintenance on July 5, 2026 22:00 to July 6, 02:00 UTC. During this time, you may be unable to access charm and bundle metadata or publish updates. No user action is required and services will automatically resume once maintenance is complete.

Generic Exporter

Marcus Boden Publisher

Platform:

Ubuntu
24.04 22.04 20.04
Channel Revision Published Runs on
dev/edge 46 12 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 45 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 44 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 43 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 42 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 41 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 40 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 39 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
dev/edge 38 01 Jun 2026
Ubuntu 24.04 Ubuntu 22.04 Ubuntu 20.04
juju deploy generic-exporter --channel dev/edge

Charm lifecycle

This guide outlines how the Generic Exporter operator responds to core Juju events and manages the exporter snap throughout its lifecycle.

Install

On install:

  • Validate that a usable configuration is present:
    • A snap-name is provided, and
    • Either snap-channel or snap-revision is set (but not both).
  • Initialize the snap manager using SnapCache.
  • Install the exporter snap:
    • Using the requested channel or revision.
    • Respecting snap-classic when classic confinement is required.
  • Apply any JSON snap configuration from snap-config using snap.set().

If configuration is missing or invalid (for example, snap-name not set), the charm sets:

BlockedStatus("Missing required configuration fields: snap-name")

and does not proceed with installation.

Config-changed

On config-changed:

  • Re-validate the charm configuration:
    • Reject cases where both snap-channel and snap-revision are set simultaneously.
    • Parse snap-config as JSON; if parsing fails, block with an appropriate message.
  • Reapply snap configuration:
    • Call snap.set() with the parsed configuration.
    • Call snap.unset() if any configuration was unset.
    • On failure, stop the snap and set a Blocked status.
  • Reapply snap-plugs by connecting the requested interfaces.
  • Detect a change in the exporter identity:
    • If the configured exporter changes (for example, snap-name changed), uninstall the previous snap and clean up its alerts directory.
  • Reconcile alert rules:
    • If an alerts resource is present, re-read and rewrite rules to /run/<app-name>-<unit-id>/alerts.yaml.
  • Notify COS integration:
    • Update scrape configuration and alert rules via COSAgentProvider, using config-changed as a refresh event.

Update-status

On update-status, the charm performs a simple health check against the exporter’s HTTP endpoint:

  • Issue a GET request to http://localhost:<port>/<metrics-path>.
    • If the request fails or the endpoint is unreachable, set:
    BlockedStatus("Metrics endpoint not reachable")
    
  • Ensure that the snap services are active.
  • Check that the charm is related to Opentelemetry Collector
    • If the check fails, the charm sets:
    BlockedStatus("Missing relation: [cos-agent]")
    

If every check passes, the charm enters Active state. These checks ensure that both the snap and its configuration are functioning as expected.

Remove

On remove:

  • Stop and remove the exporter snap from the unit.
  • Remove the alerts directory and any associated files.

Help improve this document in the forum (guidelines). Last updated 4 months ago.