# Monad Node Operator Guide: Attaching secp Public Key as `secp_key` Label in OpenTelemetry

## 1. Prerequisites & File Preparation

### 1.1 Ensure the key file exists
```bash
grep "public key" /opt/monad/backup/secp-backup /opt/monad/backup/bls-backup > /home/monad/pubkey-secp-bls
```
Ensure it exists. If not, create:
```
secp-backup:Secp public key: <YOUR_SECP_KEY>
bls-backup:BLS public key: <YOUR_BLS_KEY>
```

### 1.2 Set correct permissions
```bash
sudo chmod 644 /home/monad/pubkey-secp-bls
```

### 1.3 Verify secp key matches your validator key
```bash
grep secp-backup /home/monad/pubkey-secp-bls
```

### 1.4 Ensure OTEL collector is installed
```bash
otelcol --version
```
If not, install it:
```bash
curl -fsSL -o /tmp/otelcol_0.139.0_linux_amd64.deb https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.139.0/otelcol_0.139.0_linux_amd64.deb
dpkg -i /tmp/otelcol_0.139.0_linux_amd64.deb
```

---

## 2. Update otelcol config

```bash
MF_BUCKET="https://bucket.monadinfra.com"
SECP_KEY="$(awk -F': ' '/secp-backup:Secp public key/ {print $2}' /home/monad/pubkey-secp-bls)"
rm -f /etc/otelcol/config.yaml
curl -o /etc/otelcol/config.yaml $MF_BUCKET/tmp/otel-collector-config.yaml
sed -i "s/SECP_KEY/${SECP_KEY}/g" /etc/otelcol/config.yaml
sudo systemctl restart otelcol.service
```

---

## 3. Verification

```bash
curl -s http://localhost:8889/metrics | grep secp_key
```

OR check Grafana labels.

---

Done!
