Add version badges and docs for peach-monitor

This commit is contained in:
mycognosist 2020-09-17 12:42:15 +01:00
parent bf2241fb72
commit dbe7033349
8 changed files with 96 additions and 15 deletions

View File

@ -13,6 +13,7 @@
- [Microservices](./software/microservices/index.md)
- [peach-buttons](./software/microservices/peach-buttons.md)
- [peach-menu](./software/microservices/peach-menu.md)
- [peach-monitor](./software/microservices/peach-monitor.md)
- [peach-network](./software/microservices/peach-network.md)
- [peach-oled](./software/microservices/peach-oled.md)
- [peach-stats](./software/microservices/peach-stats.md)

View File

@ -8,6 +8,8 @@ The suite of PeachCloud microservices currently includes:
- poll GPIO pins for button presses and emit events via pub-sub
- **peach-menu** [(repo)](https://github.com/peachcloud/peach-menu)
- monitor and interact with the device via the physical interface
- **peach-monitor** [(repo)](https://github.com/peachcloud/peach-monitor)
- monitor network data usage and set alert flags
- **peach-network** [(repo)](https://github.com/peachcloud/peach-network)
- query and configure network interfaces
- **peach-oled** [(repo)](https://github.com/peachcloud/peach-oled)

View File

@ -1,8 +1,6 @@
# peach-buttons
[![Build Status](https://travis-ci.com/peachcloud/peach-buttons.svg?branch=master)](https://travis-ci.com/peachcloud/peach-buttons)
[![GitHub logo](/assets/github_logo.png "peach-buttons GitHub repository")](https://github.com/peachcloud/peach-buttons)
[![GitHub logo](/assets/github_logo.png "peach-buttons GitHub repository")](https://github.com/peachcloud/peach-buttons) [![Build Status](https://travis-ci.com/peachcloud/peach-buttons.svg?branch=master)](https://travis-ci.com/peachcloud/peach-buttons) ![Version badge](https://img.shields.io/badge/version-0.1.0-<COLOR>.svg)
GPIO microservice module for handling button presses. `peach-buttons` implements a JSON-RPC server with [Publish-Subscribe extension](https://docs.rs/jsonrpc-pubsub/11.0.0/jsonrpc_pubsub/). Each button press results in a JSON-RPC request being sent over websockets to any subscribers. A button code for the pressed button is sent with the request to subscribers, allowing state-specific actions to be taken by the subscriber.

View File

@ -1,8 +1,6 @@
# peach-menu
[![Build Status](https://travis-ci.com/peachcloud/peach-menu.svg?branch=master)](https://travis-ci.com/peachcloud/peach-menu)
[![GitHub logo](/assets/github_logo.png "peach-menu GitHub repository")](https://github.com/peachcloud/peach-menu)
[![GitHub logo](/assets/github_logo.png "peach-menu GitHub repository")](https://github.com/peachcloud/peach-menu) [![Build Status](https://travis-ci.com/peachcloud/peach-menu.svg?branch=master)](https://travis-ci.com/peachcloud/peach-menu) ![Version badge](https://img.shields.io/badge/version-0.2.0-<COLOR>.svg)
OLED menu microservice module for PeachCloud. A state machine which listens for GPIO events (button presses) by subscribing to `peach-buttons` over websockets and makes [JSON-RPC](https://www.jsonrpc.org/specification) calls to relevant PeachCloud microservices (`peach-network`, `peach-oled`, `peach-stats`).

View File

@ -0,0 +1,88 @@
# peach-monitor
[![GitHub logo](/assets/github_logo.png "peach-monitor GitHub repository")](https://github.com/peachcloud/peach-monitor) [![Build Status](https://travis-ci.com/peachcloud/peach-web.svg?branch=master)](https://travis-ci.com/peachcloud/peach-web) ![Version badge](https://img.shields.io/badge/version-0.1.0-<COLOR>.svg)
Monitor network data usage and set alert flags based on user-defined thresholds.
`peach-monitor` is a CLI tool capable of running as a one-shot data store updater or as a daemon for continually updating data usage alert flags.
The utility is intended to be run with the `--save` flag prior to each system reboot or shutdown. This allows network transmission totals (upload and download) to be persisted to the filesystem in the form of a JSON data store.
When the `--update` flag is set, `peach-monitor` retrieves user-defined alert thresholds from the data store, calculates the latest data usage statistics and sets alert flags accordingly. These flag values can be accessed from other parts of the PeachCloud system to alert the user (for example, by `peach-web` for web application display).
The `--daemon` flag executes the `--update` functionality in a loop and is intended to be run as a background process for convenient alert flag updates. The optional `--interval` argument defines the frequency with which the alert flags are updated. The default update frequency is once every 60 seconds.
The `--iface` argument is used to define the network interface from which to retrieve network traffic data. This defaults to `wlan0` if not defined.
### Usage
`peach-monitor [FLAGS] [OPTIONS]`
```
FLAGS:
-d, --daemon Run daemon
-h, --help Prints help information
-s, --save Save latest usage totals to file
-u, --update Update alert flags
-V, --version Prints version information
OPTIONS:
-i, --iface <iface> Define network interface [default: wlan0]
-t, --interval <interval> Define time interval for updating alert flags (seconds) [default: 60]
```
### Data Store
`~/.local/share/peachcloud`
```
.
└── net
├── alert.json // programatically-defined alert flags
├── notify.json // user-defined alert thresholds
└── traffic.json // network transmission totals
```
### Alert Types
`peach-monitor` defines warning and cutoff thresholds and corresponding alert flags for both received and transmitted network data. The cutoff thresholds are intended to allow data-intensive processes such as Scuttlebutt replication to be enabled and disabled dynamically.
### Debian Packaging
A `systemd` service file and Debian maintainer scripts are included in the `debian` directory, allowing `peach-monitor` to be easily bundled as a Debian package (`.deb`). The `cargo-deb` [crate](https://crates.io/crates/cargo-deb) can be used to achieve this.
Install `cargo-deb`:
`cargo install cargo-deb`
Move into the repo:
`cd peach-monitor`
Build the package:
`cargo deb`
The output will be written to `target/debian/peach-monitor_0.1.0_arm64.deb` (or similar).
Install the package as follows:
`sudo dpkg -i target/debian/peach-monitor_0.1.0_arm64.deb`
The service will be automatically enabled and started.
Uninstall the service:
`sudo apt-get remove peach-monitor`
Remove configuration files (not removed with `apt-get remove`):
`sudo apt-get purge peach-monitor`
### Roadmap
- Add disk-usage tracking and alerts
### Licensing
AGPL-3.0

View File

@ -1,8 +1,6 @@
# peach-network
[![Build Status](https://travis-ci.com/peachcloud/peach-network.svg?branch=master)](https://travis-ci.com/peachcloud/peach-network)
[![GitHub logo](/assets/github_logo.png "peach-network GitHub repository")](https://github.com/peachcloud/peach-network)
[![GitHub logo](/assets/github_logo.png "peach-network GitHub repository")](https://github.com/peachcloud/peach-network) [![Build Status](https://travis-ci.com/peachcloud/peach-network.svg?branch=master)](https://travis-ci.com/peachcloud/peach-network) ![Version badge](https://img.shields.io/badge/version-0.2.0-<COLOR>.svg)
Networking microservice module for PeachCloud. Query and configure device interfaces using [JSON-RPC](https://www.jsonrpc.org/specification) over HTTP.

View File

@ -1,8 +1,6 @@
# peach-oled
[![Build Status](https://travis-ci.com/peachcloud/peach-oled.svg?branch=master)](https://travis-ci.com/peachcloud/peach-oled)
[![GitHub logo](/assets/github_logo.png "peach-oled GitHub repository")](https://github.com/peachcloud/peach-oled)
[![GitHub logo](/assets/github_logo.png "peach-oled GitHub repository")](https://github.com/peachcloud/peach-oled) [![Build Status](https://travis-ci.com/peachcloud/peach-oled.svg?branch=master)](https://travis-ci.com/peachcloud/peach-oled) ![Version badge](https://img.shields.io/badge/version-0.1.0-<COLOR>.svg)
OLED microservice module for PeachCloud. Write to a 128x64 OLED display with SDD1306 driver (I2C) using [JSON-RPC](https://www.jsonrpc.org/specification) over HTTP.

View File

@ -1,8 +1,6 @@
# peach-stats
[![Build Status](https://travis-ci.com/peachcloud/peach-stats.svg?branch=master)](https://travis-ci.com/peachcloud/peach-stats)
[![GitHub logo](/assets/github_logo.png "peach-stats GitHub repository")](https://github.com/peachcloud/peach-stats)
[![GitHub logo](/assets/github_logo.png "peach-stats GitHub repository")](https://github.com/peachcloud/peach-stats) [![Build Status](https://travis-ci.com/peachcloud/peach-stats.svg?branch=master)](https://travis-ci.com/peachcloud/peach-stats) ![Version badge](https://img.shields.io/badge/version-0.1.0-<COLOR>.svg)
System statistics microservice module for PeachCloud. Provides a JSON-RPC wrapper around the [probes](https://crates.io/crates/probes) and [systemstat](https://crates.io/crates/systemstat) crates.