Prometheus
Metrics collection, storage and alerting with PromQL.
jailops app install prometheusAdd --dry-run to see every step first. From the console: open Apps, pick Prometheus and press Install; the dialog takes the jail name, the network and the storage, and Preview steps shows the plan before anything runs. See the console.
About
Prometheus scrapes metrics from HTTP endpoints, stores them as time series and evaluates alerting rules. The package installs the current major release with a configuration that scrapes Prometheus itself; scrape targets and rule files are added to /usr/local/etc/prometheus.yml.
The time series database lives under /var/db/prometheus. The web interface and the API are on port 9090.
What you get
Ports
9090/tcphttpThe web interface, the query API and /metrics.
Data on its own datasets
/var/db/prometheusvolumevar-db-prometheusThe time series database (storage.tsdb.path).
Configuration
/usr/local/etc/prometheus.ymlScrape targets, rule files and alertmanagers; 'service prometheus reload' applies a change. Restart:service prometheus restart.
Logs
/var/log/daemon.logThe server log; daemon(8) sends it to syslog as daemon.info.
Health check
HTTP: GET :9090/-/healthy answers 200, retried for up to 60 seconds.
Services
prometheus: enabled and started
Setup, once, before the first start
One command, run in the jail as argv, without a shell:
/usr/sbin/chown prometheus:prometheus /var/db/prometheus
After the installation
The notes of the definition, shown after the installation too.
Add scrape targets under scrape_configs in /usr/local/etc/prometheus.yml and run service prometheus reload inside the jail. Retention defaults to 15 days; set prometheus_args="--storage.tsdb.retention.time=90d" in the jail's rc.conf to change it.
How it connects
jailops app allow prometheus from @web
This opens port 9090/tcp of this app to the jail web, and nothing else. The service itself must listen on the jail's address and accept the client.
An installed app is closed: nothing reaches it, not even its own network, until you allow a source. A source is a jail (@web), a jail of another project (@project/web), an address set, an address or prefix, or host. jailops app access prometheus lists who may connect. The names here are jail names: jailops app install names the jail after the app unless --name says otherwise.