Learn how to set up alerts and monitoring for your Piglet Run instance.
Overview
Piglet Run includes comprehensive monitoring:
- Grafana Dashboards: Visual monitoring
- Alerting: Configurable alerts
- Metrics: Prometheus-based metrics
- Logs: Centralized logging
Quick Setup
Access monitoring dashboard:
pig monitor open
# Opens Grafana at http://<ip>/ui
Grafana Dashboards
Available Dashboards
| Dashboard | Description |
|---|---|
| Overview | System overview and health |
| PostgreSQL | Database performance metrics |
| Node | Server resource usage |
| Nginx | Web server statistics |
Access Dashboards
# Default credentials
URL: http://<ip>/ui
User: admin
Password: (shown during install)
Set Up Alerts
Enable Email Alerts
pig alert email --to admin@example.com --smtp smtp.example.com
Enable Slack Alerts
pig alert slack --webhook https://hooks.slack.com/services/...
Enable Webhook Alerts
pig alert webhook --url https://api.example.com/alerts
Alert Rules
View Alert Rules
pig alert list
Add Custom Alert
pig alert add \
--name "High CPU" \
--condition "cpu_usage > 80" \
--duration 5m \
--severity warning
Default Alerts
| Alert | Condition | Severity |
|---|---|---|
| High CPU | > 80% for 5m | Warning |
| High Memory | > 90% for 5m | Warning |
| Disk Full | > 85% | Critical |
| DB Down | Connection failed | Critical |
| Replication Lag | > 1s | Warning |
Configuration
Alert configuration in /etc/piglet/alerts.yml:
alerts:
email:
enabled: true
to: admin@example.com
smtp:
host: smtp.example.com
port: 587
slack:
enabled: false
webhook: ""
rules:
- name: high_cpu
expr: cpu_usage > 80
for: 5m
severity: warning
View Logs
# All service logs
pig logs
# Specific service
pig logs postgres
pig logs nginx
Next Steps
- Learn about Grafana
- Understand Architecture