# SIGINT Maintenance Manual

**Subdomain:** sigint.residentliberal.com  
**Auth:** Basic HTTP (username/password from .htpasswd)  
**Data:** /root/.openclaw/workspace/memory/signal_results/  
**Monitor:** /root/.openclaw/workspace/multi_source_monitor.py  
**Dashboard:** /root/.openclaw/workspace/public/sigint/index.html

---

## Daily Checks

### Monitor Status
```bash
# Is it running?
ps aux | grep multi_source_monitor | grep -v grep

# Recent data?
ls -lh /root/.openclaw/workspace/memory/signal_results/ | tail -5

# Log check
tail -50 /tmp/multi_source_monitor.log
```

### API Health
```bash
# Quick test of all sources
python3 << 'EOF'
import requests

sources = {
    "GDELT": "https://api.gdeltproject.org/api/v2/doc/doc?query=Iran&mode=artlist&format=json&maxrecords=1",
    "NewsData": "https://newsdata.io/api/1/news?q=Iran&apikey=pub_72454af5ac4b48608c3e1ae73123d1a2",
    "NewsAPI": "https://newsapi.org/v2/everything?q=Iran&apiKey=07472f77969b492ea727d2b4e63969e0&pageSize=1",
    "Reddit": "https://www.reddit.com/r/politics/search.json?q=Iran&limit=1"
}

for name, url in sources.items():
    try:
        r = requests.get(url, timeout=5)
        print(f"{name:10} : {r.status_code}")
    except Exception as e:
        print(f"{name:10} : ERROR - {e}")
EOF
```

---

## Restart Monitor

If monitor crashes or needs restart:

```bash
# Stop old instance
pkill -f "python3 multi_source_monitor.py"
sleep 2

# Start new instance (background)
cd /root/.openclaw/workspace && nohup python3 multi_source_monitor.py > /tmp/multi_source_monitor.log 2>&1 &

# Verify
ps aux | grep multi_source | grep -v grep
```

---

## Update Dashboard

To update the live dashboard:

```bash
# Edit HTML
nano /root/.openclaw/workspace/public/sigint/index.html

# Or use write tool
# Changes apply immediately (nginx serves static files)
```

---

## Prune Old Data

Signal results accumulate. Prune periodically:

```bash
# Archive results older than 30 days
find /root/.openclaw/workspace/memory/signal_results/ -name "*.json" -mtime +30 -exec tar -czf /root/.openclaw/workspace/memory/signal_results/archive_$(date +%Y%m%d).tar.gz {} \; -delete

# Or just delete
find /root/.openclaw/workspace/memory/signal_results/ -name "*.json" -mtime +30 -delete
```

---

## Update API Keys

If credentials expire/change:

**NewsData:**
```python
# In multi_source_monitor.py, line ~20:
NEWSDATA_KEY = "pub_NEW_KEY_HERE"
```

**NewsAPI:**
```python
# In multi_source_monitor.py, line ~21:
NEWSAPI_KEY = "NEW_KEY_HERE"
```

Then restart monitor.

---

## Add New Signal Query

To monitor additional signals:

```python
# In multi_source_monitor.py, line ~23-35:
QUERIES = [
    "existing query",
    "NEW_QUERY_HERE",  # Add new line
]
```

Restart monitor.

---

## Add New Subreddit

To monitor additional subreddits:

```python
# In reddit_query() method (~line 108):
subreddits = ["politics", "news", "intelnews", "MiddleEast", "new_subreddit_here"]
```

Restart monitor.

---

## Monitor Logs

Real-time tail:
```bash
tail -f /tmp/multi_source_monitor.log
```

Search for errors:
```bash
grep -i error /tmp/multi_source_monitor.log | tail -20
```

Rate limit issues:
```bash
grep -i "429\|rate" /tmp/multi_source_monitor.log
```

---

## Authentication

Current auth: `/etc/nginx/.htpasswd`

To change password or add user:

```bash
# Change user password
sudo htpasswd /etc/nginx/.htpasswd username

# Add new user
sudo htpasswd -c /etc/nginx/.htpasswd newuser
```

No nginx reload needed (htpasswd is checked on each request).

---

## SSL Certificate

Certificate auto-renews via Let's Encrypt. Monitor renewal:

```bash
# Check expiry
sudo certbot certificates | grep sigint

# Manual renewal if needed
sudo certbot renew --force-renewal
```

---

## Backup

Backup critical files:

```bash
# Dashboard + monitor script
tar -czf sigint_backup_$(date +%Y%m%d).tar.gz \
    /root/.openclaw/workspace/public/sigint/ \
    /root/.openclaw/workspace/multi_source_monitor.py

# Move to secure location
mv sigint_backup_*.tar.gz /root/.openclaw/workspace/backups/
```

---

## Troubleshooting

| Issue | Fix |
|-------|-----|
| Monitor not running | `pkill -f multi_source; restart` |
| 429 errors (rate limit) | Wait 5 min, check API quotas |
| Dashboard 404 | Check `/root/.openclaw/workspace/public/sigint/index.html` exists |
| Auth failing | Verify `/etc/nginx/.htpasswd` exists |
| No new data | Check `tail -f /tmp/multi_source_monitor.log` |
| GDELT 429 | GDELT rate-limited, wait ~30 min |
| NewsData 422 | API parameter changed, check query syntax |

---

## Access URLs

- **Dashboard:** https://sigint.residentliberal.com/
- **Raw data:** /root/.openclaw/workspace/memory/signal_results/
- **Config:** /root/.openclaw/workspace/multi_source_monitor.py
- **Logs:** /tmp/multi_source_monitor.log

---

**Last updated:** Mar 14, 2026  
**Monitor started:** Mar 14, 2026 20:12 UTC  
**Status:** Live, 69+ result files accumulated
