---
title: Charmhub | Deploy Generic Exporter using Charmhub - The Open Operator Collection
description: Deploy the latest version of Generic Exporter on any cloud.
url: https://charmhub.io/generic-exporter-operator/docs/system-architecture
---

# Generic Exporter

[Iurii Kondrakov](https://charmhub.io/publisher/deezzir "View all packages from Iurii Kondrakov")

* [Iurii Kondrakov](https://charmhub.io/publisher/deezzir "View all packages from Iurii Kondrakov")

Platform:

24.04

22.04

dev/edge 58

```
juju deploy generic-exporter-operator --channel dev/edge
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Relevant links

* [Homepage](https://charmhub.io/velero-operator)

---

#### Contacts

* [Submit a bug](https://github.com/canonical/generic-exporter-operator/issues)

---

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

[Join the discussion](https://discourse.charmhub.io/)

# System architecture

This guide describes the main components and responsibilities of the Generic Exporter operator.

At a high level, the charm:

* Manages the lifecycle of **one exporter snap per unit**
* Validates and applies charm configuration to the snap
* Exposes a configurable HTTP metrics endpoint (port and path)
* Integrates with COS via Opentelemetry Collector using the `cos-agent` relation
* Optionally consumes an `alerts` resource and forwards the contained rules to COS

## [Core components](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-core-components)

### [Snap Manager](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-snap-manager)

The charm uses `charmlibs.snap` to install, refresh, configure, and remove the exporter snap.

Responsibilities include:

* Ensuring the requested snap is present using `SnapCache` and `snap.ensure`
* Installing from either a **channel** or a **revision** (but not both simultaneously)
* Applying configuration via `snap.set`/`snap.unset` based on the `snap-config` charm option
* Managing snap removal during charm teardown

### [Snap Singleton](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-snap-singleton)

Ensures that the charm application can be safely scaled up and down without affecting peers:

* Tracks snap registrations by units in a lock file under `/opt/singleton_snaps` directory.
* Manages exclusive access to singleton snaps and configuration files using file-based locks.

### [Exporter Configurator](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-exporter-configurator)

Charm configuration is validated and translated into a concrete snap configuration:

* **Port and path**: the charm exposes metrics on `http://<unit-address>:<port>/<metrics-path>`.
* **Snap configuration**: arbitrary exporter settings can be provided as a JSON blob in `snap-config`, which is parsed and passed to `snap.set()`.
* **Snap plugs**: the `snap-plugs` option allows automatically connecting required interfaces after installation (for example, network access or system metrics).

Invalid configuration (for example, malformed JSON or conflicting `snap-channel`/`snap-revision`) is detected early and results in a `Blocked` status with a clear message.

### [COS integration layer](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-cos-integration-layer)

The Generic Exporter operator uses the `COSAgentProvider` abstraction from the `cos_agent` library to expose metrics and alert rules over the `cos-agent` relation.

In effect, the charm:

* Registers a metrics endpoint (path and port) for the Opentelemetry Collector to scrape.
* Points Opentelemetry Collector to an on-disk directory (for example, `/run/<app>-<unit-id>/alerts.yaml`) containing alert rule files.
* Triggers refreshes of scrape configuration and rules on relevant events (such as `config-changed`).
  Opentelemetry Collector is responsible for forwarding telemetry to COS Lite and enriching metrics and alerts with Juju topology labels.

### [Resource Manager](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-resource-manager)

The charm optionally consumes an `alerts` resource:

* When attached, the resource file (YAML) is fetched via `self.model.resources.fetch("alerts")`.
* The content is parsed and written into a rules file, typically `alerts.rules`, under a dedicated directory like `/run/<app>-<unit-id>/alerts.yaml`.
* Missing resources are handled gracefully and logged at the warning level.

The design explicitly **avoids** shipping dashboards or snap files as resources:

* Dashboards are expected to be managed through COS and Grafana directly.
* Installing local snap files using `--dangerous` was rejected for security and supportability reasons.

## [Subordinate model](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-subordinate-model)

The Generic Exporter operator is implemented as a **subordinate machine charm**:

* It relates to any principal via `juju-info` (or an equivalent relation) and is co-located with the principal units.
* Operators can deploy multiple applications of the Generic Exporter operator (for example, one per exporter type) on the same machine.

## [Versioning](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-versioning)

The charm’s workload version is aligned with the installed exporter snap version:

* The charm queries `snap info` for the exporter and sets `workload_version` accordingly (for example, `node-exporter/1.6`).
* The snap is pinned to the selected channel or revision; upgrading the exporter is performed explicitly by changing the charm configuration.

## [Limitations (design intent)](https://charmhub.io/generic-exporter-operator/docs/system-architecture#p-40635-limitations-design-intent)

The current design assumes:

1. **Machine-only**: No Kubernetes support.
2. **One exporter per unit**: The charm does not orchestrate multiple exporters within the same subordinate.
3. **Snap auto-start**: The exporter snap is expected to start its service automatically upon installation and expose the metrics via an HTTP endpoint.
4. **Config-driven updates**: Snap updates are controlled via charm configuration rather than automatic refresh.
5. **Port configuration**: Exporters should allow their listening port to be configured to avoid conflicts when multiple exporters are deployed on the same machine.

---
