GithubHelp home page GithubHelp logo

isabella232 / check_docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from newrelic/check_docker

0.0 0.0 0.0 37 KB

A Go Nagios check for Docker

License: BSD 2-Clause "Simplified" License

Shell 4.71% Go 95.29%

check_docker's Introduction

Archived header

check_docker

A Nagios check to check some basic statistics reported by the Docker daemon. Additionally validates the absence of Ghost containers and may optionally be made to require the presence of a container running from a particular image tag.

check_docker is written in Go and is multi-threaded to keep the drag time low on your Nagios server. It makes two API requests to the Docker daemon, one to /info and one to /containers/json and processes the results, all simultaneously.

It is built using the the go_nagios framework.

Installing

If you would rather not build the binaries yourself, you can install compiled, statically-linked binaries for Linux or MacOSX. Simply download the tarball, extract it and use the binary of your choice.

Building

go get github.com/newrelic/go_nagios
go build

Usage

Usage of ./check_docker:
  -base-url="http://docker-server:2375": The Base URL for the Docker server
  -container-name="": The name of a container that must be running on the Docker server
  -warn-data-space=100: Warning threshold for Data Space
  -crit-data-space=100: Critical threshold for Data Space
  -warn-meta-space=100: Warning threshold for Metadata Space
  -crit-meta-space=100: Critical threshold for Metadata Space
  -image-id="": An image ID that must be running on the Docker server
  -tls-cert="": Path to TLS cert file
  -tls-key="": Path to TLS key file
  -tls-ca="": Path to TLS CA file

-base-url: Here you specify the base url of the docker server.

-container-name: Allows you to specify the name of a container that should be running on the server.

-image-id: You can specify an image tag that needs to be running on the server for certain cases where you have pegged a container to a server (e.g. each server has a Nagios monitoring container running to report on server health). Will not require any particular image if left off.

-(warn|crit)-(meta|data)-space: the thresholds at which the named Nagios status codes should be emitted. These are percentages, so -crit-data-space=95 would send a CRITICAL response when the threshold of 95% is crossed. Defaults are 100%.

Contributions

Contributions are more than welcome. Bug reports with specific reproduction steps are great. If you have a code contribution you'd like to make, open a pull request with suggested code.

Pull requests should:

  • Clearly state their intent in the title
  • Have a description that explains the need for the changes
  • Include tests!
  • Not break the public API

Testing for Contributors

go test can be run on 2 different platforms:

  1. In Darwin(aufs), assuming you already setup Boot2Docker:

    docker run -t -d --name named_container busybox:latest
    export DOCKER_IMAGE=busybox:latest
    export DOCKER_CONTAINER_NAME=named_container
    
    cd $GOPATH/src/github.com/newrelic/check_docker
    go get ./... && go test
    
  2. In Linux(devicemapper), you are running the tests inside vagrant:

    cd $GOPATH/src/github.com/newrelic/check_docker
    vagrant up --provider virtualbox
    vagrant ssh
    
    # Inside Vagrant
    sudo docker run -t -d --name named_container busybox:latest
    export DOCKER_IMAGE=busybox:latest
    export DOCKER_CONTAINER_NAME=named_container
    
    export GOPATH=/go
    cd $GOPATH/src/github.com/newrelic/check_docker
    go get ./... && go test
    

Copyright (c) 2014 New Relic, Inc. All rights reserved.

check_docker's People

Contributors

relistan avatar zoni avatar didip avatar melissaklein24 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.