- C# 100%
|
All checks were successful
Build and Test / build (push) Successful in 1m7s
Reviewed-on: #1 |
||
|---|---|---|
| .forgejo/workflows | ||
| samples | ||
| src/VigilanceSentinel | ||
| tests/VigilanceSentinel.Tests | ||
| .gitignore | ||
| ARCHITECTURE.md | ||
| CONTRIBUTING.md | ||
| Directory.Build.props | ||
| LICENSE | ||
| README.md | ||
| SECURITY.md | ||
| SETUP-GUIDE.md | ||
| THIRD-PARTY-NOTICES.md | ||
| VigilanceSentinel.sln | ||
Vigilance Sentinel
A cross-platform site monitoring tool for WordPress and other web applications. Runs as a scheduled task (Windows Task Scheduler or Linux cron) and performs health checks, wp-cron triggering, SSL certificate expiry monitoring, and email alerting.
Features
- wp-cron trigger - hits the WordPress cron endpoint on a schedule so scheduled posts publish on time, even with no site traffic
- Internal health check - monitors the origin server (IIS, Apache, nginx) via HTTP with optional Host header for multi-site setups
- External health check - monitors the public-facing URL through reverse proxies and CDNs
- SSL certificate expiry - checks TLS certificate expiry on external endpoints and alerts before renewal is due
- Response time monitoring - alerts when endpoints exceed a configurable response time threshold
- Email alerts - SMTP notifications with per-incident cooldown and automatic recovery messages
- Multi-site - monitors multiple sites from a single installation using per-site JSON config files
- Structured logging - per-site daily log files with automatic retention-based cleanup
- Cross-platform - runs on Windows and Linux with .NET 8+
Quick Start
1. Install
Download the latest release for your platform from the Releases page, or build from source:
dotnet publish src/VigilanceSentinel/VigilanceSentinel.csproj \
--configuration Release \
--runtime linux-x64 \
--self-contained true \
-p:PublishSingleFile=true \
-o publish/
2. Configure
Create a sites/ directory next to the executable and add a JSON config file for each site you want to monitor. See samples/example-site.json for the full config format.
vigilance-sentinel/
VigilanceSentinel.exe (or VigilanceSentinel on Linux)
sites/
my-blog.json
state/ (created automatically)
logs/ (created automatically)
3. Schedule
See SETUP-GUIDE.md for detailed instructions on creating a dedicated service account, setting file system permissions, and configuring a scheduled task (Windows) or cron job (Linux).
Quick start (Windows Task Scheduler):
Program: C:\tools\vigilance-sentinel\VigilanceSentinel.exe
Start in: C:\tools\vigilance-sentinel
Trigger: Every 5 minutes
Linux cron:
*/5 * * * * /opt/vigilance-sentinel/VigilanceSentinel
4. Secure the config directory
The sites/ directory contains SMTP credentials and should be restricted to the service account running the scheduled task. See SETUP-GUIDE.md for a complete walkthrough including dedicated service account creation and per-directory ACLs.
Quick start (Windows):
icacls "C:\tools\vigilance-sentinel\sites" /inheritance:r /grant:r "SYSTEM:(OI)(CI)F" /grant:r "Administrators:(OI)(CI)F"
Linux:
chmod 700 /opt/vigilance-sentinel/sites
Configuration Reference
Each JSON file in the sites/ directory defines one monitored site. All sections are optional; omit or disable sections you do not need.
| Property | Type | Default | Description |
|---|---|---|---|
siteName |
string | filename | Identifier used in logs and alerts |
wpCron.enabled |
bool | true | Whether to trigger wp-cron |
wpCron.url |
string | Internal URL to wp-cron.php |
|
wpCron.timeoutSeconds |
int | 30 | Request timeout |
healthCheck.internalUrl |
string | Origin server URL (HTTP) | |
healthCheck.internalHostHeader |
string | null | Host header for multi-site IIS |
healthCheck.externalUrl |
string | Public URL (HTTPS) | |
healthCheck.timeoutSeconds |
int | 30 | Request timeout |
healthCheck.responseTimeThresholdMs |
int | 5000 | Alert if response exceeds this |
ssl.enabled |
bool | true | Whether to check SSL expiry |
ssl.url |
string | HTTPS URL to check | |
ssl.expiryWarningDays |
int | 14 | Alert this many days before expiry |
alerts.consecutiveFailuresBeforeAlert |
int | 3 | Failures before first alert |
alerts.cooldownMinutes |
int | 60 | Minimum minutes between repeated alerts |
smtp.host |
string | SMTP server hostname | |
smtp.port |
int | 587 | SMTP port (587 for STARTTLS) |
smtp.useTls |
bool | true | Enable STARTTLS |
smtp.username |
string | SMTP username | |
smtp.password |
string | SMTP password | |
smtp.from |
string | Sender email address | |
smtp.to |
string | Recipient email address | |
logging.retentionDays |
int | 30 | Days to keep log files |
Alerting Behavior
Alerts are tracked per check type (e.g., external_health, ssl_expiry) independently. The alert lifecycle works as follows:
- A check fails. The consecutive failure counter increments.
- When the counter reaches
consecutiveFailuresBeforeAlert(default: 3), the first alert email is sent. Set this to1to alert on the very first failure. - While the incident is active, repeat alerts are suppressed for
cooldownMinutes(default: 60). After the cooldown, if the check is still failing, another alert is sent. - When the check succeeds again, a recovery email is sent automatically and the incident is cleared.
If smtp.host is empty or omitted, alerts are skipped and a warning is written to the log.
Console Output
When run manually, the application prints a banner with the version and timestamp, per-site progress with pass/fail indicators for each check, and a summary with the exit code. This output goes to stdout and does not affect the log files. When run from a scheduler, the console output is typically discarded.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | All checks passed |
| 1 | One or more monitored checks failed (site issue) |
| 2 | Application or configuration error |
SMTP Notes
This application uses System.Net.Mail.SmtpClient with STARTTLS on port 587. Implicit TLS on port 465 is not supported.
For SMTP servers that require authentication, provide username and password in the config. For internal relay servers that accept unauthenticated connections, omit username and password (or leave them as empty strings) and set useTls to false if the relay does not support STARTTLS. See samples/example-site-no-smtp-auth.json for a no-auth example.
Building from Source
dotnet build
dotnet test
Requires .NET 8.0 SDK or later. The application has zero external NuGet dependencies.