Alertmanager
- Canonical Observability
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 128 | 03 Dec 2024 | |
latest/candidate | 138 | 03 Dec 2024 | |
latest/beta | 138 | 19 Nov 2024 | |
latest/edge | 144 | 20 Dec 2024 | |
1.0/stable | 96 | 12 Dec 2023 | |
1.0/candidate | 96 | 22 Nov 2023 | |
1.0/beta | 96 | 22 Nov 2023 | |
1.0/edge | 96 | 22 Nov 2023 |
juju deploy alertmanager-k8s
Deploy Kubernetes operators easily with Juju, the Universal Operator Lifecycle Manager. Need a Kubernetes cluster? Install MicroK8s to create a full CNCF-certified Kubernetes system in under 60 seconds.
Platform:
charms.alertmanager_k8s.v1.alertmanager_dispatch
-
- Last updated 14 Feb 2024
- Revision Library version 1.2
Alertmanager library.
This library is designed to be used by a charm consuming or providing the alertmanager_dispatch
relation interface.
This library is published as part of the Alertmanager charm.
You can file bugs here!
A typical example of including this library might be:
# ...
from charms.alertmanager_k8s.v1.alertmanager_dispatch import AlertmanagerConsumer
class SomeApplication(CharmBase):
def __init__(self, *args):
# ...
self.alertmanager_consumer = AlertmanagerConsumer(self, relation_name="alertmanager")
# ...
Index
class ClusterChanged
Event raised when an alertmanager cluster is changed.
Description
If an alertmanager unit is added to or removed from a relation,
then a :class:ClusterChanged
event should be emitted.
class AlertmanagerConsumerEvents
Description
Event descriptor for events raised by AlertmanagerConsumer
. None
class RelationManagerBase
Base class that represents relation ends ("provides" and "requires").
Methods
RelationManagerBase. __init__( self , charm: CharmBase , relation_name: str , relation_role: RelationRole )
class AlertmanagerConsumer
A "consumer" handler to be used by charms that relate to Alertmanager (the 'requires' side).
Arguments
consumer charm
from consumer's metadata.yaml
Attributes
Description
To have your charm consume alertmanager cluster data, declare the interface's use in your charm's metadata.yaml file:
requires:
alertmanager:
interface: alertmanager_dispatch
A typical example of importing this library might be
from charms.alertmanager_k8s.v1.alertmanager_dispatch import AlertmanagerConsumer
In your charm's __init__
method:
self.alertmanager_consumer = AlertmanagerConsumer(self, relation_name="alertmanager")
Every change in the alertmanager cluster emits a :class:ClusterChanged
event that the
consumer charm can register and handle, for example:
self.framework.observe(self.alertmanager_consumer.on.cluster_changed,
self._on_alertmanager_cluster_changed)
The updated alertmanager cluster can then be obtained via the get_cluster_info
method
This consumer library expect the consumer charm to observe the cluster_changed
event.
Methods
AlertmanagerConsumer. __init__( self , charm: CharmBase )
AlertmanagerConsumer. get_cluster_info( self )
Description
Returns a list of URLs of all alertmanager units. None
class AlertmanagerProvider
A "provider" handler to be used by charms that relate to Alertmanager (the 'provides' side).
Arguments
consumer charm
URL for this unit's workload API endpoint
relation name (not interface name)
Description
To have your charm provide alertmanager cluster data, declare the interface's use in your charm's metadata.yaml file:
provides:
alerting:
interface: alertmanager_dispatch
A typical example of importing this library might be
from charms.alertmanager_k8s.v1.alertmanager_dispatch import AlertmanagerProvider
In your charm's __init__
method:
self.alertmanager_provider = AlertmanagerProvider(
self, relation_name=self._relation_name, external_url=f"http://{socket.getfqdn()}:9093"
)
Then inform consumers on any update to alertmanager cluster data via
self.alertmanager_provider.update(external_url=self.ingress.url)
This provider auto-registers relation events on behalf of the main Alertmanager charm.
Methods
AlertmanagerProvider. __init__( self , charm: CharmBase )
AlertmanagerProvider. update( self )
Description
Update data pertaining to this relation manager (similar args to init). None