prometheus2 #1

Supports: xenial bionic
Add to new model

Description

Prometheus is a systems and service monitoring system. It collects
metrics from configured targets at given intervals, evaluates rule
expressions, displays the results, and can trigger alerts if some
condition is observed to be true.
Due to significant database changes in version 2.0 this charm
supports prometheus 2.0 and later only.


Juju prometheus2 charm

This charm provides the Prometheus monitoring system from http://prometheus.io/.

It supports version 2.0 and later. If you want to deploy prometheus 1.x please
use cs:prometheus charm.

Optionally the charm will install the Prometheus Registration daemon
alongside Prometheus to aid in the registration of targets.

The charm can be related to the following charms to extend functionality:

  • grafana
  • prometheus-alertmanager
  • prometheus-pushgateway
  • prometheus-snmp-exporter
  • prometheus-blackbox-exporter
  • telegraf
  • mtail

Configuration

The charm is designed to work out of the box without need to set any
configuration options. Please refer to config.yaml for detailed help on
support settings. Below is a list of the most common options:

  • daemon-args - add extra CLI arguments, for example --storage.tsdb.retention=21d
  • scrape-jobs - allows for custom scrape jobs to be configured
  • snap_proxy - web proxy address to use when accessing the snap store
  • external_url
  • scrape-interval
  • evaluation-interval
  • remote-read/remote-write - configure read/write to remote datastore endpoints

Juju storage support

The charm supports juju storage (requires juju 1.25 or later).
For example to deploy with local filesystem run:

juju deploy local:trusty/prometheus2 --storage metrics-filesystem=rootfs prometheus2

Juju resources support

The charm support juju resources, which is handy in offline deployments. Prefetch the snaps:

snap download --channel=stable core
snap download --channel=2/stable prometheus

Provide downloaded snaps as resources to the application:

juju deploy cs:prometheus2 --resource core=core_6818.snap --resource prometheus=prometheus_20.snap

Configuration

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"
evaluation-interval
(string) Default evaluation interval
15s
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 set 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) 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.
juju
nagios_servicegroups
(string) Comma separated list of nagios servicegroups for the graphite check
juju
prometheus_registration_authtoken
(string) The authtoken used with prometheus registration requests.
changeme
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) The port the prometheus registration service will listen on.
12321
promreg_snap_channel
(string) Snap channel for promreg installation. For example "stable" or "edge"
stable
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 Example: "http://localhost:8086/api/v1/prom/write?u=paul&p=foo&db=prometheus"
rules-repo
(string) Git repository with custom rules. Rules have to be in *.rules files
rules-update-notify-email
(string) Email address that will receive cronned rule update failure emails
rules-update-schedule
(string) Cron format schedule used for refresh from external rules repo. Only used if "rules-repo" is set
*/10 * * * *
rules-update-ssh-key
(string) Plain text private SSH key used to for git authentication. Also see "rules-repo" config option
scrape-interval
(string) Interval at which to scrape targets
15s
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
snap_channel
(string) Snap channel to use for installation. For example "stable" or "2/edge"
2/stable
snap_proxy
(string) DEPRECATED. Use snap-http-proxy and snap-https-proxy model configuration settings. HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.
snap_proxy_url
(string) DEPRECATED. Use snap-store-proxy model configuration setting. The address of a Snap Store Proxy to use for snaps e.g. http://snap-proxy.example.com
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) Port to listen on for the web interface, API, and telemetry.
9090