Skip to content

Monitoring

The AlertHawk.Monitoring service runs monitors (HTTP/HTTPS, TCP, Kubernetes), manages monitor groups and alerts, stores history, and publishes alert events to the Notification service via a message queue.

All API routes are prefixed with /monitoring (e.g. /monitoring/api/Monitor/monitorList). Most endpoints require JWT Bearer or Azure AD; exceptions are noted below.


Overview

  • Monitor types: HTTP/HTTPS, TCP, Kubernetes (K8s)
  • Monitor groups: Organize monitors and apply shared settings; access is scoped by user token
  • Alerts: Monitor failures and conditions that trigger notifications (sent via queue to Notification service)
  • History: Monitor run history, dashboard data (uptime, response time), retention settings
  • Reports: Uptime, alerts, response time by group (API key auth)

Environment Variables

Configuration can be set in appsettings.json or via environment variables (e.g. Helm chart under monitoring.env). Use __ for nested keys (e.g. ConnectionStrings__SqlConnectionString).

General

VariableDescription
ASPNETCORE_ENVIRONMENTRuntime environment (Development, Production)
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT.NET globalization (false recommended)
basePathBase path for Swagger (dev)

Database

VariableDescription
ConnectionStrings__SqlConnectionStringRequired. SQL Server connection string

Message queue (RabbitMQ or Azure Service Bus)

VariableDescription
RabbitMq__HostRabbitMQ host
RabbitMq__UserRabbitMQ username
RabbitMq__PassRabbitMQ password
QueueTypeRABBITMQ or SERVICEBUS
ServiceBus__ConnectionStringAzure Service Bus connection string
ServiceBus__QueueNameService Bus queue name (e.g. notifications)

Authentication API

VariableDescription
AUTH_API_URLRequired. Base URL of the Authentication API (used to resolve user/group from JWT)

Cache

VariableDescription
CacheSettings__CacheProviderCache provider (e.g. Redis, MemoryCache)
CacheSettings__RedisConnectionStringRedis connection string (when using Redis)
CACHE_PARALLEL_TASKSParallel cache tasks (e.g. 10)

Azure AD / JWT

VariableDescription
AzureAd__ClientId, AzureAd__TenantId, AzureAd__ClientSecret, AzureAd__InstanceAzure AD (for token validation)
Jwt__Key, Jwt__Issuers, Jwt__AudiencesJWT validation

Blob storage (screenshots)

VariableDescription
azure_blob_storage_connection_stringAzure Blob Storage connection string
azure_blob_storage_container_nameBlob container name
enable_screenshot_storage_accountUse storage account for screenshots (true / false)
screenshot_folderLocal screenshot folder (e.g. /screenshots/)

Screenshot and location

VariableDescription
enable_screenshotEnable HTTP screenshot capture (true / false)
screenshot_wait_time_msWait time in ms before screenshot (e.g. 2000)
ipgeo_apikeyIP geolocation API key
enable_location_apiEnable location API (true / false)

Downsampling and behavior

VariableDescription
Downsampling__ActiveEnable downsampling for history (true / false)
Downsampling__IntervalInSecondsDownsampling interval (e.g. 60)
CHECK_MONITOR_AFTER_CREATIONRun check immediately after monitor creation (true / false)
HTTP_RETRY_INTERVAL_MSHTTP retry interval in milliseconds
monitor_regionOptional monitor region label

Sentry and logging

VariableDescription
Sentry__Enabled, Sentry__Dsn, Sentry__EnvironmentSentry error tracking
Logging__LogLevel__DefaultDefault log level
Logging__LogLevel__Microsoft.IdentityModel.LoggingExtensions.IdentityLoggerAdapterIdentity logger level

Swagger (development)

VariableDescription
SwaggerUICredentials__username, SwaggerUICredentials__passwordBasic auth for Swagger UI

API Controllers

Base path: /monitoring/api. Auth: JWT Bearer or Azure AD unless noted.

Monitor — /monitoring/api/Monitor/*

MethodRouteAuthDescription
GET/monitor/{id}BearerGet monitor by ID
GET/monitorStatusDashboard/{environment}BearerStatus dashboard for current agent
GET/monitorAgentStatusBearerAgent status (master node, task counts)
GET/monitorListBearerList all monitors
GET/monitorListByTag/{tag}BearerMonitors by tag
GET/monitorTagListBearerList of monitor tags
GET/monitorListByMonitorGroupIds/{environment}BearerMonitors by user's group IDs
GET/allMonitorAgentsBearerList all monitor agents
POST/createMonitorHttpBearerCreate HTTP monitor
POST/updateMonitorHttpBearerUpdate HTTP monitor
POST/createMonitorTcpBearerCreate TCP monitor
POST/updateMonitorTcpBearerUpdate TCP monitor
POST/createMonitorK8sBearerCreate K8s monitor
POST/UpdateMonitorK8sBearerUpdate K8s monitor
POST/clone/{id}BearerClone monitor
DELETE/deleteMonitor/{id}BearerDelete monitor
PUT/pauseMonitor/{id}/{paused}BearerPause/resume monitor
PUT/pauseMonitorByGroupId/{groupId}/{paused}BearerPause/resume by group
GET/getMonitorFailureCount/{days}BearerFailure count
GET/getMonitorHttpByMonitorId/{monitorId}BearerHTTP monitor by ID
GET/getMonitorTcpByMonitorId/{monitorId}BearerTCP monitor by ID
GET/getMonitorK8sByMonitorId/{monitorId}BearerK8s monitor by ID
GET/GetMonitorCountBearerMonitor count
GET/GetMonitorJsonBackupAdminBackup monitors as JSON
POST/UploadMonitorJsonBackupAdminRestore from JSON backup
PUT/setMonitorExecutionDisabled/{disabled}AdminDisable/enable all monitor execution
GET/getMonitorExecutionStatusBearerExecution and maintenance status
PUT/setMaintenanceWindowAdminSet maintenance window (body: StartUtc, EndUtc)
GET/getMaintenanceWindowAdminGet maintenance window

MonitorGroup — /monitoring/api/MonitorGroup/*

MethodRouteAuthDescription
GET/monitorGroupListBearerList all groups
GET/monitorGroupListByUserBearerGroups by user token
GET/monitorDashboardGroupListByUserBearerGroups with dashboard data by user
GET/monitorDashboardGroupListByUser/{environment}BearerSame by environment
GET/monitorGroup/{id}BearerGroup by ID
POST/addMonitorToGroupBearerAdd monitors to group
POST/addMonitorGroupBearerCreate group
POST/updateMonitorGroupBearerUpdate group
DELETE/deleteMonitorGroup/{id}BearerDelete group
DELETE/removeMonitorFromGroupBearerRemove monitors from group

MonitorAlert — /monitoring/api/MonitorAlert/*

MethodRouteAuthDescription
GET/monitorAlerts/{monitorId}/{days}BearerAlerts for monitor (optional environment)
GET/monitorAlerts/{monitorId}/{days}/{environment}BearerAlerts by environment
GET/monitorAlertsReport/{monitorId}/{days}/{environment}/{reportType}BearerAlerts report (e.g. Excel)
GET/monitorAlertsByMonitorGroup/{monitorGroupId}/{days}BearerAlerts by group

MonitorHistory — /monitoring/api/MonitorHistory/*

MethodRouteAuthDescription
GET/MonitorHistory/{id}BearerHistory for monitor (limited rows)
GET/MonitorHistoryByIdDays/{id}/{days}BearerHistory by ID and days
GET/MonitorHistoryByIdDays/{id}/{days}/{downSampling}/{downSamplingFactor}BearerWith downsampling
GET/MonitorDashboardData/{id}BearerDashboard data (uptime, cert, etc.)
POST/MonitorDashboardDataListBearerDashboard data for list of IDs
DELETE(query: days)AdminDelete history older than days
GET/GetMonitorHistoryCountBearerHistory row count
GET/GetMonitorHistoryRetentionBearerRetention settings
POST/SetMonitorHistoryRetentionAdminSet retention (body: HistoryDaysRetention)
GET/GetMonitorSecurityHeaders/{id}BearerLatest security headers for HTTP monitor

MonitorNotification — /monitoring/api/MonitorNotification/*

MethodRouteAuthDescription
GET/monitorNotifications/{id}BearerNotifications by monitor ID
POST/addMonitorNotificationBearerAdd notification to monitor
POST/removeMonitorNotificationBearerRemove notification from monitor
POST/addMonitorGroupNotificationBearerAdd notification to group
POST/removeMonitorGroupNotificationBearerRemove notification from group

MonitorType — /monitoring/api/MonitorType/*

MethodRouteAuthDescription
GET/BearerList monitor types (cached)

MonitorReport — /monitoring/api/MonitorReport/* (API key auth)

MethodRouteAuthDescription
GET/Uptime/{groupId}/{hours}API KeyUptime report by group
GET/Uptime/{groupId}/{hours}/{filter}API KeyUptime with filter
GET/UptimeByStartAndEndDate/{groupId}/{startDate}/{endDate}API KeyUptime by date range
GET/Alert/{groupId}/{hours}API KeyAlerts by group
GET/ResponseTime/{groupId}/{hours}API KeyResponse time by group
GET/ResponseTime/{groupId}/{hours}/{filter}API KeyResponse time with filter

HealthCheck — /monitoring/api/HealthCheck

MethodRouteAuthDescription
GET/NoneHealth/version string

Version — /monitoring/api/Version

MethodRouteAuthDescription
GET/NoneAPI version

Helm Chart Reference

In the Helm chart, Monitoring is configured under the monitoring section. Set monitoring.env with the variables above (e.g. ConnectionStrings__SqlConnectionString, AUTH_API_URL, RabbitMq__Host, cache, Azure AD, JWT, blob/screenshot, downsampling, etc.). See Environment variables in the Helm docs.

AlertHawk - Self-hosted monitoring solution.