---
title: Charmhub | Deploy Prometheus2 using Charmhub - The Open Operator Collection
description: Deploy the latest version of Prometheus2 on any cloud.
url: https://charmhub.io/prometheus2/configurations
---

# Prometheus2

[Llama (LMA) Charmers](https://charmhub.io/publisher/llama-charmers "View all packages from Llama (LMA) Charmers")

* [Llama (LMA) Charmers](https://charmhub.io/publisher/llama-charmers "View all packages from Llama (LMA) Charmers")
* [Monitoring](https://charmhub.io/?filter=monitoring)

Platform:

22.04

20.04

18.04

16.04

stable 23.10

```
juju deploy prometheus2
```

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

* [alert-relabel-configs](https://charmhub.io/prometheus2/configurations#alert-relabel-configs)
* [custom-rules](https://charmhub.io/prometheus2/configurations#custom-rules)
* [daemon-args](https://charmhub.io/prometheus2/configurations#daemon-args)
* [enable-generic-rules](https://charmhub.io/prometheus2/configurations#enable-generic-rules)
* [evaluation-interval](https://charmhub.io/prometheus2/configurations#evaluation-interval)
* [external-labels](https://charmhub.io/prometheus2/configurations#external-labels)
* [external\_url](https://charmhub.io/prometheus2/configurations#external_url)
* [federate-config](https://charmhub.io/prometheus2/configurations#federate-config)
* [label-juju-units](https://charmhub.io/prometheus2/configurations#label-juju-units)
* [monitor-name](https://charmhub.io/prometheus2/configurations#monitor-name)
* [nagios\_context](https://charmhub.io/prometheus2/configurations#nagios_context)
* [nagios\_servicegroups](https://charmhub.io/prometheus2/configurations#nagios_servicegroups)
* [prometheus\_context](https://charmhub.io/prometheus2/configurations#prometheus_context)
* [prometheus\_registration\_authtoken](https://charmhub.io/prometheus2/configurations#prometheus_registration_authtoken)
* [prometheus\_registration\_listen](https://charmhub.io/prometheus2/configurations#prometheus_registration_listen)
* [prometheus\_registration\_port](https://charmhub.io/prometheus2/configurations#prometheus_registration_port)
* [promreg\_snap\_channel](https://charmhub.io/prometheus2/configurations#promreg_snap_channel)
* [remote-read](https://charmhub.io/prometheus2/configurations#remote-read)
* [remote-write](https://charmhub.io/prometheus2/configurations#remote-write)
* [remote-write-config](https://charmhub.io/prometheus2/configurations#remote-write-config)
* [rules-repo](https://charmhub.io/prometheus2/configurations#rules-repo)
* [rules-repo-branch](https://charmhub.io/prometheus2/configurations#rules-repo-branch)
* [rules-update-notify-email](https://charmhub.io/prometheus2/configurations#rules-update-notify-email)
* [rules-update-schedule](https://charmhub.io/prometheus2/configurations#rules-update-schedule)
* [rules-update-ssh-key](https://charmhub.io/prometheus2/configurations#rules-update-ssh-key)
* [rules\_wait\_time](https://charmhub.io/prometheus2/configurations#rules_wait_time)
* [scrape-interval](https://charmhub.io/prometheus2/configurations#scrape-interval)
* [scrape-jobs](https://charmhub.io/prometheus2/configurations#scrape-jobs)
* [scrape-timeout](https://charmhub.io/prometheus2/configurations#scrape-timeout)
* [snap\_channel](https://charmhub.io/prometheus2/configurations#snap_channel)
* [snapd\_refresh](https://charmhub.io/prometheus2/configurations#snapd_refresh)
* [static-targets](https://charmhub.io/prometheus2/configurations#static-targets)
* [web-listen-port](https://charmhub.io/prometheus2/configurations#web-listen-port)

[Learn about configurations >](https://juju.is/docs/juju/configuration#heading--application-configuration)

* alert-relabel-configs | string

  Alert relabeling is applied to alerts before they are sent to the Alertmanager. It has
  the same configuration format and actions as target relabeling. Alert relabeling is
  applied after external labels.

  One use for this is ensuring a HA pair of Prometheus servers with different external
  labels send identical alerts.
  Example:

  + action: labeldrop
    regex: monitor
* custom-rules | string

  Plan text rules to be loaded by prometheus.yml
* daemon-args | string

  Arbitary string containing list of arguments, separated by a semi-colon
  to begiven to the prometheus daemon. Please note that the charm will
  ignore certain arguments, for example "--web.external-url"
  Examples:
  "--log.level=debug; --web.enable-lifecycle; --storage.tsdb.retention=21d"
* enable-generic-rules | boolean

  Default: True

  If enabled, add minimal alerting rules for all targets. Includes at least an
  alert if the target is down, may be extended in the future to include more.
* evaluation-interval | string

  Default: 15s

  Default evaluation interval
* external-labels | string

  a comma-separated list of label=value labels that are applied to all
  metrics exported via federation. (E.g. label1=foo,label2=bar)
* external\_url | string

  The URL under which Prometheus is externally reachable (for example,
  if Prometheus is served via a reverse proxy). Used for generating
  relative and absolute links back to Prometheus itself. If the URL
  has a path portion, it will be used to prefix all HTTP endpoints
  served by Prometheus. If omitted, relevant URL components will be
  derived automatically.
  It's templatized to accept the following vars: {private\_address},
  {public\_address}, {port}, thus you can use e.g.:
  juju config prometheus external\_url="http://{private\_address}:{port}/"
* federate-config | string

  This will be parsed as YAML, format is a list of dicts as shown in the example.
  Example:

  + job\_name: 'prom-2'
    params:
    'match[]':
    - '{job="prometheus"}'
    - '{**name**=~"^job:"}'
    targets:
    - 'source-prometheus-2:9090'
  + job\_name: 'prod-1'
    scheme: https
    metrics\_path: /prometheus/federate
    params:
    'match[]':
    - '{job=~".+"}'
    targets:
    - 'my-production-site:443'
      label: production
* label-juju-units | boolean

  If set to true, a "juju\_unit" label is added to metrics with the name of
  the related juju unit. If the related unit is a subordinate, it should
  set the "principal-unit" key on the relation, with the name of the unit
  it's related to.
* monitor-name | string

  Prometheus monitor name, will default <service\_name>-monitor if not set
* nagios\_context | string

  Default: juju

  A string that will be prepended to instance name to set the host name
  in nagios. So for instance the hostname would be something like:
  juju-myservice-0
  If you're running multiple environments with the same services in them
  this allows you to differentiate between them.
* nagios\_servicegroups | string

  Default: juju

  Comma separated list of nagios servicegroups for the graphite check
* prometheus\_context | string

  A string that will be used to identify this site in the 'cloud\_name'
  label in Prometheus. If you're running multiple environments with the
  same services in them this allows you to differentiate between them.
  .
  If unset, the charm will use the value for nagios\_context.
* prometheus\_registration\_authtoken | string

  Default: changeme

  The authtoken used with prometheus registration requests.
* prometheus\_registration\_listen | string

  The ip prometheus registration will listen on, leave undefined to skip installation and setup of prometheus
  registration, set to 0.0.0.0 to listen on all interfaces.
* prometheus\_registration\_port | int

  Default: 12321

  The port the prometheus registration service will listen on.
* promreg\_snap\_channel | string

  Default: stable

  Snap channel for promreg installation. For example "stable" or "edge"
* remote-read | string

  URL of a remote endpoint for reading
  Example:
  "http://localhost:8086/api/v1/prom/read?u=paul&p=foo&db=prometheus"
* remote-write | string

  URL of a remote endpoint for writing
  [DEPRECATED]: This option should no longer be used,
  instead remote-write-config should be used.
  Example:
  "http://localhost:8086/api/v1/prom/write?u=paul&p=foo&db=prometheus"
* remote-write-config | string

  This will be parsed as YAML, format is a list of dicts as shown in the example.
  It support to supply multiple remote endpoints and it's configuratoin for the remote storage.
  If both remote-write and remote-write-config options supplied together, 'remote-write-config' gets precedence.
  For configuration, refer https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote\_write
  Example: Configure multiple remote-write endpoints with relabeling config.

  + name: remote\_a
    url: http://remote\_victoriametrics\_a:8428/api/v1/write
    write\_relabel\_configs:
    - target\_label: "remote"
      replacement: "remote\_a"
  + name: remote\_b
    url: http://remote\_victoriametrics\_b:8428/api/v1/write
    write\_relabel\_configs:
    - target\_label: "remote"
      replacement: "remote\_b"
* rules-repo | string

  Git repository with custom rules. Rules have to be in \*.yaml, \*.yml, or \*.rules files
* rules-repo-branch | string

  Name of the rules-repo branch to target, if not the default branch.
  Only used if "rules-repo" is set.
* rules-update-notify-email | string

  Email address that will receive cronned rule update failure emails
* rules-update-schedule | string

  Default: \*/10 \* \* \* \*

  Cron format schedule used for refresh from external rules repo.
  Only used if "rules-repo" is set
* rules-update-ssh-key | string

  Plain text private SSH key used to for git authentication.
  Example: juju config prometheus2 rules-update-ssh-key=@private\_ssh\_key\_file
  Also see "rules-repo" config option
* rules\_wait\_time | string

  Default: 5m

  The time that an alerting rule must be true for, before firing an alert. Generally
  specified as the number of seconds, minutes, hours or days in the form \d+[smhd].
* scrape-interval | string

  Default: 15s

  Interval at which to scrape targets
* scrape-jobs | string

  Can be used to add custom scrape jobs, for example SNMP exporter config.
  This will be parsed as YAML, format is a list of dicts as shown in the example.
  For convenience "{{ snmp\_exporter }}" and "{{ blackbox\_exporter }}" will be
  replaced with SNMP and blackbox exporter addresses respectively.
  Example:

  + job\_name: 'snmp'
    scrape\_interval: 1m
    scrape\_timeout: 1m
    static\_configs:
    - targets:
      * device1.example.com
      * device2.example.com
        params:
        module: [default]
        relabel\_configs:
    - source\_labels: [**address**]
      target\_label: \_\_param\_target
    - source\_labels: [\_\_param\_target]
      target\_label: instance
    - target\_label: **address**
      replacement: "{{ snmp\_exporter }}" # SNMP exporter.
  + job\_name: 'my-job'
    scrape\_interval: 30s
    scrape\_timeout: 30s
    static\_configs:
    - targets:
      * server1.example.com
      * server2.example.com
* scrape-timeout | string

  Default: 15s

  Timeout for scraping targets, must be <= scrape-interval
* snap\_channel | string

  Default: 2/stable

  Snap channel to use for installation. For example "stable" or "2/edge"
* snapd\_refresh | string

  How often snapd handles updates for installed snaps. The default (an empty string) is 4x per day. Set to "max" to check once per month based on the charm deployment date. You may also set a custom string as described in the 'refresh.timer' section here:
  https://forum.snapcraft.io/t/system-options/87
* static-targets | string

  Where to gather metrics from.
  Examples:
  host1.maas:9090
  host1.maas:9090, host2.maas:9090
* web-listen-port | int

  Default: 9090

  Port to listen on for the web interface, API, and telemetry.
