# Mag-install at i-configure ang Grafana

### Mag-install ng mga dependencies - Pushgateway

Ang dependency na ito ay partikular sa execution layer client ng Nethermind upang mapatunayan ang tamang pag-andar ng monitoring dashboard ng Grafana.

I-download ang pinakabagong bersyon at ang listahan ng mga checksum.

```sh
curl -LO https://github.com/prometheus/pushgateway/releases/download/v1.7.0/pushgateway-1.7.0.linux-amd64.tar.gz
curl -LO https://github.com/prometheus/pushgateway/releases/download/v1.7.0/sha256sums.txt
```

I-print ang listahan ng mga checksum at hanapin ang katumbas na sha256 checksum ayon sa iyong in-download na bersyon - halimbawa:

```sh
cat sha256sums.txt
```

Kopyahin ang string ng checksum at ipalit ito sa unang string component sa ibaba upang patunayan ang checksum ng iyong in-download na zip file. Para sa iyong kaginhawaan, ang aktwal na string ay naka-pre-fill na.

```sh
echo "6fedc802c07f4d83a70d45b73bae9d3ab026f827ecf99c026fc896335e5211b7  pushgateway-1.7.0.linux-amd64.tar.gz" | sha256sum --check
```

**Inaasahang output**: Patunayan ang output ng pag-verify ng checksum

```
pushgateway-1.7.0.linux-amd64.tar.gz: OK
```

Kung na-verify ang checksum, i-extract ang mga file at ilipat ang mga ito sa (`/usr/local/bin`) directory para sa kalinisan at pinakamahusay na praktis.

```sh
tar xvf pushgateway-1.7.0.linux-amd64.tar.gz
cd pushgateway-1.7.0.linux-amd64
sudo cp pushgateway /usr/local/bin
```

Then, clean up the duplicated copies.Pagkatapos, linisin ang mga duplicated na kopya.

```sh
cd
rm -r pushgateway-1.7.0.linux-amd64 pushgateway-1.7.0.linux-amd64.tar.gz
```

Lumikha ng isang account (`pushgateway`) na walang access sa server para sa Pushgateway upang tumakbo bilang isang background service.

```sh
sudo useradd --no-create-home --shell /bin/false pushgateway
```

Lumikha ng systemd configuration file upang patakbuhin ang Pushgateway.

```sh
sudo nano /etc/systemd/system/pushgateway.service
```

I-paste ang sumusunod na nilalaman sa configuration file.

```sh
[Unit]
Description=Prometheus Pushgateway
After=network.target
Wants=network.target

[Service]
User=pushgateway
Group=pushgateway
Type=simple
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/pushgateway

[Install]
WantedBy=default.target
```

Kapag tapos ka na, i-save ito gamit ang `Ctrl+O` at `Enter`, pagkatapos ay mag-exit gamit ang `Ctrl+X`.

Simulan ang Pushgateway service.

```sh
sudo systemctl daemon-reload
sudo systemctl start pushgateway
sudo systemctl enable pushgateway
sudo systemctl status pushgateway
```

Inaasahang output: Ang output ay dapat magsabi na ang Pushgateway ay "active (running)". Pindutin ang CTRL-C upang lumabas at magpapatuloy ang Pushgateway sa pagtakbo.

Bantayan ang mga sanhi ng mga mensahe ng error.

```sh
sudo journalctl -fu pushgateway -o cat | ccze -A
```

### I-download at i-install ang Grafana

Mag-install ng Grafana gamit ang APT package manager - I-download ang Grafana GPG key, idagdag ang Grafana sa mga APT sources, i-refresh ang apt cache, at siguruhing idinagdag ang Grafana sa APT repository.

```bash
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
sudo apt update
apt-cache policy grafana
```

**Inaasahang output**: Siguruhing ang pinakamataas na bersyon ay tumutugma sa pinakabagong bersyon dito -[ https://grafana.com/grafana/download](https://grafana.com/grafana/download)

```bash
grafana:
  Installed: (none)
  Candidate: 10.0.3
  Version table:
     10.0.3 500
        500 <https://packages.grafana.com/oss/deb> stable/main amd64 Packages
     10.0.2 500
        500 <https://packages.grafana.com/oss/deb> stable/main amd64 Packages
     10.0.1 500
        500 <https://packages.grafana.com/oss/deb> stable/main amd64 Packages
```

Tumakbo ng installation command.

```bash
sudo apt install -y grafana
```

### Simulan ang Grafana server.

```bash
sudo systemctl start grafana-server
sudo systemctl status grafana-server
```

Ang output ay dapat magsabi na ang Grafana ay "active (running)". Pindutin ang CTRL-C upang lumabas at magpapatuloy ang Grafana sa pagtakbo.

Gamitin ang sumusunod na command upang suriin ang mga logs para sa anumang mga babala o mga error:

```bash
sudo journalctl -fu grafana-server -o cat | ccze -A
```

Pindutin ang `CTRL-C` upang lumabas.

Kung ang serbisyo ng Grafana ay umaandar nang maayos, maaari na nating paganahin ito upang umandar nang awtomatiko kapag nire-reboot ang sistema.

```bash
sudo systemctl enable grafana-server
```

### I-configure ang Grafana Dashboard

1. Pumunta sa `http://<yourserverip>:3000/`
2. Ilagay ang admin para sa parehong username at password
3. Pumili ng Data Sources at pindutin ang Add data source, pagkatapos pumili ng Prometheus at ilagay ang[ http://localhost:9090](http://localhost:9090/) para sa URL
4. I-setup ang mga dashboard - Sa kaliwang menu, pindutin ang **Dashboards >> Import**
   * Execution client dashboard
     * Nethermind: I-paste ang JSON text [dito](https://github.com/samuelclk/ETH_full_home_staking_guide/blob/main/monitoring-maintenance-and-updates/set-up-monitoring-suite/Nethermind-grafana-JSON)
   * Consensus client dashboard
     * Teku: Ilagay ang dashboard ID - `16737`
   * Node Exporter dashboard - I-paste ang JSON text [dito](https://github.com/samuelclk/ETH_full_home_staking_guide/blob/main/monitoring-maintenance-and-updates/set-up-monitoring-suite/Nethermind-grafana-JSON)
5. Pumili ng `Prometheus` mula sa "Pumili ng isang Prometheus data source dito" drop down field.

### Screenshot samples ng Grafana Dashboard

#### Nethermind:

<figure><img src="/files/uUxczyGpoEsvhA9CQoCi" alt=""><figcaption></figcaption></figure>

#### Teku:

<figure><img src="/files/M5qPYxXTaZQaU73WPMJP" alt=""><figcaption></figcaption></figure>

#### Node Exporter:

<figure><img src="/files/5NNZr1uOaqRIXKanZfD9" alt=""><figcaption></figcaption></figure>

a


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bitskwela.gitbook.io/bitskwela-x-lido-cs-fleet-eth-home-staking-guide/monitoring-maintenance-at-updates/mag-set-up-ng-monitoring-suite/mag-install-at-i-configure-ang-grafana.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
