# CCIP Monitor Service Status Report

**Date**: $(date)  
**Service**: CCIP Monitor  
**VMID**: 3501  
**Container**: ccip-monitor-1

---

## 📊 Status Summary

### Service Status
- **Container**: ✅ Exists
- **Container Status**: ⚠️ Not Running
- **Systemd Service**: ⚠️ Inactive
- **Configuration**: ✅ Configured
- **Python Environment**: ✅ Ready

---

## ✅ What's Working

### 1. Configuration ✅
- **Configuration File**: `/opt/ccip-monitor/.env` exists
- **CCIP Router Address**: `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e` ✅
- **CCIP Sender Address**: `0x105F8A15b819948a89153505762444Ee9f324684` ✅
- **RPC URL**: `http://192.168.11.250:8545` ✅
- **Metrics Port**: `8000`
- **Check Interval**: `60` seconds

### 2. Installation ✅
- **Monitor Script**: `/opt/ccip-monitor/ccip_monitor.py` exists
- **Python Virtual Environment**: `/opt/ccip-monitor/venv` exists
- **Python Dependencies**: web3 and other dependencies installed
- **Systemd Service**: `/etc/systemd/system/ccip-monitor.service` configured

---

## ⚠️ Issues Found

### 1. Container Not Running
**Issue**: Container 3501 exists but is not currently running.

**Solution**:
```bash
ssh root@192.168.11.10 'pct start 3501'
```

### 2. Service Not Active
**Issue**: The CCIP Monitor systemd service is inactive.

**Solution** (after starting container):
```bash
ssh root@192.168.11.10 'pct exec 3501 -- systemctl start ccip-monitor'
```

To enable service to start on boot:
```bash
ssh root@192.168.11.10 'pct exec 3501 -- systemctl enable ccip-monitor'
```

### 3. LINK Token Not Configured (Optional)
**Status**: LINK_TOKEN_ADDRESS is not configured, but this is optional if using native ETH for CCIP fees.

**To configure** (if needed):
```bash
ssh root@192.168.11.10 'pct exec 3501 -- bash -c "echo \"LINK_TOKEN_ADDRESS=<address>\" >> /opt/ccip-monitor/.env"'
```

---

## 🔧 Quick Start Commands

### Start the Service

```bash
# 1. Start the container (if stopped)
ssh root@192.168.11.10 'pct start 3501'

# 2. Start the CCIP Monitor service
ssh root@192.168.11.10 'pct exec 3501 -- systemctl start ccip-monitor'

# 3. Enable service to start on boot
ssh root@192.168.11.10 'pct exec 3501 -- systemctl enable ccip-monitor'

# 4. Check service status
ssh root@192.168.11.10 'pct exec 3501 -- systemctl status ccip-monitor'
```

### View Logs

```bash
# Follow logs in real-time
ssh root@192.168.11.10 'pct exec 3501 -- journalctl -u ccip-monitor -f'

# View last 50 lines
ssh root@192.168.11.10 'pct exec 3501 -- journalctl -u ccip-monitor -n 50'

# View logs since today
ssh root@192.168.11.10 'pct exec 3501 -- journalctl -u ccip-monitor --since today'
```

### Check Metrics

```bash
# Check metrics endpoint (when service is running)
ssh root@192.168.11.10 'pct exec 3501 -- curl -s http://localhost:8000/metrics'

# Check health endpoint (if available)
ssh root@192.168.11.10 'pct exec 3501 -- curl -s http://localhost:8000/health'
```

---

## 📋 Configuration Reference

### Current Configuration

**File**: `/opt/ccip-monitor/.env`

```bash
RPC_URL_138=http://192.168.11.250:8545
CCIP_ROUTER_ADDRESS=0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e
CCIP_SENDER_ADDRESS=0x105F8A15b819948a89153505762444Ee9f324684
METRICS_PORT=8000
CHECK_INTERVAL=60
```

### Contract Addresses

- **CCIP Router**: `0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e`
- **CCIP Sender**: `0x105F8A15b819948a89153505762444Ee9f324684`
- **LINK Token**: Not configured (using native ETH)

---

## 🔍 Verification Steps

### 1. Check Container Status
```bash
ssh root@192.168.11.10 'pct status 3501'
```

Expected: `status: running`

### 2. Check Service Status
```bash
ssh root@192.168.11.10 'pct exec 3501 -- systemctl status ccip-monitor'
```

Expected: `Active: active (running)`

### 3. Verify Configuration
```bash
ssh root@192.168.11.10 'pct exec 3501 -- cat /opt/ccip-monitor/.env'
```

### 4. Test RPC Connectivity
```bash
ssh root@192.168.11.10 'pct exec 3501 -- curl -s -X POST http://192.168.11.250:8545 \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}"'
```

Expected: JSON response with `"result"` field

### 5. Check Service Logs
```bash
ssh root@192.168.11.10 'pct exec 3501 -- journalctl -u ccip-monitor -n 20'
```

Look for:
- ✅ Service started successfully
- ✅ Connected to RPC endpoint
- ✅ Monitoring CCIP Router events
- ❌ Errors or connection failures

---

## 🚀 Next Steps

1. **Start the Container** (if not running):
   ```bash
   ssh root@192.168.11.10 'pct start 3501'
   ```

2. **Start the Service**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- systemctl start ccip-monitor'
   ```

3. **Enable Auto-Start**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- systemctl enable ccip-monitor'
   ```

4. **Verify Service is Running**:
   ```bash
   ./scripts/check-ccip-monitor.sh
   ```

5. **Monitor Logs**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- journalctl -u ccip-monitor -f'
   ```

---

## 📚 Related Documentation

- **Installation Script**: `smom-dbis-138-proxmox/install/ccip-monitor-install.sh`
- **Service Configuration**: `docs/COMPLETE_CONNECTIONS_CONTRACTS_CONTAINERS.md`
- **Contract Addresses**: `docs/CONTRACT_ADDRESSES_REFERENCE.md`
- **Deployment Guide**: `docs/CONTRACT_DEPLOYMENT_GUIDE.md`

---

## 🔧 Troubleshooting

### Service Won't Start

1. **Check logs for errors**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- journalctl -u ccip-monitor -n 50'
   ```

2. **Verify configuration**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- cat /opt/ccip-monitor/.env'
   ```

3. **Check Python environment**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- /opt/ccip-monitor/venv/bin/python --version'
   ```

4. **Test script manually**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- bash -c "cd /opt/ccip-monitor && source venv/bin/activate && python ccip_monitor.py"'
   ```

### RPC Connection Issues

1. **Verify RPC endpoint is accessible**:
   ```bash
   curl -X POST http://192.168.11.250:8545 \
     -H "Content-Type: application/json" \
     -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
   ```

2. **Check network connectivity from container**:
   ```bash
   ssh root@192.168.11.10 'pct exec 3501 -- ping -c 3 192.168.11.250'
   ```

---

**Last Updated**: $(date)  
**Check Script**: `./scripts/check-ccip-monitor.sh`

