- Retrieves a list of device addresses from the
devices_list.jsonfile. - Watches for changes in the
devices_list.jsonfile in real-time. - Allows managing the device list through the REST API.
- Periodically pings devices via REST and gRPC APIs to update their statuses:
- Marks a device as
StatusUnavailableafter one minute of inactivity. - Marks a device as
StatusUnknownif no data has ever been received from it.
- Marks a device as
- Saves monitoring state to a file. Not a database, ensuring lightweight deployment without external dependencies.
- Can emulate and act as a monitored device itself.
- Allows enabling monitoring, REST API, and gRPC API, as well as configuring their ports via
config.json. - Supports enabling debug mode through
config.jsonfor troubleshooting. - Allows specifying a path to a checksum application via
config.jsonand can emulate checksum behavior if the application is unavailable. - Includes a Swagger specification for the REST API (device info and monitoring methods).
- All resources (including Swagger files) are embedded into the compiled binary.
- A
Makefileis provided for building the application on popular systems (make build-all) and for running it via Docker (make docker). - Generated protobuf files and the
vendordirectory are committed to the repository for easier setup and reduced external dependencies. - Example unit tests available at
internal/monitor/monitor_test.go. - Example integration tests available at
scenarios/start_scenarios.sh:
Starts monitoring along with 5 simulated devices in different states.
Some devices are unreachable, one device appears and disappears from the device list, and one device stops responding after 30 seconds.
go run cmd/main.goand use http://localhost:8080/swagger- Download a ready-to-use binary for your platform - https://github.com/chlp/ui/releases/tag/v0.0.1.
- Build the application manually: see the
Makefileor runmake build-all. - Run via Docker: execute
make docker.
Edit the devices_list.json file.
The list is updated automatically without restarting the application.
Example:
[
"127.0.0.1:50052",
"127.0.0.1:8083",
"127.0.0.1:8084",
"127.0.0.1:8085",
"127.0.0.1:8089"
]Edit the config.json file.
Changes are applied after restarting the application.
Example:
{
"log_file": "app.log",
"debug": false,
"devices_list_file": "devices_list.json",
"monitor_file": "monitor.json",
"grpc_port": ":50051",
"rest_port": ":8080",
"device": {
"id": "dev-1743983582705188000",
"hardware_version": "0.0.1",
"software_version": "1.0.0",
"firmware_version": "0.0.5",
"status": "ok",
"checksum": ""
},
"checksum_cmd": "",
"checksum_emulate": true
}Swagger specification file:
internal/api/rest/swagger/swagger.yaml
After starting the application (with rest_port=":8080"), Swagger UI is available at:
http://localhost:8080/swagger