sudo apt-cache policy prometheus
sudo useradd -M -r -s /bin/false prometheus
sudo mkdir /etc/prometheus /var/lib/prometheus
wget https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus-2.30.3.linux-amd64.tar.gz
tar xzf prometheus-2.30.3.linux-amd64.tar.gz
sudo cp prometheus-2.30.3.linux-amd64/{prometheus,promtool} /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/{prometheus,promtool}
sudo cp -r prometheus-2.30.3.linux-amd64/{consoles,console_libraries} /etc/prometheus/
sudo cp prometheus-2.30.3.linux-amd64/prometheus.yml /etc/prometheus/prometheus.yml
sudo nano /etc/prometheus/prometheus.yml
static_configs:
- targets: ['localhost:9091']
- job_name: 'Axelar-Validator'
static_configs:
- targets: ['localhost:26660']
labels:
group: 'Validator'
- job_name: node
static_configs:
- targets: ['localhost:9100']
sudo chown -R prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
sudo nano /etc/systemd/system/prometheus.service
Now copy the section below:
[Unit]
Description=Prometheus Time Series Collection and Processing Server
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries\
--web.listen-address="0.0.0.0:9091"
[Install]
WantedBy=multi-user.target
sudo systemctl enable prometheus
sudo systemctl start prometheus
sudo systemctl status prometheus