> For the complete documentation index, see [llms.txt](https://orakuru.gitbook.io/crystal-ball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://orakuru.gitbook.io/crystal-ball/additional-software/prometheus-and-grafana-monitoring-optional.md).

# Prometheus and Grafana monitoring (optional)

Steps for getting Prometheus and Grafana running

### Step 1: Download latest Prometheus release

Latest Prometheus release can be found [here](https://prometheus.io/download/), or you can download it (latest version at the time or writing this guide) from terminal using

```
$ wget https://github.com/prometheus/prometheus/releases/download/v2.27.1/prometheus-2.27.1.linux-amd64.tar.gz
$ tar xvfz prometheus-2.27.1.linux-amd64.tar.gz
```

This will create `prometheus-2.27.1.linux-amd64` folder containing Prometheus binary

### Step 2: Write a configuration file for monitoring Orakuru node

Create a `prometheus.yml` somewhere on your server and add following content:

```yaml
global:
    scrape_interval: 15s # How often to request metrics
    external_labels:
        monitor: 'orakuru-monitor'

scrape_configs:
    - job_name: 'orakuru'
      # Default interval can be overriden here
      scrape_interval: 5s
      static_configs:
        # This will tell prometheus to collect data from Orakuru node
        # If your Orakuru node instance will be running on a separate server, make sure to change the address here 
        - targets: ['localhost:9000']
```

This configuration file will tell Prometheus to collect data from your Orakuru node every 5 seconds. You can modify this configuration to suit your needs.

### Step 3: Starting Prometheus

You can start Prometheus using

```
$ ./prometheus --config.file=prometheus.yml
```

Make sure to replace `prometheus.yml` with path to your configuration file, if they are not in the same directory.

{% hint style="warning" %}
As with Binance Smart Chain node, running Prometheus this way will stop it when you end your session. In order to prevent this from happening you should use `tmux`, `screen`, or your initialization system of choice (`systemd`, `openrc`, etc.)
{% endhint %}

### Step 4: Installing Grafana

In order to keep this guide short, check out official Grafana installation guide for your OS and platform of choice:

* For Debian or Ubuntu follow [Install on Debian or Ubuntu](https://grafana.com/docs/grafana/latest/installation/debian/)
* For RPM-based Linux distributions follow [Install on RPM-based Linux (CentOS, Fedora, OpenSuse, RedHat)](https://grafana.com/docs/grafana/latest/installation/rpm/)
* For macOS follow [Install on macOS](https://grafana.com/docs/grafana/latest/installation/mac/)
* For Windows follow [Install on Windows](https://grafana.com/docs/grafana/latest/installation/windows/)
* For Docker follow [Run Docker image](https://grafana.com/docs/grafana/latest/installation/docker/)

### Step 5: Add Prometheus data source to Grafana

Open Grafana in your browser (`http://your-server-ip:3000`), log in with default credentials (`admin` and `admin`), change your password to a more secure one, afterwards go to **Configuration** (gear icon), then **Data Sources**, and add **Prometheus** data source. Set URL to your Prometheus server URL.
