Monitoring stack setup — Part 1: Prometheus & Grafana

sudo useradd --no-create-home prometheus
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
wget https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus-2.30.3.linux-amd64.tar.gz
tar -xvf prometheus-2.30.3.linux-amd64.tar.gz
sudo cp prometheus-2.30.3.linux-amd64/prometheus /usr/local/bin
sudo cp prometheus-2.30.3.linux-amd64/promtool /usr/local/bin
sudo cp -r prometheus-2.30.3.linux-amd64/consoles /etc/prometheus/
sudo cp -r prometheus-2.30.3.linux-amd64/console_libraries /etc/prometheus
sudo cp prometheus-2.30.3.linux-amd64/promtool /usr/local/bin/
global:
scrape_interval: 15s
external_labels:
monitor: 'prometheus'
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
sudo chown -R prometheus:prometheus /var/lib/prometheus/
sudo vim /etc/systemd/system/prometheus.service
[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
sudo systemctl daemon-reload
sudo systemctl enable prometheus
sudo systemctl start prometheus
sudo systemctl status prometheus
sudo systemctl status prometheus
curl http://localhost:9090/graph
sudo apt-get install -y adduser libfontconfig1
wget https://dl.grafana.com/oss/release/grafana_8.2.2_amd64.deb
sudo dpkg -i grafana_8.2.2_amd64.deb
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
sudo systemctl enable grafana-server.service
sudo systemctl status grafana-server

--

--

--

I spend my day learning AWS, Kubernetes & Cloud Native tools. Nights on LinkedIn & Medium. Work: Engineering @ PayPal.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The arShield Beta Is Live — Join the Immunefi Bug Bounty for up to $50k Rewards Today

Dots Indicator for Viewpager made easy — Android

What I Learnt About Eng Management

Do you have to support landscape in your Android app?

Wikipedia web page rendered for portrait, but shown in landscape

Microsoft Outlook 2008 Mac Download

Elixir, Kubernetes, and minikube

Read and Write Tags of Music Files with FFmpeg — 1A23 Blog

Competitor Review, Crodo & Vlaunch? Why will Crodo become the top 1 Ido platform?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shishir Khandelwal

Shishir Khandelwal

I spend my day learning AWS, Kubernetes & Cloud Native tools. Nights on LinkedIn & Medium. Work: Engineering @ PayPal.

More from Medium

Increased developer productivity with Kubernetes virtual cluster

How to Setup Prometheus Monitoring On a Kubernetes Cluster

Creating GitOps Pipelines Using Amazon Elastic Kubernetes Service(EKS) and GitHub Actions |…

CloudOps Summit Recap: Take a deep dive into Day 2 Kubernetes