> For the complete documentation index, see [llms.txt](https://services.validexis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://services.validexis.com/monitoring/tenderduty-for-node-monitoring.md).

# 🕵️  TenderDuty for Node Monitoring

TenderDuty is a robust tool for monitoring blockchain nodes, providing insights into network height, validator status, uptime, signed blocks, and transmitted blocks. It also supports alerts via Telegram and Discord for effective monitoring.

***

### *Preparing the Environment*

Start by updating your server and installing the necessary dependencies:

```bash
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget jq make gcc tmux htop pkg-config libssl-dev tar clang unzip -y
```

### *Installing Docker*

Docker is required to run TenderDuty. Follow these steps to install it:

Add the Docker repository key:

```bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
```

Add the Docker repository:

```bash
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
```

Install Docker:

```bash
sudo apt update && sudo apt install docker-ce -y
```

Verify the installation:

```bash
docker --version
```

### *Setting Up TenderDuty*

Create a dedicated directory for TenderDuty and set up the configuration.

Create the directory and navigate to it:

```bash
mkdir $HOME/tenderduty && cd $HOME/tenderduty
```

Download the example configuration file:

```bash
docker run --rm ghcr.io/blockpane/tenderduty:latest -example-config > config.yml
```

Edit the configuration file:

```bash
nano $HOME/tenderduty/config.yml
```

Customize the configuration:

* Replace `celestia` with your project name.
* Update the `chain_id` (e.g., replace `mocha-4` with your chain ID, such as `testnet-1`).
* Enter your validator address in the `valoper_address` field.
* Update the `url` field with the RPC address of your node, such as `tcp://localhost:26657`.

### *Running TenderDuty*

Launch TenderDuty as a Docker container using the following command:

```bash
docker run -d --name tenderduty -p "8888:8888" --restart unless-stopped \
    -v $(pwd)/config.yml:/var/lib/tenderduty/config.yml \
    ghcr.io/blockpane/tenderduty:latest
```

### *Securing the Server*

To protect your server, configure a firewall.

Install the `ufw` firewall if not already installed:

```bash
sudo apt install ufw
```

Set up firewall rules:

```bash
sudo ufw default allow outgoing
sudo ufw default deny incoming
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw allow 8888/tcp
sudo ufw enable
```

You can now access the TenderDuty dashboard in your browser at:\
`http://<YOUR_SERVER_IP>:8888`.

***

### *Configuring Telegram Notifications*

To configure, use this [documentation](https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id).

To enable notifications in Telegram:

1. Create a Telegram bot using `@BotFather` and save the API token.
2. Create a Telegram group, add the bot to the group, and retrieve the group ID.
3. Edit the configuration file:

   ```bash
   nano $HOME/tenderduty/config.yml
   ```
4. Modify the Telegram section:

   ```yaml
   telegram:
     enabled: yes
     api_key: '<YOUR_BOT_API_KEY>'
     channel: '<YOUR_GROUP_ID>'
   ```

### *Restarting TenderDuty*

Apply the configuration changes by restarting the Docker container:

```bash
docker restart tenderduty
```

***

TenderDuty is now fully installed and configured. Monitor your node status, receive real-time alerts, and manage everything via the web interface.
