-
Notifications
You must be signed in to change notification settings - Fork 2
4. Alerts
Vincenzo Reina edited this page Apr 21, 2025
·
9 revisions
ServerPulse includes a robust alert system that can notify you about important server events through Discord. This guide covers setting up and customizing alerts.
- Open your Discord server settings
- Navigate to "Integrations" → "Webhooks"
- Click "Create Webhook"
- Choose a name and channel for alerts
- Copy the webhook URL
- Open
infra/grafana/provisioning/alerting/discord_contact.yml
- Replace the example webhook URL with yours:
apiVersion: 1
contactPoints:
- orgId: 1
name: Discord contact point
receivers:
- uid: deiz0m4w2afpcb
type: discord
settings:
url: https://discord.com/api/webhooks/your-webhook # Replace this
message: '{{ template "discord.default.message" . }}'
title: '{{ template "default.title" . }}'
- Restart Docker containers to apply changes:
docker compose down
docker compose up -d
ServerPulse comes with pre-configured alerts:
# From metrics.yml
condition: C
data:
- refId: A
datasourceUid: P5697886F9CA74929
model:
query: "from(bucket: \"metrics_db\")
|> range(start: v.timeRangeStart)
|> filter(fn: (r) => r._measurement == \"minecraft_stats\")
|> filter(fn: (r) => r._field == \"tps_1m\")
|> filter(fn: (r) => r.server == \"bed1\")"
- Triggers when TPS drops below 18
- Evaluates every 10 seconds
- Includes 5-minute historical context
Edit infra/grafana/provisioning/alerting/contact_policy.yml
:
apiVersion: 1
policies:
- orgId: 1
receiver: Discord contact point
group_wait: 0s # Initial wait before first alert
group_interval: 30s # Wait between alert groups
repeat_interval: 3m # Time before resending same alert
- Memory Usage Alert Example:
groups:
- name: Memory Alerts
rules:
- title: High Memory Usage
condition: when used_memory > 80% of committed_memory
data:
# InfluxDB query for memory metrics
query: from(bucket: "metrics_db")
|> filter(fn: (r) => r._field == "used_memory")
- Player Count Alert Example:
groups:
- name: Player Alerts
rules:
- title: High Player Count
condition: when players_online > 50
data:
# InfluxDB query for player count
query: from(bucket: "metrics_db")
|> filter(fn: (r) => r._field == "players_online")
-
Simulate low TPS:
- Use a plugin or command to stress test the server
- Wait for alert notification (should arrive within 30s)
-
Verify Discord Integration:
- Check Discord channel for alert messages
- Confirm formatting and content
- Installation(https://github.com/renvins/serverpulse/wiki/installation)
- Configuration(https://github.com/renvins/serverpulse/wiki/configuration)
- Custom Dashboards(https://github.com/renvins/serverpulse/wiki/dashboards)
- [Docker Infrastructure](https://github.com/renvins/serverpulse/wiki/docker)
- Metrics Reference(https://github.com/renvins/serverpulse/wiki/metrics)
- Troubleshooting(https://github.com/renvins/serverpulse/wiki/troubleshooting)