monitor for host health, container stats, etc.
APACHE-2.0 License
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:
$ docker run --rm \
--name cmonit \
--net poolmanager_default \
yeasy/cmonit \
start --output-elasticsearch-url="192.168.7.60:9200"
$ make build && ./main start --output-elasticsearch-url="192.168.7.60:9200"
or
$ make build && ./main start --output-elasticsearch-url="192.168.35.129:9200"
$ docker run -it --rm --name cmonit --net poolmanager_default -v /home/baohua/cmonit:/cmonit --entrypoint=ping yeasy/cmonit localhost
Then go into the container.
$ docker exec -it cmonit bash
Inside the container, run build and start.
$ make build && ./main --output-elasticsearch-url="192.168.7.60:9200"
cmonit will automatically search the cmonit.yaml
file under .
, $HOME
, /etc/cmonit/
or $GOPATH/github.com/yeasy/cmonit
.
Please see cmonit.yaml for example.
A typical config file will look like
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