Add version badges and docs for peach-monitor
This commit is contained in:
parent
bf2241fb72
commit
dbe7033349
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -1,8 +1,6 @@
|
||||
# peach-buttons
|
||||
|
||||
[](https://travis-ci.com/peachcloud/peach-buttons)
|
||||
|
||||
[](https://github.com/peachcloud/peach-buttons)
|
||||
[](https://github.com/peachcloud/peach-buttons) [](https://travis-ci.com/peachcloud/peach-buttons) 
|
||||
|
||||
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.
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
# peach-menu
|
||||
|
||||
[](https://travis-ci.com/peachcloud/peach-menu)
|
||||
|
||||
[](https://github.com/peachcloud/peach-menu)
|
||||
[](https://github.com/peachcloud/peach-menu) [](https://travis-ci.com/peachcloud/peach-menu) 
|
||||
|
||||
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`).
|
||||
|
||||
|
88
src/software/microservices/peach-monitor.md
Normal file
88
src/software/microservices/peach-monitor.md
Normal file
@ -0,0 +1,88 @@
|
||||
# peach-monitor
|
||||
|
||||
[](https://github.com/peachcloud/peach-monitor) [](https://travis-ci.com/peachcloud/peach-web) 
|
||||
|
||||
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
|
@ -1,8 +1,6 @@
|
||||
# peach-network
|
||||
|
||||
[](https://travis-ci.com/peachcloud/peach-network)
|
||||
|
||||
[](https://github.com/peachcloud/peach-network)
|
||||
[](https://github.com/peachcloud/peach-network) [](https://travis-ci.com/peachcloud/peach-network) 
|
||||
|
||||
Networking microservice module for PeachCloud. Query and configure device interfaces using [JSON-RPC](https://www.jsonrpc.org/specification) over HTTP.
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
# peach-oled
|
||||
|
||||
[](https://travis-ci.com/peachcloud/peach-oled)
|
||||
|
||||
[](https://github.com/peachcloud/peach-oled)
|
||||
[](https://github.com/peachcloud/peach-oled) [](https://travis-ci.com/peachcloud/peach-oled) 
|
||||
|
||||
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.
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
# peach-stats
|
||||
|
||||
[](https://travis-ci.com/peachcloud/peach-stats)
|
||||
|
||||
[](https://github.com/peachcloud/peach-stats)
|
||||
[](https://github.com/peachcloud/peach-stats) [](https://travis-ci.com/peachcloud/peach-stats) 
|
||||
|
||||
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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user