Skip to content

Setup and run prometheus with grafana on minio

Allan Roger Reid edited this page Dec 4, 2024 · 6 revisions

1.-

Using vm-broker or some other tool, create an ubuntu instance. Connect to it.

e.g. on vm-broker

ssh -p <ssh-port> ubuntu@1.2.3.4 -o "ServerAliveInterval=5" -o "ServerAliveCountMax=100000" -o "StrictHostKeyChecking=off"
loginctl enable-linger ubuntu

Download mc and set minio alias; generate the prometheus yml (copy paste this code after changing you minio endpoint/creds)

wget http://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc && sudo mv mc /usr/local/bin
mc alias set acme <minio-endpoint> <minio-user> <minio-password>
mc admin info acme
echo -e "global:\n  scrape_interval: 15s\n$(mc admin prometheus generate acme bucket)" > prometheus.yml
echo -e "global:\n  scrape_interval: 15s\n$(mc admin prometheus generate acme cluster)" >> prometheus.yml
echo -e "global:\n  scrape_interval: 15s\n$(mc admin prometheus generate acme node)" >> prometheus.yml
echo -e "global:\n  scrape_interval: 15s\n$(mc admin prometheus generate acme resource)" >> prometheus.yml

2.-

Get docker (copy paste this code)

# https://docs.docker.com/engine/install/ubuntu/
# Uninstall all conflicting packages
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

# Install using the apt repository
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -y

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

sudo docker run hello-world
# docker run hello-world

# Manage Docker as a non-root user
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

# docker run hello-world

3.-

Install prometheus and grafana as dockers (copy paste the following commands)

docker stop prometheus
docker rm prometheus
docker run -itd \
    --name prometheus \
    -p 10091:9090 \
    -v ~/prometheus.yml:/etc/prometheus/prometheus.yml \
    prom/prometheus &> /dev/null

docker stop grafana
docker rm grafana
docker run -itd \
		--name=grafana \
		-p 10030:3000 \
		grafana/grafana-enterprise:10.3.1-ubuntu &> /dev/null

4.-

Access

Grafana - http://jill-client.minio.training:10091/
Prometheus
user: admin / password: admin
http://jill-client.minio.training:10030/login
Clone this wiki locally