https://github.com/crc-org/monitools
Performance monitoring tools for CRC
https://github.com/crc-org/monitools
Last synced: about 2 months ago
JSON representation
Performance monitoring tools for CRC
- Host: GitHub
- URL: https://github.com/crc-org/monitools
- Owner: crc-org
- Created: 2020-12-15T10:53:29.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-19T12:06:07.000Z (over 2 years ago)
- Last Synced: 2024-06-21T18:03:51.690Z (about 1 year ago)
- Language: Go
- Size: 1.4 MB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
monitools
==Gather resource consumption data around a CodeReady Containers instance
## ContainerThe following diagram represent the interaction of monitools container with a host running the CodeReady Containers instance.

The container will be configured with ENVs:
#### target host configuration
**TARGET_HOST**(*mandatory*): Target host address
**TARGET_HOST_USERNAME**(*mandatory*): usernameChose one of following depending on the target auth mechanism:
**TARGET_HOST_KEY_PATH**(*optional*): key path
**TARGET_HOST_PASSWORD**(*optional*): pasword#### monictl configuration
**MONICTL_REPETITIONS**(*optional, default 5*)
**MONICTL_INTERVAL**(*optional, default 1*)Sample container execution
```bash
podman run -it --rm \
-e TARGET_HOST_USERNAME=XXXX \
-e TARGET_HOST_KEY_PATH=XXXX \
-e TARGET_HOST=XXXX \
quay.io/crc/monitools
```## Standalone tool
### Install
Clone this repository by `gith clone https://github.com/code-ready/monitools` and the following command will build the `monictl` executable and place it in `$(GOBIN)` directory.
``` bash
make install
```### Usage
1. Create directory where you want `monictl` to deposit the data.
2. Have a running instance of CRC (`crc status` returns `Running` for both VM and the cluster)
3. Run
```bash
monictl -d= -n= -s=
```
4. Look into your data folder to inspect the files.
### Flags/arguments- `-d`: data directory (relative to current directory)
- `-n`: number of repetitions when probing CPU consumption
- `-s`: time interval between repetitions when probing CPU consumption (in seconds)### Example of a first run
Assuming a running CRC instance:
``` bash
$ make install
$ mkdir data
$ monictl -d=data -n=5 -s=1
-------------
Running monitoring tools with the following settings:
Data directory: data
Number of repeats: 5
Pauses between repeats: 1s
Logging into: logs/monitools_20210329101528.log
-------------
$ ls data
cpu.json crictl-stats-20210329101533.json traffic.json
$ ls logs
monitools_20210329101528.log
```## 'Import into your code' usecase
First, install this module to your development environment using e.g. `go get` tool:
``` bash
go get github.com/code-ready/monitools
```Then use as any other package, e.g. by importing as:
``` bash
import github.com/code-ready/monitools/tools
```
### ExampleIn `monitools/examples` you will find a short program that imports this module and the `tools` package and runs one of its functions. It assumes an existing CRC VM and probes for CPU usage of the `qemu` process 5 times with 1s sleep inbetween probes. Resulting %CPU is recorded in `cpu.csv` in the same `monitools/examples` folder. Run the example script `example.go` by
``` bash
$ cd monitools/examples
$ go run example.go
```