Skip to content

Monitoring Setup

ɳSelf’s monitoring stack provides metrics, logs, and alerting for your entire backend.

Terminal window
nself plugin install monitoring
nself build && nself restart

This adds 10 services to your stack:

ServicePurpose
PrometheusMetrics collection and storage
GrafanaMetrics dashboards
LokiLog aggregation
PromtailLog shipping agent
TempoDistributed tracing
AlertmanagerAlert routing and notifications
cAdvisorContainer resource metrics
Node ExporterHost OS metrics
Postgres ExporterDatabase metrics
Redis ExporterRedis metrics (if Redis enabled)
Terminal window
nself urls # shows Grafana URL and default credentials

Default credentials are in .env as GRAFANA_USER / GRAFANA_PASSWORD. Change them immediately.

Grafana comes pre-loaded with dashboards for:

  • Container metrics: CPU, memory, network per container (cAdvisor)
  • Host metrics: disk, CPU, memory, load (Node Exporter)
  • PostgreSQL: connections, query rates, cache hit ratio (Postgres Exporter)
  • Nginx: request rates, error rates, response times

All container logs are shipped to Loki via Promtail. Query logs in Grafana using LogQL:

{container="myproject_hasura_1"} |= "error"

Edit monitoring/alertmanager/config.yml to configure notification channels:

receivers:
- name: 'slack'
slack_configs:
- api_url: 'https://hooks.slack.com/services/...'
channel: '#alerts'

Pre-built alert rules cover:

  • Container down
  • High CPU / memory usage
  • Postgres connection exhaustion
  • Disk space low

Home | _Sidebar