Skip to main content
Version: 2.0

Alerting System

Milvaion includes a powerful multi-channel alerting system that can send notifications through various channels when important events occur in your job scheduling infrastructure.

Overview​

The alerting system provides:

  • Multi-channel delivery: Google Chat, Slack, Email, and Internal Notifications
  • Configurable routing: Route specific alert types to specific channels
  • Fire-and-forget pattern: Non-blocking alert delivery
  • Thread support: Group related alerts in Google Chat threads
  • Production-only mode: Optionally suppress alerts in development

Configuration​

Configure alerting in appsettings.json under MilvaionConfig:Alerting:

{
"MilvaionConfig": {
"Alerting": {
"MilvaionAppUrl": "https://your-milvaion-domain.com",
"DefaultChannel": "InternalNotification",
"SendOnlyInProduction": true,
"Channels": {
"GoogleChat": {
"Enabled": true,
"SendOnlyInProduction": true,
"DefaultSpace": "monitoring-alerts",
"Spaces": [
{
"Space": "monitoring-alerts",
"WebhookUrl": "https://chat.googleapis.com/v1/spaces/..."
}
]
},
"Slack": {
"Enabled": true,
"SendOnlyInProduction": true,
"DefaultChannel": "alerts",
"Channels": [
{
"Channel": "alerts",
"WebhookUrl": "https://hooks.slack.com/services/..."
}
]
},
"Email": {
"Enabled": true,
"SendOnlyInProduction": true,
"DisplayName": "Milvaion Alerts",
"From": "[email protected]",
"SenderEmail": "[email protected]",
"SenderPassword": "your-smtp-password",
"SmtpHost": "smtp.yourdomain.com",
"SmtpPort": 587,
"UseSsl": true,
"DefaultRecipients": ["[email protected]"]
},
"InternalNotification": {
"Enabled": true,
"SendOnlyInProduction": false
}
},
"Alerts": {
"JobAutoDisabled": {
"Enabled": true,
"Routes": ["GoogleChat", "InternalNotification", "Email"]
},
"ZombieOccurrenceDetected": {
"Enabled": true,
"Routes": ["GoogleChat", "InternalNotification"]
}
}
}
}
}

Global Options​

OptionTypeDefaultDescription
MilvaionAppUrlstring-Base URL for action links in alerts
DefaultChannelstringInternalNotificationDefault channel when no routes configured
SendOnlyInProductionbooltrueGlobal production-only setting

Channel Options​

Each channel has common options:

OptionTypeDefaultDescription
EnabledboolfalseEnable/disable the channel
SendOnlyInProductionbooltrueOverride global production setting

Channels in the Panel​

Channels can also be added in the panel, under Settings → Notification channels, without a restart: e-mail (SMTP), Slack, Teams, Telegram, Google Chat, Crewhall, a generic webhook, and e-mail through Notifike. Notifike is never required.

  • The channels in the configuration file keep working as described below. A panel channel cannot use one of their names (Email, Slack, Teams, GoogleChat, Crewhall, InternalNotification).
  • A channel is only a destination. Which alert goes to which channel is set under Settings → Alert rules, where rules pick panel channels by name. A rule that names a deleted or renamed channel skips it.
  • The server needs the encryption key of database secrets. Webhook addresses, passwords, tokens and keys are stored encrypted and never shown again; leave a field empty to keep the stored value. The SMTP password and the Notifike key have to be entered again when their server changes.
  • Send test message sends a fixed text through a saved channel, enabled or not. It needs the update permission, times out after 15 seconds, does not follow redirects and reports only whether it worked.
  • A panel channel sends in every environment while it is enabled; SendOnlyInProduction does not apply to it.
  • A channel can be limited to one project, chosen when it is added and fixed afterwards. It then receives every enabled alert of that project, without a route, and no message of another project. Alert rules cannot pick it, because they apply to the whole installation. Alerts about jobs, workflow steps, failed executions and API keys belong to the project of the job or key; alerts about workers belong to the Default project; alerts about Milvaion itself belong to none.
  • Managing channels needs the NotificationChannelManagement permissions, which apply in the project of the request: their holders see and manage only the channels of that project. Global channels, and channels of other projects, belong to the super admin. While projects are disabled, everything runs in the Default project, so a global channel, the kind alert rules can pick, needs a super admin. Api keys are refused.
  • Names are unique within a project and among the global channels. When both have a channel of the same name, messages go to the global one.

