This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Monitor

    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

    DashboardDescription
    OverviewSystem overview and health
    PostgreSQLDatabase performance metrics
    NodeServer resource usage
    NginxWeb 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 [email protected] --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

    AlertConditionSeverity
    High CPU> 80% for 5mWarning
    High Memory> 90% for 5mWarning
    Disk Full> 85%Critical
    DB DownConnection failedCritical
    Replication Lag> 1sWarning

    Configuration

    Alert configuration in /etc/piglet/alerts.yml:

    alerts:
      email:
        enabled: true
        to: [email protected]
        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