cSense (Container Sense) allows you to subscribe to container events with web hooks. Hooks are registered with cSense via an HTTP API and may contain selectors, like image tag or container name, to limit the containers or events that the hook should be notified about.
Supported storage backends:
- Etcd3
- Consul
- In-memory
$ go get github.com/danielkrainas/csense
$ csense [command] <config_path>
Most commands require a configuration path provided as an argument or in the CSENSE_CONFIG_PATH
environment variable.
This is the primary mode for cSense. It hosts the HTTP API server and handles monitoring and notifying hooks of container events.
$ csense agent <config_path>
Example - with the default config:
$ csense agent ./config.default.yml
A configuration file is required for cSense but environment variables can be used to override configuration. A configuration file can be specified as a parameter or with the CSENSE_CONFIG_PATH
environment variable.
All configuration environment variables are prefixed by CSENSE_
and the paths are separated by an underscore(_
). Some examples:
CSENSE_LOGGING_LEVEL=warn
CSENSE_HTTP_ADDR=localhost:2345
CSENSE_STORAGE_INMEMORY=true
CSENSE_STORAGE_CONSUL_PARAM1=val
A development configuration file is included: /config.dev.yml
and a /config.local.yml
has already been added to gitignore to be used for local testing or development.
# configuration schema version number, only `1.0`
version: 1.0
# log stuff
logging:
# minimum event level to log: `error`, `warn`, `info`, or `debug`
level: 'debug'
# log output format: `text` or `json`
formatter: 'text'
# custom fields to be added and displayed in the log
fields:
customfield1: 'value'
# http server stuff
http:
# host:port address for the server to listen on
addr: ':9181'
# http host
host: 'localhost'
# CORS stuff
cors:
# origins to allow
origins: ['http://localhost:5555']
# methods to allow
methods: ['GET','POST','OPTIONS','DELETE','CONNECT']
# headers to allow
headers: ['*']
# storage driver and parameters
storage:
consul:
param1: 'val'
# the in-memory driver has no parameters so it can be declared as a string
storage: 'inmemory'
storage
only allows specification of one driver per configuration. Any additional ones will cause a validation error when the application starts.
If you see a bug or have a suggestion, feel free to open an issue here.
PR's welcome! There are no strict style guidelines, just follow best practices and try to keep with the general look & feel of the code present. All submissions should atleast be go fmt -s
and have a test to verify (if applicable).
For details on how to extend and develop cSense, see the dev documentation.
Unlicense. This is a Public Domain work.
"Make art not law" -Nina Paley