The panel itself is always on. Every enabled alert appears in the dashboard notifications, whatever its routes are and whatever InternalNotification is set to in the configuration. To silence an alert, disable the alert.

Addresses That Are Not Contacted​

No channel contacts link-local addresses, where cloud metadata services live. A channel of a project also does not contact loopback and private addresses, because its managers could otherwise reach services inside the server's network. Set MilvaionConfig__Alerting__AllowPrivateAddressesForProjectChannels to true when your projects send to internal servers. Channels of a project do not use the system proxy while this is off.

Generic Webhook​

Messages are posted as JSON with title, body, severity, category, source, link, actions (text, url), projectId and timestamp. Redirects are not followed, and the answer is ignored except for its status.

With a signing secret, two headers are added: X-Milvaion-Timestamp (Unix seconds) and X-Milvaion-Signature, the hex HMAC-SHA256 of {timestamp}.{body}. Check the signature and refuse old timestamps.

Alert Types​

Milvaion supports the following built-in alert types:

ValueAlert TypeDescriptionSeverity
0AllReceive all alert types-
1JobDispatcherMemoryUsageCriticalDispatcher memory usage highCritical
2DatabaseConnectionFailedDatabase connection lostCritical
3ZombieOccurrenceDetectedJob stuck in running stateWarning
4JobAutoDisabledJob disabled after consecutive failuresWarning
5QueueDepthCriticalMessage queue depth exceeded thresholdCritical
6WorkerDisconnectedWorker unexpectedly disconnectedWarning
7RedisConnectionFailedRedis connection lostCritical
8RabbitMQConnectionFailedRabbitMQ connection lostCritical
9JobExecutionFailedJob execution failedError
10UnknownExceptionUnhandled exception occurredError
11FailedOccurrenceReceivedA failed occurrence came from the dead letter queue (retries exhausted)-
12ServiceDegradedA background service entered degraded mode or stopped after repeated failures-
13MemoryLeakDetectedA possible memory leak in a background service-
14ApiKeyExpiringAn API key is close to its expiry date-
15ApiKeyExpiredAn API key has expired-
16JobMisfiredA job was dispatched later than its misfire grace window allows-
17AiBudgetReachedAn AI budget reached its limit for the period-
18WorkflowDeadlineMissedA workflow run did not finish within its workflow's deadline-

Alert Routing​

Configure which channels receive which alerts:

{
"Alerts": {
"JobAutoDisabled": {
"Enabled": true,
"Routes": ["GoogleChat", "InternalNotification", "Email", "Slack"]
},
"ZombieOccurrenceDetected": {
"Enabled": true,
"Routes": ["GoogleChat", "InternalNotification"]
},
"UnknownException": {
"Enabled": true,
"Routes": ["Email"]
}
}
}

Channel Configuration​

Google Chat​

Google Chat integration uses incoming webhooks with card message support.

{
"GoogleChat": {
"Enabled": true,
"SendOnlyInProduction": true,
"DefaultSpace": "monitoring-alerts",
"Spaces": [
{
"Space": "hub-notifications",
"WebhookUrl": "https://chat.googleapis.com/v1/spaces/AAA/messages?key=..."
},
{
"Space": "monitoring-alerts",
"WebhookUrl": "https://chat.googleapis.com/v1/spaces/BBB/messages?key=..."
}
]
}
}

Features:

  • Card-based messages with headers and sections
  • Thread support for grouping related alerts
  • Severity-based color coding
  • Action buttons with links

Getting a Webhook URL:

  1. Open Google Chat space
  2. Click space name > Manage webhooks
  3. Create webhook and copy URL

Slack​

Slack integration uses incoming webhooks.

{
"Slack": {
"Enabled": true,
"SendOnlyInProduction": true,
"DefaultChannel": "alerts",
"Channels": [
{
"Channel": "alerts",
"WebhookUrl": "https://hooks.slack.com/services/T.../B.../..."
}
]
}
}

Features:

  • Block Kit message formatting
  • Severity-based emoji indicators
  • Action buttons

Getting a Webhook URL:

  1. Go to https://api.slack.com/apps
  2. Create or select an app
  3. Enable Incoming Webhooks
  4. Add to Workspace and copy URL

Crewhall​

