nself provides comprehensive monitoring with Prometheus, Grafana, Loki, and more. The nself metrics and nself monitor commands give you full control over your observability stack.
Configure the monitoring stack with nself metrics:
| Command | Description |
|---|---|
nself metrics | Show help |
nself metrics enable [profile] | Enable monitoring |
nself metrics disable | Disable monitoring |
nself metrics status | Show monitoring status |
nself metrics profile [name] | View/change profile |
nself metrics config [key] [value] | Configure settings |
nself metrics dashboard | Open Grafana |
Choose the right monitoring profile for your environment:
| Profile | Services | Memory | Use Case |
|---|---|---|---|
minimal | 3 services | ~1GB | Development, resource-constrained |
standard | 5 services | ~2GB | Staging environments, debugging |
full | 10 services | ~3-4GB | Production, full observability |
auto | Varies | Varies | Auto-detect based on ENV |
| ENV | Profile |
|---|---|
| dev | minimal |
| staging | standard |
| prod | full |
Access dashboards and real-time views with nself monitor:
| Command | Description |
|---|---|
nself monitor | Open Grafana (default) |
nself monitor grafana | Open Grafana dashboard |
nself monitor prometheus | Open Prometheus UI |
nself monitor loki | Open Loki in Grafana Explore |
nself monitor alerts | Open Alertmanager UI |
nself monitor services | CLI service status view |
nself monitor resources | CLI resource usage view |
nself monitor logs [service] | Tail service logs |
# Enable monitoring with standard profile
nself metrics enable standard
# Rebuild to add monitoring containers
nself build && nself start
# Open Grafana dashboard
nself monitor
# View real-time service status in CLI
nself monitor services
# View container resource usage
nself monitor resources
# Tail logs for a specific service
nself monitor logs hasuraEnvironment variables for monitoring:
# Enable monitoring
MONITORING_ENABLED=true
# Monitoring profile (minimal, standard, full, auto)
MONITORING_PROFILE=auto
# Grafana admin credentials
GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=your-secure-password
# Alertmanager configuration
ALERTMANAGER_SLACK_WEBHOOK=https://hooks.slack.com/...
ALERTMANAGER_PAGERDUTY_KEY=your-pagerduty-keyGrafana comes pre-configured with dashboards for:
Alertmanager supports notifications via:
Configure alerts in monitoring/alertmanager/alertmanager.yml:
route:
receiver: 'slack-notifications'
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
receivers:
- name: 'slack-notifications'
slack_configs:
- api_url: '${ALERTMANAGER_SLACK_WEBHOOK}'
channel: '#alerts'
send_resolved: trueEnsure monitoring is enabled with nself metrics status. Check if Grafana container is running with nself status.
Switch to a lower profile: nself metrics enable minimal. The full profile requires ~2GB of RAM.
Wait 1-2 minutes for initial metrics collection. Check Prometheus targets at /targets endpoint.