Prometheus is an open-source systems monitoring and alerting toolkit part of the Cloud Native Computing Foundation . Since its inception in 2012, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. Prometheus’s main features are: - a multi-dimensional data model with time series data identified by metric name and key/value pairs - PromQL, a flexible query language to leverage this dimensionality - no reliance on distributed storage; single server nodes are autonomous - time series collection happens via a pull model over HTTP - pushing time series is supported via an intermediary gateway - targets are discovered via service discovery or static configuration - multiple modes of graphing and dashboarding support.
Package | Version | License |
---|---|---|
Prometheus | 2.54.1 | Apache 2 |
Click the Deploy to DigitalOcean button to create a Droplet based on this 1-Click App. If you aren’t logged in, this link will prompt you to log in with your DigitalOcean account.
In addition to creating a Droplet from the Prometheus 1-Click App using the control panel, you can also use the DigitalOcean API. As an example, to create a 4GB Prometheus Droplet in the SFO2 region, you can use the following curl
command. You need to either save your API access token) to an environment variable or substitute it in the command below.
curl -X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer '$TOKEN'' -d \
'{"name":"choose_a_name","region":"sfo2","size":"s-2vcpu-4gb","image": "prometheus-18-04"}' \
"https://api.digitalocean.com/v2/droplets"
In the One Click app, we run Prometheus on port 9090.
Prometheus is configured via a config file found at /etc/prometheus/prometheus.yml in the droplet. You can add and configure which targets are scraped by Prometheus using the config file. Once you edit the config file, run sudo systemctl reload prometheus.service
to pick up the new changes.
For documentation visit: https://prometheus.io/docs/introduction/overview/ and the docs around configuration can be found here.
After the droplet is created you can visit the prometheus UI on
http://your\_server\_ip:9090/
Prometheus by default is configured to monitor itself. You can add more targets by editing the config file located at /etc/prometheus/prometheus.yml
on the droplet. For a run through of what is happening and how to write queries, refer to this guide.
When running in production, you should make sure that prometheus is not exposed to public but rather only to a few users protected by a reverse-proxy/firewall. This guide gives you an example on how to do that using basic auth and NGINX.