# STEPS TO RUN PROMETHEUS AND GRAFANA

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.&#x20;

```
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

2. 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
```

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

```
sudo chmod -R 777 prometheus
```

4. 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
```

4. 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
```

6. 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
```

7. Open port 3000 for your ec2 instance.

* Check the box for your ec2 instance.
* From the dashboard below, click on security.
* &#x20;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.

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

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

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

```
http://localhost:9090
```

11. To add the dashboard, click on new and select import.
12. 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
```
