Manual Install
Installing Prometheus manually is accomplished by following the steps outlined on this page. The recommended approach is to install Prometheus using a Linux package. See the Linux Package documentation for details.
Prerequisites
Version
Prometheus version 2.47.2 or newer.
Create User and Group
Create a Prometheus user and group. This user will be used to execute the Prometheus process.
sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheusDownload Release
Download the v2.47.2 release.
curl -L \
-o prometheus.tar.gz \
https://github.com/prometheus/prometheus/releases/download/v2.47.2/prometheus-2.47.2.linux-amd64.tar.gzcurl -L \
-o prometheus.tar.gz \
https://github.com/prometheus/prometheus/releases/download/v2.47.2/prometheus-2.47.2.linux-arm64.tar.gzExtract the archive to your working directory.
mkdir prometheus
tar -xf prometheus.tar.gz --strip-components=1 -C prometheusBinary Installation
Install binaries to /usr/bin.
sudo cp prometheus/prometheus /usr/bin/prometheus
sudo cp prometheus/promtool /usr/bin/promtoolConfiguration
Configure the Prometheus configuration directories and files.
sudo mkdir /etc/prometheus
sudo touch \
/etc/prometheus/prometheus.yml \
/etc/prometheus/rules.yml \
/etc/prometheus/web.yml
sudo chmod 0750 /etc/prometheus
sudo chmod 0600 /etc/prometheus/prometheus.yml
sudo chmod 0600 /etc/prometheus/rules.yml
sudo chmod 0600 /etc/prometheus/web.yml
sudo chown -R prometheus:prometheus /etc/prometheusConfigure the Prometheus storage directories and files.
sudo mkdir /var/lib/prometheus
sudo mkdir /var/lib/prometheus/tsdb
sudo mv prometheus/console_libraries /var/lib/prometheus
sudo mv prometheus/consoles /var/lib/prometheus
sudo chmod 0750 /var/lib/prometheus
sudo chown -R prometheus:prometheus /var/lib/prometheusPopulate prometheus.yml.
sudo tee /etc/prometheus/prometheus.yml <<'EOF'
scrape_configs: []
rule_files: [/etc/prometheus/rules.yml]
EOFPopulate rules.yml.
sudo tee /etc/prometheus/rules.yml <<'EOF'
groups:
- name: configuration-rollups
interval: 1m
rules:
- record: bindplane_agent_measurements:rollup:rate:1m
expr: sum without (agent) (rate(bindplane_agent_measurements{}[1m9s999ms] offset 10s))
- name: 5m-configuration-rollups
interval: 5m
rules:
- record: bindplane_agent_measurements:rollup:rate:5m
expr: sum without (agent) (rate(bindplane_agent_measurements:1m{}[5m59s999ms] offset 10s))
- name: 1h-configuration-rollups
interval: 1h
rules:
- record: bindplane_agent_measurements:rollup:rate:1h
expr: sum without (agent) (rate(bindplane_agent_measurements:15m{}[1h14m59s999ms] offset 10s))
EOFLeave web.yml alone for now. See the TLS section for details on how to secure communication between Bindplane and Prometheus.
Systemd Service
Create the Systemd service.
sudo touch /usr/lib/systemd/system/prometheus.service
sudo chmod 0640 /usr/lib/systemd/system/prometheus.service
sudo tee /usr/lib/systemd/system/prometheus.service <<'EOF'
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--web.config.file /etc/prometheus/web.yml \
--storage.tsdb.retention.time 2d \
--web.enable-remote-write-receiver \
--web.listen-address :9090 \
--storage.tsdb.path /var/lib/prometheus/tsdb \
--web.console.templates=/var/lib/prometheus/consoles \
--web.console.libraries=/var/lib/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
EOFEnable and start Prometheus.
sudo systemctl enable prometheus
sudo systemctl start prometheus
sudo systemctl status prometheusValidate
You can validate that Prometheus is running with the following curl command.
curl -v -s localhost:9090/metricsLast updated
Was this helpful?