Pangolin Monitoring Setup Guide
This guide explains how to set up comprehensive monitoring for your Pangolin server using a combination of systemd services, Discord alerts, and optional Falco security monitoring.
Basic Monitoring Setup
1. Install and Configure the Monitor Script
First, create the monitoring directory and download the script:
sudo mkdir -p /opt/pangolin-monitor
curl -o /opt/pangolin-monitor/pangolin-monitor.sh https://gist.githubusercontent.com/hhftechnology/b2109fa3f2bf05ebb8945f0423d9e6b9/raw/58514da761cdb53bbd8144c71999347cd2a8f1ea/pangolin-monitor.sh
Before making the script executable, you need to edit it to configure your specific settings:
sudo nano /opt/pangolin-monitor/pangolin-monitor.sh
Update the following configuration variables at the top of the script:
# Configuration Section
PANGOLIN_URL="https://pangolin.testing.your.domain" # Your Pangolin instance URL
PANGOLIN_EMAIL="your_email@hhf.technology" # Your admin email
PANGOLIN_PASSWORD="your_admin_password" # Your admin password
PANGOLIN_ORG="your_org" # Your organization name
DISCORD_WEBHOOK="https://discord.com/api/webhooks/your-hook" # Your Discord webhook URL
# Optional: Adjust monitoring thresholds if needed
CHECK_INTERVAL=60 # How often to check (in seconds)
BANDWIDTH_WARNING_THRESHOLD=1000 # MB
BANDWIDTH_CRITICAL_THRESHOLD=2000 # MB
After configuring the script, make it executable:
sudo chmod +x /opt/pangolin-monitor/pangolin-monitor.sh
Important Configuration Notes:
- PANGOLIN_URL: Must be the full URL to your Pangolin instance
- PANGOLIN_EMAIL and PANGOLIN_PASSWORD: Must match your admin credentials
- PANGOLIN_ORG: The organization name in Pangolin you want to monitor
- DISCORD_WEBHOOK: Create this in your Discord server:
- Open Discord Server Settings
- Go to Integrations
- Create a Webhook
- Copy the Webhook URL
Adjusting Thresholds:
CHECK_INTERVAL
: Default 60 seconds, increase for less frequent checksBANDWIDTH_WARNING_THRESHOLD
: Default 1000 MBBANDWIDTH_CRITICAL_THRESHOLD
: Default 2000 MB- Adjust these based on your typical usage patterns
2. Create Systemd Service
Create the service file at /etc/systemd/system/pangolin-monitor.service
:
sudo nano /etc/systemd/system/pangolin-monitor.service
Add the following content:
[Unit]
Description=Pangolin Monitoring Service
After=network.target
[Service]
Type=simple
ExecStart=/opt/pangolin-monitor/pangolin-monitor.sh
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target
3. Enable and Start the Service
sudo systemctl enable pangolin-monitor.service
sudo systemctl start pangolin-monitor.service
Monitoring Features
The monitoring script provides comprehensive checks including:
Container Health Monitoring
- Checks status of all critical containers:
- Pangolin
- Gerbil
- Traefik
- Verifies both running state and health check status
- Sends alerts for any container issues
Bandwidth Monitoring
- Tracks total bytes in/out
- Configurable warning and critical thresholds
- Bandwidth metrics in logs and alerts
- Uses Pangolin API for metrics collection
Enhanced Security with Falco
For additional security monitoring, you can deploy Falco:
sudo docker run --rm -i -t --name falco --privileged \
-v /var/run/docker.sock:/host/var/run/docker.sock \
-v /dev:/host/dev \
-v /proc:/host/proc:ro \
-v /boot:/host/boot:ro \
-v /lib/modules:/host/lib/modules:ro \
-v /usr:/host/usr:ro \
-v /etc:/host/etc:ro \
falcosecurity/falco:0.39.2
Falco provides:
- Real-time threat detection
- Container runtime monitoring
- Kubernetes workload security
- Behavioral monitoring
Security Recommendations
-
SSH Security:
- Avoid exposing port 22 to the public internet
- Use key-based authentication only
- Consider using a jump host or VPN for SSH access
-
Container Security:
- Keep containers updated
- Use minimal base images
- Implement resource limits
- Regular security scanning
-
Network Security:
- Implement proper firewall rules
- Use reverse proxy with SSL
- Regular security audits
- Monitor unusual traffic patterns
Monitoring Verification
Check Service Status
sudo systemctl status pangolin-monitor.service
View Monitoring Logs
journalctl -u pangolin-monitor.service
Troubleshooting
Common Issues
-
Discord Alerts Not Working
- Verify webhook URL in script
- Check network connectivity
- Verify Discord channel permissions
-
Container Status Errors
- Check Docker logs
- Verify container health checks
- Check resource utilization
-
Bandwidth Monitoring Issues
- Verify API access
- Check threshold configurations
- Verify metrics collection
Additional Resources
- Full discussion and updates: HHF Technology Forum
- Detailed blog post: Pangolin Monitor Blog
- Falco Documentation
Customization
The monitoring script can be customized by editing thresholds and alert conditions in /opt/pangolin-monitor/pangolin-monitor.sh
. Common customizations include:
- Adjusting bandwidth thresholds
- Modifying check intervals
- Adding custom metrics
- Configuring additional alert destinations
Remember to restart the service after making changes:
sudo systemctl restart pangolin-monitor.service