https://github.com/yeasy/cmonit
monitor for host health, container stats, etc.
https://github.com/yeasy/cmonit
Last synced: 4 months ago
JSON representation
monitor for host health, container stats, etc.
- Host: GitHub
- URL: https://github.com/yeasy/cmonit
- Owner: yeasy
- License: apache-2.0
- Created: 2016-05-13T06:05:57.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-25T12:22:56.000Z (almost 9 years ago)
- Last Synced: 2025-02-24T14:21:48.923Z (4 months ago)
- Language: Go
- Size: 1.87 MB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cmonit
===[](https://travis-ci.org/yeasy/cmonit)
[](https://goreportcard.com/report/github.com/yeasy/cmonit)Monitor for container stats, etc.
cmonit can automatically read host info from db, and check the containers (with `label=monitor=true`) status, and then write back to db.
Example visualized results:

## Usage
### Run in container
```sh
$ docker run --rm \
--name cmonit \
--net poolmanager_default \
yeasy/cmonit \
start --output-elasticsearch-url="192.168.7.60:9200"
```### Local build and run
```sh
$ make build && ./main start --output-elasticsearch-url="192.168.7.60:9200"
```or
```sh
$ make build && ./main start --output-elasticsearch-url="192.168.35.129:9200"
```### Debug
```sh
$ docker run -it --rm --name cmonit --net poolmanager_default -v /home/baohua/cmonit:/cmonit --entrypoint=ping yeasy/cmonit localhost
```Then go into the container.
```sh
$ docker exec -it cmonit bash
```Inside the container, run build and start.
```sh
$ make build && ./main --output-elasticsearch-url="192.168.7.60:9200"
```## Configuration
cmonit will automatically search the `cmonit.yaml` file under `.`, `$HOME`, `/etc/cmonit/` or `$GOPATH/github.com/yeasy/cmonit`.Please see [cmonit.yaml](cmonit.yaml) for example.
A typical config file will look like
```yaml
logging:
level: debug
input:
url: "mongo:27017" //mongo db url
db_name: "dev" //name of the db to use
col_host: "host" //from which collection to get host info
col_cluster: "cluster_active"
output:
mongo:
url: "mongo:27017"
db_name: "monitor"//store data to which collection
col_host: "host" # stat data for each host with timestamp
col_cluster: "cluster" # stat data for each cluster with timestamp
col_container: "container" # stat data for each cluster with timestamp
elasticsearch: # to support in future
url: "elasticsearch:9200"
index: "monitor"
sync:
interval: 60 //sync host info interval, in seconds
monitor:
expire: 7 //monitor data expiration, in days
interval: 5 //monitor container info interval, in seconds
```## TODO
* ~~Update the config file to support more functionality.~~
* ~~Re-arch to use db and collect data more efficiently.~~
* ~~May support es as output too.~~
* ~~When db crash, should continue to work with warning msg.~~
* ~~Reduce connections and optimize the performance.~~
* check chain health status