Skip to content

Repository files navigation

Contributors Forks Stargazers Issues Apache License Go


Logo

monitor-go

Production-grade outage schedule monitor with Redis-backed pipeline
Explore the docs »

Report Bug · Request Feature

About The Project

monitor-go scrapes the Красноярск city outage schedule from Gorod.htm, parses the data, detects changes, and publishes new outage records via Redis Pub/Sub. It replaces a legacy Python bot with a modular, testable Go service.

Key features:

  • Scheduler — periodic ticker-based orchestrator that runs the full pipeline on a configurable interval
  • Scraper — HTTP client with ETag-based change detection, charset-aware HTML parsing (Windows-1251 via goquery)
  • Parser — extracts organization info, Russian addresses, outage details, and Russian date strings; includes an embedded SQLite street name database for normalization
  • Storage — Redis-backed diff engine: computes MD5 hashes of parsed records, commits only new/changed entries with TTL
  • Publisher — serializes outages as JSON and publishes to a Redis channel ({prefix}:outages)
  • Metrics — Prometheus counters and histograms for every operation across all modules
  • Docker — multi-stage build with docker-compose (includes Redis)

(back to top)

Built With

  • Go
  • Fiber
  • Fx
  • Redis
  • Prometheus
  • Swagger

(back to top)

Getting Started

Prerequisites

  • Go 1.25+ (for source builds)
    go version
  • Docker & Docker Compose (for the compose workflow)
    docker --version && docker compose version

Quick Start

git clone https://github.com/005-bot/monitor-go.git
cd monitor-go
docker compose up

The service starts on http://localhost:3000. No external Redis needed — the compose file includes one with a health check.

(back to top)

Usage

Environment Variables

Configuration is loaded via environment variables using the __ separator (e.g. REDIS__URL).

Variable Default Description
REDIS__URL redis://localhost:6379 Redis connection URL
SCRAPER__URL http://93.92.65.26/aspx/Gorod.htm HTML table source URL
SCRAPER__INTERVAL 300 Polling interval in seconds
STORAGE__TTL_DAYS 5 Record retention in days
STORAGE__PREFIX bot-005 Redis key prefix
PUBLISHER__PREFIX bot-005 Redis channel prefix
PARSER__ADDRESS_DB_PATH (embedded streets.db) Custom SQLite database path

Build from Source

go run .

Or build and run the binary:

go build -o monitor .
./monitor

Quality checks:

make fmt
make lint
make test

(back to top)

Roadmap

  • Prometheus alerts based on scheduler error metrics
  • Graceful shutdown improvements and circuit breaker on scrape failures
  • Structured logging with request IDs across the pipeline

See the open issues for a full list of proposed features and known issues.

(back to top)

Contributing

Contributions make the open-source community great. If you have a suggestion, please fork the repo and create a pull request. You can also open an issue with the "enhancement" tag.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

(back to top)

Contact

Maintainer: @capcom6

Project Link: https://github.com/005-bot/monitor-go

(back to top)

Acknowledgments

(back to top)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages