Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Monitoring Scripts

Prometheus metrics exporters and scheduled task helpers for observability of file-based automation pipelines.

Export-QueueMetrics.ps1

Exports five Prometheus-compatible metrics about a file processing queue:

Metric Description
{prefix}_incoming_file_count Files waiting to be processed
{prefix}_oldest_file_age_seconds Age of the oldest queued file
{prefix}_error_file_count Files in the error directory
{prefix}_files_processed_today Successfully processed today
{prefix}_script_running Whether the processing script is alive (1/0)

The metric prefix is configurable (default: queue). Output is written atomically (temp file + Move-Item) to prevent Prometheus from reading partial data.

Optionally sends a push heartbeat to Uptime Kuma with queue stats embedded in the message.

Grafana Dashboard

Example alert: fire when {prefix}_oldest_file_age_seconds > 300 (files stuck for 5+ minutes).

Register-MetricsTask.ps1

Registers a Windows scheduled task to run the metrics exporter every N minutes under the SYSTEM account. Handles the TimeSpan.MaxValue overflow workaround (uses 3650 days instead).

Setup

  1. Install Windows Exporter with the textfile collector
  2. Point the textfile collector at your metrics output directory
  3. Run Register-MetricsTask.ps1 to create the scheduled task
  4. Configure Prometheus to scrape the Windows Exporter endpoint