STEPS TO RUN PROMETHEUS AND GRAFANA

For Monitoring your

  1. SSH into your EC2-server.

  • Open your terminal and navigate to the folder that has your <Key.pem> file by typing the following text into the terminal.

cd </Path/to/.pem>
#Example: cd /Users/Downloads
  • Login to your AWS console, and search for EC2.

  • Open the EC2 dashboard and click on Instances.

  • Select the validator instance and click on Connect (top right).

  • Under SSH Client, you will find a command.

Example:ssh -i "Key.pem" ec2-user@ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com
  • Copy the command and paste it into your terminal and click enter

  1. In the server, download the Prometheus config file using the below commands.

mkdir prometheus

cd prometheus

wget https://github.com/yashLN/Beacon_Presync/blob/8b7a89a2d6d65c0b043ded3c7b7ced45b69f77ad/prometheus/prometheus.yaml

cd
  1. Enter the following command in your server to change permission of the config file.

sudo chmod -R 777 prometheus
  1. Enter the following command in your server to start the prometheus.

docker run -d -p 9090:9090 -v /home/ec2-user/prometheus/:/prometheus/ --name prometheus --net host prom/prometheus --config.file=/prometheus/prometheus.yaml
  1. Enter the following command in your server to start grafana.

docker run -d -p 3000:3000 -v /home/ec2-user/grafana/:/grafana/ --name graph --net host grafana/grafana:latest
  1. Enter the following command in your server to start node-exporter to query system metrics.

docker run -d -v /home/ec2-user/node:/node --net host --name node quay.io/prometheus/node-exporter:latest --path.rootfs=/node
  1. Open port 3000 for your ec2 instance.

  • Check the box for your ec2 instance.

  • From the dashboard below, click on security.

  • Click on the blue link under security groups.

  • Click on edit inbound rules button.

  • Click on Add Rule.

  • Select, Custom TCP, and enter your system IP(where you access your browser) and enter port 3000.

  • Click on save rules.

  1. Access the grafana dashboard via your web browser using http://<ec2-instance-ip>:3000

  2. To add the datasource, go to connections and select datasources.

  3. Click on add datasource, and enter the URL below in the HTTP section. Then, click on Save & Test.

http://localhost:9090
  1. To add the dashboard, click on new and select import.

  2. Under Import via panel json, paste the contents of prysm_beacon.json from the link below.

https://github.com/yashLN/Beacon_Presync/blob/main/grafana/prysm_beacon.json

Last updated