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.

Juju prometheus charm

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

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

How to deploy the charm

Development

Explicitly set JUJU_REPOSITORY:

export JUJU_REPOSITORY=/path/to/charms
mkdir -p $JUJU_REPOSITORY/layers

Branch code to:

$JUJU_REPOSITORY/layers/prometheus/

Modify

Assemble the charm:

charm build

How to deploy with storge (requires juju 1.25)

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

Configuration

prometheus_registration_authtoken
(string)
                            The authtoken used with prometheus registration requests.

                        
changeme
install_method
(string)
                            How to install prometheus. If set to "apt" the package will be installed using apt-get. If set to "snap", empty string or unset snap package will be installed

                        
snap
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

                        
static-targets
(string)
                            Where to gather metrics from.
Examples:
  host1.maas:9090
  host1.maas:9090, host2.maas:9090

                        
install_keys
(string)
                            YAML list of GPG keys for installation sources, as a string. For apt repository
URLs, use the public key ID used to verify package signatures. For 
other sources such as PPA, use empty string. This list must have the 
same number of elements as install_sources, even if the key items are 
all empty string. An example to go with the above for install_sources:
  install_keys: |
   - "ABC"
   - ""

                        
daemon-args
(string)
                            Arbitary string containing list of arguments, separated by a semi-colon
to be given to the prometheus daemon.
Examples:
  "-my-famous-arg 1; -my-almost-famous-arg 2 3 4 5 6; -my-boring-arg 7"

                        
monitor-name
(string)
                            Prometheus monitor name, will default <service_name>-monitor if not set

                        
scrape-interval
(string)
                            Interval at which to scrape targets
                        
15s
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.

                        
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.

                        
nagios_servicegroups
(string)
                            Comma separated list of nagios servicegroups for the graphite check

                        
juju
rules-update-notify-email
(string)
                            Email address that will receive cronned rule update failure emails

                        
rules-update-ssh-key
(string)
                            Plain text private SSH key used to for git authentication.
Also see "rules-repo" config option

                        
rules-update-schedule
(string)
                            Cron format schedule used for refresh from external rules repo.
Only used if "rules-repo" is set

                        
*/10 * * * *
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 }}" will be replaced with SNMP exporter address.
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

                        
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)

                        
rules-repo
(string)
                            Git repository with custom rules. Rules have to be in *.rules files

                        
prometheus_registration_port
(int)
                            The port the prometheus registration service will listen on.

                        
12321
snap_channel
(string)
                            If install_method is set to "snap" this option controlls channel name.    
Supported values are: "stable", "candidate", "beta" and "edge"

                        
stable
snap_proxy
(string)
                            HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.

                        
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
custom-rules
(string)
                            Plan text rules to be loaded by prometheus.yml

                        
install_sources
(string)
                            YAML list of additional installation sources, as a string. The number of
install_sources must match the number of install_keys. For example:
  install_sources: |
   - ppa:project1/ppa
   - ppa:project2/ppa

                        
[ "ppa:canonical-bootstack/prometheus" ]
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}/"