Grafana Dashboard by shachopra
Grafana Dashboard Reference JSON file:
Setting Up Grafana Dashboard for Node Monitoring
1. Install docker
2. Install Grafana
Create Docker Compose Configuration for Grafana: docker-compose-grafana.yml
Copy cd $HOME
mkdir docker
mkdir docker/grafana
cd $HOME/docker/grafana
Copy nano docker-compose-grafana.yml
Copy services:
grafana:
image: grafana/grafana
container_name: grafana
restart: unless-stopped
ports:
- '3000:3000'
volumes:
- grafana-storage:/var/lib/grafana
volumes:
grafana-storage: {}
Copy docker-compose -f docker-compose-grafana.yml up -d
This Docker Compose setup deploys Grafana in a Docker container
3. Install Prometheus
Create Docker Compose Configuration for Prometheus: docker-compose-prometheus.yml
Copy cd $HOME
mkdir docker/prometheus
cd $HOME/docker/prometheus
Copy nano docker-compose-prometheus.yml
Copy services:
prometheus:
image: prom/prometheus
container_name: prom
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- 9092:9090
restart: unless-stopped
volumes:
- ./prometheus:/etc/prometheus
- prom_data:/prometheus
volumes:
prom_data:
Create Prometheus Configuration File: prometheus.yml
Copy cd $HOME
mkdir docker/prometheus/prometheus
cd $HOME/docker/prometheus/prometheus
Copy global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: []
scheme: http
timeout: 10s
api_version: v1
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["your-ip:9092"]
- job_name: "story"
static_configs:
- targets: ["<your-ip>:47660"]
- job_name: "exporter"
static_configs:
- targets: ["<your-ip>:9100"]
- job_name: "geth"
metrics_path: /debug/metrics/prometheus
static_configs:
- targets: ["<your-ip>:6060"]
Copy cd $HOME/docker/prometheus
Copy docker-compose -f docker-compose-prometheus.yml up -d
This Docker Compose setup deploys Prometheus in a Docker container
4. Configure story config.toml & modify Geth Service file
Copy nano $HOME/.story/story/config/config.toml
Copy #make sure prometheus is set to true
prometheus = true
prometheus_listen_addr = 47660
Copy nano /etc/systemd/system/story-geth.service
Copy [Unit]
Description=Story Geth daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/go/bin/story-geth --odyssey --syncmode full --http --ws --metrics --metrics.addr 0.0.0.0 --metrics.port 6060
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Copy systemctl daemon-reload
5. Install Node Exporter
Copy cd $HOME
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar xvf node_exporter-1.8.2.linux-amd64.tar.gz
cd node_exporter-1.8.2.linux-amd64
Move the Node Exporter Binary
Copy sudo cp node_exporter /usr/local/bin
Create a Node Exporter User
Copy sudo useradd --no-create-home --shell /bin/false node_exporter
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
Copy sudo nano /etc/systemd/system/node_exporter.service
Copy [Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
Copy sudo systemctl daemon-reload
sudo systemctl enable node_exporter
sudo systemctl start node_exporter
sudo systemctl status node_exporter.service
6. Configuring and Using Grafana
Choose Prometheus as data source type
Then go to Dashboards & click on new dashboard.
Then click on Import dashboard.