Posts alert cards to a Crewhall chat through an incoming webhook. See Crewhall Alert Channel Configuration for the settings.

Email​

SMTP-based email alerts with HTML formatting. They can be delivered through Notifike instead; see Notifike Delivery Configuration.

{
"Email": {
"Enabled": true,
"SendOnlyInProduction": true,
"DisplayName": "Milvaion Alerts",
"From": "[email protected]",
"SenderEmail": "[email protected]",
"SenderPassword": "your-smtp-password",
"SmtpHost": "smtp.yourdomain.com",
"SmtpPort": 587,
"UseSsl": true,
"DefaultRecipients": ["[email protected]", "[email protected]"]
}
}
OptionDescription
DisplayNameSender display name
FromFrom email address
SenderEmailSMTP authentication email
SenderPasswordSMTP authentication password
SmtpHostSMTP server hostname
SmtpPortSMTP server port (typically 587 or 465)
UseSslEnable SSL/TLS
DefaultRecipientsList of recipient email addresses

Internal Notification​

Database-stored notifications visible in the Milvaion dashboard.

{
"InternalNotification": {
"Enabled": true,
"SendOnlyInProduction": false
}
}

Features:

  • Stored in database for persistence
  • Visible in user dashboard
  • User-specific notification preferences
  • Mark as read functionality

Docker Compose Configuration​

Configure alerting using environment variables in your docker-compose.yml:

services:
milvaion-api:
image: milvasoft/milvaion-api:latest
environment:
# Base URL for action links
- MilvaionConfig__Alerting__MilvaionAppUrl=https://milvaion.example.com
- MilvaionConfig__Alerting__SendOnlyInProduction=true

# Google Chat Configuration
- MilvaionConfig__Alerting__Channels__GoogleChat__Enabled=true
- MilvaionConfig__Alerting__Channels__GoogleChat__DefaultSpace=monitoring-alerts
- MilvaionConfig__Alerting__Channels__GoogleChat__Spaces__0__Space=monitoring-alerts
- MilvaionConfig__Alerting__Channels__GoogleChat__Spaces__0__WebhookUrl=${GOOGLE_CHAT_WEBHOOK_URL}

# Slack Configuration
- MilvaionConfig__Alerting__Channels__Slack__Enabled=true
- MilvaionConfig__Alerting__Channels__Slack__DefaultChannel=alerts
- MilvaionConfig__Alerting__Channels__Slack__Channels__0__Channel=alerts
- MilvaionConfig__Alerting__Channels__Slack__Channels__0__WebhookUrl=${SLACK_WEBHOOK_URL}

# Email Configuration
- MilvaionConfig__Alerting__Channels__Email__Enabled=true
- MilvaionConfig__Alerting__Channels__Email__DisplayName=Milvaion Alerts
- MilvaionConfig__Alerting__Channels__Email__From=alerts@example.com
- MilvaionConfig__Alerting__Channels__Email__SenderEmail=${SMTP_USER}
- MilvaionConfig__Alerting__Channels__Email__SenderPassword=${SMTP_PASSWORD}
- MilvaionConfig__Alerting__Channels__Email__SmtpHost=smtp.example.com
- MilvaionConfig__Alerting__Channels__Email__SmtpPort=587
- MilvaionConfig__Alerting__Channels__Email__UseSsl=true
- MilvaionConfig__Alerting__Channels__Email__DefaultRecipients__0=admin@example.com

# Internal Notification (always enabled)
- MilvaionConfig__Alerting__Channels__InternalNotification__Enabled=true
- MilvaionConfig__Alerting__Channels__InternalNotification__SendOnlyInProduction=false

Using .env File​

Create a .env file for sensitive values:

# .env
GOOGLE_CHAT_WEBHOOK_URL=https://chat.googleapis.com/v1/spaces/AAA/messages?key=...
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T.../B.../...
SMTP_USER=[email protected]
SMTP_PASSWORD=your-smtp-password

Then reference in docker-compose:

services:
milvaion-api:
env_file:
- .env

Kubernetes Configuration​

Using ConfigMap for Non-Sensitive Settings​

