This project is part of a series of example applications written in Rust to showcase practical patterns in building async, concurrent systems with structured state management and a REST API.
The Ping Monitor demonstrates how to:
- Spawn and manage background tasks (e.g., ICMP ping probes)
- Aggregate results in a global application state
- Expose control and monitoring interfaces via a RESTful API
This repository serves as a hands-on example for learning:
- Asynchronous task orchestration in Rust using
tokio - Shared state management using
ArcandMutex/RwLock - Inter-thread communication using
mpscandbroadcastchannels. - REST API implementation using
axum - Handling and reporting real-time data (e.g., latency, timeouts)
It is not a production-grade tool but rather an educational resource for developers interested in idiomatic async Rust.
- Create and manage ICMP ping targets dynamically
- Background probes run with configurable intervals
- Store and retrieve ping results per target
- REST API to manage and inspect probe states
- Rust (latest stable recommended)
cargopackage managercurl(for testing endpoints)
cargo runThe server will start on http://localhost:3000.
curl -v http://localhost:3000/targetscurl -H 'content-type: application/json' \
-d '{"addr":"8.8.8.8"}' \
http://localhost:3000/targetscurl -v http://localhost:3000/targets/<uuid>/resultsReplace <uuid> with the actual ID returned from the create call.
Contributions are very welcome! Here's how to get started:
- Fork this repository
- Create a feature branch:
git checkout -b my-feature - Commit your changes:
git commit -am 'Add new feature' - Push to your branch:
git push origin my-feature - Open a Pull Request
Please follow idiomatic Rust style (rustfmt, Clippy) and try to keep PRs focused.
This project is open source and available under the MIT License.
Inspired by real-world monitoring systems and written to demonstrate clean Rust code structure and async patterns.