# Install json\_exporter

## json\_exporter

json\_exporter queries endpoints providing JSON-formatted data and converts that data into the Prometheus metrics format. It is used to query consensus and execution client JSON APIs, and to query external APIs for price and software release data.

### Create System Account

Create a user account under which json\_exporter can run.

```bash
sudo adduser --system json_exporter --group --no-create-home
```

<figure><img src="https://971382438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZON6xeJcH6NDhbzjDAWf%2Fuploads%2Fgit-blob-f7cd254a372472734cf741c6b8088d8a9a426589%2Fadduser-json_exporter.png?alt=media" alt=""><figcaption><p>Results of <code>adduser</code> command</p></figcaption></figure>

### Build the json\_exporter Executable

The instructions below are for version 0.5.0. [Check for newer versions of json\_exporter](https://github.com/prometheus-community/json_exporter/releases), and adapt the instructions below.

Clone the latest release.

```bash
mkdir ~/git
cd ~/git
git clone --depth 1 --branch v0.5.0 https://github.com/prometheus-community/json_exporter.git
```

<figure><img src="https://971382438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZON6xeJcH6NDhbzjDAWf%2Fuploads%2FhbAfZeIcUcZdeJbagIm7%2Fgit-clone-json_exporter.png?alt=media&#x26;token=1954973f-eb67-4fc1-95a6-f9cc57fe5485" alt=""><figcaption><p>Results of <code>git clone</code> command</p></figcaption></figure>

Build json\_exporter from source code.

```bash
cd json_exporter
make build
```

<figure><img src="https://971382438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZON6xeJcH6NDhbzjDAWf%2Fuploads%2FshC6RgaU3C79bQhyAbHS%2Fmake-build-json_exporter.png?alt=media&#x26;token=38f4b0c3-51f1-465b-bf35-7d8025f02afb" alt=""><figcaption><p>Results of <code>make build</code> command</p></figcaption></figure>

### Install json\_exporter

Copy the json\_exporter executable to the `/usr/local/bin` directory.

```bash
sudo cp json_exporter /usr/local/bin/
```

Check to see if `json_exporter` was installed correctly.

```bash
/usr/local/bin/json_exporter --version --help
```

<figure><img src="https://971382438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZON6xeJcH6NDhbzjDAWf%2Fuploads%2F5qnwpODEHYZLAjJZpBwy%2Fjson_exporter-version.png?alt=media&#x26;token=ef52eee8-28c6-4840-b657-5d23346d2fe2" alt=""><figcaption><p>Results of <code>json_exporter</code> command</p></figcaption></figure>

Create a directory for the configuration file.

```bash
sudo mkdir /etc/json_exporter
```

### Configure Startup

Create a systemd service file to configure automatic startup of the json\_exporter service.

```bash
sudo nano /etc/systemd/system/json_exporter.service
```

Insert the following into the json\_exporter systemd service file.

```
[Unit]
Description=JSON Exporter

[Service]
Type=simple
Restart=always
RestartSec=5
User=json_exporter
ExecStart=/usr/local/bin/json_exporter --config.file /etc/json_exporter/json_exporter.yml

[Install]
WantedBy=multi-user.target
```

Save the file and exit the editor.

### Optional: Clean Up Installation Files

Remove the json\_exporter git repository.

```bash
cd
rm -rf ~/git/json_exporter
```

### Notes

{% hint style="info" %}
json\_exporter will listen on port 7979. This is the port from which Prometheus will query for metrics.
{% endhint %}

{% hint style="warning" %}
We have not yet configured nor started json\_exporter.
{% endhint %}