apiVersion: v1
kind: ConfigMap
metadata:
name: milvaion-alerting-config
data:
MilvaionConfig__Alerting__MilvaionAppUrl: "https://milvaion.example.com"
MilvaionConfig__Alerting__SendOnlyInProduction: "true"
MilvaionConfig__Alerting__DefaultChannel: "InternalNotification"
MilvaionConfig__Alerting__Channels__GoogleChat__Enabled: "true"
MilvaionConfig__Alerting__Channels__GoogleChat__DefaultSpace: "monitoring-alerts"
MilvaionConfig__Alerting__Channels__Slack__Enabled: "true"
MilvaionConfig__Alerting__Channels__Slack__DefaultChannel: "alerts"
MilvaionConfig__Alerting__Channels__Email__Enabled: "true"
MilvaionConfig__Alerting__Channels__Email__DisplayName: "Milvaion Alerts"
MilvaionConfig__Alerting__Channels__Email__SmtpHost: "smtp.example.com"
MilvaionConfig__Alerting__Channels__Email__SmtpPort: "587"
MilvaionConfig__Alerting__Channels__Email__UseSsl: "true"
MilvaionConfig__Alerting__Channels__InternalNotification__Enabled: "true"

Using Secret for Sensitive Settings​

apiVersion: v1
kind: Secret
metadata:
name: milvaion-alerting-secrets
type: Opaque
stringData:
MilvaionConfig__Alerting__Channels__GoogleChat__Spaces__0__WebhookUrl: "https://chat.googleapis.com/v1/spaces/..."
MilvaionConfig__Alerting__Channels__Slack__Channels__0__WebhookUrl: "https://hooks.slack.com/services/..."
MilvaionConfig__Alerting__Channels__Email__SenderEmail: "[email protected]"
MilvaionConfig__Alerting__Channels__Email__SenderPassword: "your-smtp-password"

Deployment Example​

apiVersion: apps/v1
kind: Deployment
metadata:
name: milvaion-api
spec:
template:
spec:
containers:
- name: milvaion-api
image: milvasoft/milvaion-api:latest
envFrom:
- configMapRef:
name: milvaion-alerting-config
- secretRef:
name: milvaion-alerting-secrets

Built-in Alerts​

Milvaion automatically sends alerts for the following events:

EventAlert TypeTrigger
Job Auto-DisabledJobAutoDisabledJob disabled after consecutive failures
Zombie Job DetectedZombieOccurrenceDetectedJob running longer than timeout
Connection FailuresRedis/RabbitMQ/DatabaseConnectionFailedInfrastructure connection lost

Example Alert Messages​

When a job is auto-disabled, you'll receive a card like this:

Google Chat​

Dashboard Overview

Slack​

Dashboard Overview

Email​

Dashboard Overview

Internal​

Shown in the notification panel of the dashboard.

User Notification Preferences​

Users can configure which alert types they receive in the dashboard, in Users (edit a user):

SettingDescription
AllReceive all notification types
Specific TypesSelect individual alert types

Performance Considerations​

  • 10-second timeout: All channel operations timeout after 10 seconds
  • Parallel delivery: Alerts sent to multiple channels simultaneously
  • Error isolation: One channel failure doesn't affect others
  • Fire-and-forget: Built-in alerts don't block main processing

Troubleshooting​

Alerts Not Sending​

  1. Check channel is enabled: "Enabled": true
  2. Check production mode: If SendOnlyInProduction: true, alerts only send when ASPNETCORE_ENVIRONMENT=Production
  3. Check alert routing: Ensure alert type has routes configured
  4. Check logs: Look for AlertNotifier or channel-specific log entries in Seq

Google Chat Webhook Errors​

Webhook error (403): ...
  • Verify webhook URL is correct
  • Check if webhook was deleted/regenerated
  • Ensure space allows incoming webhooks

Email Not Sending​

SMTP authentication failed
  • Verify SenderEmail and SenderPassword
  • For Gmail: Use App Password (not regular password)
  • Verify SMTP host and port

Slack Webhook Errors​

invalid_payload
  • Verify webhook URL format
  • Check if app is still installed in workspace
  • Verify channel exists

Security Best Practices​

  1. Use Kubernetes Secrets: Store webhook URLs and passwords securely
    apiVersion: v1
    kind: Secret
    metadata:
    name: alerting-secrets
    type: Opaque
    stringData:
    SLACK_WEBHOOK: "https://hooks.slack.com/..."
  2. Rotate webhook URLs: Periodically regenerate webhooks
  3. Limit recipients: Only add necessary email recipients
  4. Use production-only mode: Enable SendOnlyInProduction for external channels