ServMon is a configurable service and endpoint monitor with a background agent and web dashboard for status and alerting.
| Path | Purpose | Runtime/Notes |
|---|---|---|
ServMon.sln |
Default modern solution | Includes Console/ServMon, WebApp, Shared/WCMS.Common, Shared/WCMS.Common.Tests |
Console/ServMon |
Monitoring agent | net10.0, cross-platform |
WebApp |
ASP.NET Core MVC UI (ServMonWeb.csproj) |
net10.0, branded ServMon |
Shared/WCMS.Common |
Shared utilities | net10.0 |
Shared/WCMS.Common.Tests |
Unit tests for shared utilities | net10.0 |
| Path | Purpose | Runtime/Notes |
|---|---|---|
legacy/ServMon.Legacy.sln |
Legacy-only solution | For legacy maintenance only |
legacy/ServMonWebCore |
Older ASP.NET Core MVC UI | net8.0, legacy, Windows-only support path |
legacy/ServMonWeb |
Legacy ASP.NET MVC 5 app | .NET Framework 4.8.1, Windows-only |
legacy/ServMonWeb/ServMonWeb.Tests |
Legacy MVC test project | .NET Framework 4.8.1, Windows-only |
Legacy projects under
legacy/are not part of the defaultServMon.slnand are kept as read-only reference/history.
- .NET 10 SDK (pinned via
global.json) - PostgreSQL (default) or SQL Server for the web app
# Build everything
dotnet build ServMon.sln -c Release
# Run the web app
dotnet run --project WebApp/ServMonWeb.csproj
# Run the console agent
dotnet run --project Console/ServMon/ServMon.csproj
# Run tests
dotnet test ServMon.slnUse this once on a new machine/environment before normal operations.
Console/ServMon/config.xml is intentionally local-only (.gitignore).
If it is missing, ServMon bootstraps it automatically from Console/ServMon/config.sample.xml on first access (console startup or web config/services access).
After bootstrap, review and replace placeholder values in config.xml (SMTP, recipients, endpoints, credentials) before production use.
# 1) Set database provider and connection string
export DatabaseProvider=Postgres
export ConnectionStrings__PostgresConnection="Host=localhost;Port=5432;Database=servmon;Username=postgres;Password=REPLACE_WITH_DB_PASSWORD"
# 2) Apply EF migrations
dotnet ef database update --project WebApp/ServMonWeb.csprojFor process-control/config-edit actions, bootstrap an Admin user once, then disable bootstrap immediately:
# 3) One-time admin bootstrap
export BootstrapAdmin__Enabled=true
export BootstrapAdmin__Email="admin@example.com"
export BootstrapAdmin__Password="REPLACE_WITH_STRONG_PASSWORD"
dotnet run --project WebApp/ServMonWeb.csproj
# 4) Disable bootstrap after first successful run
unset BootstrapAdmin__Enabled
unset BootstrapAdmin__Email
unset BootstrapAdmin__PasswordAll configuration paths use relative paths by default and work cross-platform (Windows, macOS, Linux).
Key settings in WebApp/appsettings.json:
| Key | Description |
|---|---|
ServMon:ServicesJsonPath |
Path to the agent's services.json output |
ServMon:ConfigPath |
Path to the agent's config.xml |
ServMon:ExecutablePath |
Path to the agent executable (no .exe extension) |
ServMon:ProcessName |
Process name for agent lifecycle management |
ServMon:PidFilePath |
PID file used to manage only the web-started agent process |
Override any setting via environment variables:
export appSettings__ServMon__ExecutablePath="/custom/path/to/ServMon"For legacy Windows config examples, see docs/migration/legacy-config-examples.md.
The console agent validates config.xml at startup and fails fast with field-level errors when required values are missing or invalid.
config.xml supports environment variable substitution:
$(env:VARIABLE_NAME)${VARIABLE_NAME}
Examples:
<Password>${SERVMON_SMTP_PASSWORD}</Password><WebhookUrl>$(env:SERVMON_ALERT_WEBHOOK_URL)</WebhookUrl>
If a referenced environment variable is not set, startup validation reports the exact missing variable and config path.
ServMon supports per-service alert thresholds/escalation and optional webhook notifications:
- Global defaults in
/Services/Settings/Alerts:DefaultAlertThresholdFailuresDefaultAlertCooldownSecondsDefaultEscalationThresholdFailuresDefaultEscalationCooldownSecondsWebhookEnabledWebhookUrlQuietHoursStart/QuietHoursEnd(24-hourHH:mm)
- Per-service overrides in
/Services/Service:AlertThresholdFailuresAlertCooldownSecondsEscalationThresholdFailuresEscalationCooldownSeconds
Webhook notifications use JSON payloads compatible with common incoming webhook endpoints (Slack/Teams-style text payload).
WebApp enforces an Admin role for process-control and config-edit endpoints.
- Keep
BootstrapAdmin:Enabledasfalseby default. - For first-time setup only, set:
BootstrapAdmin__Enabled=trueBootstrapAdmin__Email=<admin-email>BootstrapAdmin__Password=<strong-password>
- Start the app once to seed the admin user and role.
- Immediately disable bootstrap again by removing those env vars or setting
BootstrapAdmin__Enabled=false.
WebApp supports two EF Core database providers:
Postgres(default; also acceptsPostgreSql/Npgsql)SqlServer
Configuration keys:
DatabaseProvider:Postgres(default) orSqlServerConnectionStrings:DefaultConnection(SQL Server)ConnectionStrings:PostgresConnection(PostgreSQL)
Example PostgreSQL override (zsh/bash):
DatabaseProvider=Postgres \
ConnectionStrings__PostgresConnection="Host=localhost;Port=5432;Database=servmon;Username=postgres;Password=REPLACE_WITH_DB_PASSWORD" \
dotnet run --project WebApp/ServMonWeb.csprojExisting Identity migrations were originally scaffolded for SQL Server. With PostgreSQL as the default provider, generate/apply provider-specific PostgreSQL migrations before production use.
# Generate provider-specific migrations when schema changes (recommended separate folders)
DatabaseProvider=Postgres dotnet ef migrations add <MigrationName> --project WebApp/ServMonWeb.csproj --output-dir Data/Migrations/Postgres
DatabaseProvider=SqlServer dotnet ef migrations add <MigrationName> --project WebApp/ServMonWeb.csproj --output-dir Data/Migrations/SqlServer
# Apply migrations (default Postgres provider)
dotnet ef database update --project WebApp/ServMonWeb.csproj
# Apply migrations (SQL Server)
DatabaseProvider=SqlServer dotnet ef database update --project WebApp/ServMonWeb.csprojThe project includes a GitHub Actions workflow (.github/workflows/ci.yml) with a matrix build across:
windows-latestubuntu-latestmacos-latest
Current trigger mode:
- Manual only via
workflow_dispatch(autopush/pull_requesttriggers are commented out).
Steps: restore, build, test, publish artifacts.
Manual run options:
- GitHub UI:
Actions->CI->Run workflow - GitHub CLI:
gh workflow run ci.yml --ref masterIn addition to /health, the web app now exposes lightweight JSON monitoring endpoints:
GET /api/monitoring/health- Agent running state + per-service runtime health snapshot
GET /api/monitoring/metrics- Aggregate check/failure counters and per-service latency/failure metrics
Full migration details, gates, and rollback notes: docs/DOTNET10_CROSS_PLATFORM_CHECKLIST.md.