Skip to content

yeasy/cmonit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmonit

Build Status Go Report Card

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

$ docker run --rm \
 --name cmonit \
 --net poolmanager_default \
 yeasy/cmonit \
 start --output-elasticsearch-url="192.168.7.60:9200"

Local build and run

$ 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"

Debug

$ 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"

Configuration

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

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

About

monitor for host health, container stats, etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published