Step 1 – Create a file:
$ vi /etc/systemd/system/prometheus.service
[Unit] | |
Description=Prometheus Server | |
Documentation=https://prometheus.io/docs/introduction/overview/ | |
After=network-online.target | |
[Service] | |
User=root | |
Restart=on-failure | |
#Change this line if you download the | |
#Prometheus on different path user | |
ExecStart=~/prometheus/prometheus --storage.tsdb.path=/var/lib/prometheus/data/ --web.external-url=http://myurl.com:9090 | |
[Install] | |
WantedBy=multi-user.target |
[Unit] | |
Description=Prometheus | |
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 | |
[Install] | |
WantedBy=multi-user.target |
Step 2 – Reload the Systemctl Daemon:
$ sudo systemctl daemon-reload
Step 3 – Start the Prometheus service:
$ sudo systemctl start prometheus
$ sudo systemctl status prometheus
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND