Cron Monitor
Cron MonitorDEV_TOOL
Explorer
<>Home
TSFeatures
Pricing
TSBlog
Privacy
Terms
Refund
{}About
#Contacts
Timeline+
NPM Scripts+
src/pages/features.component.ts

How to use DIWOS.CronMonitor

// Install → Configure → Register → Ping

01. Install

NUGET

Reference the package in your .NET project.

Command
$ dotnet add package DIWOS.CronMonitor
Project file
<ItemGroup>
  <PackageReference Include="DIWOS.CronMonitor" Version="1.0.0" />
</ItemGroup>

02. Configure

appsettings.json

Add a CronMonitor section to appsettings.json. For one worker use PingWorker; for multiple background services use PingWorkers.

Single worker (PingWorker)
{
  "CronMonitor": {
    "BaseUrl": "https://cron-monitor.com",
    "PingPath": "/api/monitor/ping",
    "PingWorker": {
      "Token": "MonitorTokenForThisWorker",
      "Interval": "00:01:00"
    }
  }
}
Multiple workers (PingWorkers)
{
  "CronMonitor": {
    "BaseUrl": "https://cron-monitor.com",
    "PingPath": "/api/monitor/ping",
    "PingWorkers": [
      { "Token": "MonitorTokenForThisWorker", "Interval": "00:01:00" },
      { "Token": "MonitorTokenForAnotherWorker", "Interval": "00:05:00" }
    ]
  }
}

03. Register with DI

Program.cs

Register the client and options using dependency injection.

using DIWOS.CronMonitor;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddCronMonitorClient(builder.Configuration);
Or configure options in code:
builder.Services.AddCronMonitorClient(options =>
{
    options.BaseUrl = "https://cron-monitor.com";
    options.PingPath = "/api/monitor/ping";
});

04. Send a ping

BackgroundService

Inject ICronMonitorClient and call PingAsync(token) on your schedule.

using DIWOS.CronMonitor;

public sealed class PingWorker(ICronMonitorClient client) : BackgroundService
{
    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        while (!stoppingToken.IsCancellationRequested)
        {
            await client.PingAsync("MonitorTokenForThisWorker", stoppingToken);
            await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken);
        }
    }
}

05. Optional ping background service

Hosted

If you prefer, register the hosted service that pings on the configured interval.

using DIWOS.CronMonitor;
using DIWOS.CronMonitor.BgServices;

builder.Services.AddCronMonitorClient(builder.Configuration);
builder.Services.AddCronMonitorPingBackgroundService(builder.Configuration);

06. Notes

README
  • The token is sent as text/plain in the POST body.
  • BaseUrl and PingPath are validated during startup.
  • The client uses HttpClientFactory under the hood.
  • It’s safe to use because request URLs are controlled by your configuration.
master*
0
0
© 2026 Cron Monitor