Giter Site home page Giter Site logo

check_test's Introduction

check_test

A monitoring plugin strictily for testing

While check_dummy fine for simple tests I needed a more sophisticated testing plugin. This works for Icinga (2) as well as every other tool using monitoring plugins like Shinken, Naemon, Nagios, etc.

Things which can not be done with check_dummy or check_random :

  • Get several times an OK state and suddenly switching to Critical without restarting / reloading the monitoring software or injecting passive check results. Either by changing the configfile by hand or have it automatically change after a set amount of checks.
  • Switch randomly between a predefined set of statuses
  • Change state at a certain time (useful for testing planned downtimes)
  • Change the state under certain controlled conditions and change it back later

Disclaimer

This plugin is very simple at the moment. I will expand it's possibilities as I need more functionality while running tests. If you need special cases: Patches are welcome.

Monitoring plugins should not use external config files or temporary files but since this is not to be used in production environments it should be ok to use them anyway.

Usage

Since the whole reason why I wanted this plugin was to be able to change the output whithout changing Icinga 2, it has only one commandline argument: Where to find a configuration file. This is what you change while Icinga 2 is running.

sudo -u icinga ./check_test -f [configfile]

Keep in mind that you can set the file to use on a per check basis. This way you can create several test cases in one setup.

Configuration file

The configuration file by now only supports setting the return code and the output of the plugin. More options are to come.

Example file:

STATUS=2
OUTPUT="Custom output"

Acknowledgements

  • This plugin was created for running some tests for the upcoming Icinga 2 2.6 release
  • I created this plugin as part of my work for Netways

check_test's People

Contributors

widhalmt avatar

Watchers

 avatar  avatar

check_test's Issues

Make config file a real commandline option

Right now, the script just takes the second option given, no matter if you use -f or not. This should be changed to a more sane way of defining the configuration file.

Add mode `flapping`

Idea: Set starttime and endtime and within flapping period return random return value. Maybe not completly random but alternating between two states.

I think it's better to use random instead of strictily alternating because this likely to be more like a real world example.

Add a `scheduled` mode

Takes 4 configuration items:

  • state A
  • state B
  • When to switch from state A to B
  • When to switch back from state B to A

It would be nice if we could use Icinga timeperiod objects but maybe it would be easier to implement with "real" time.

Add `interval` mode

Uses 4 configuration items:

  • State A
  • State B
  • After how many checks to switch to state A
  • After how many checks to switch to state B

Introduce `manual` as default mode

This mode just reads its exit code and output from the configuration file. If you want to change something, manually change the configuration - it will be read during the next run.

Provide a Plugin that reads the logfile

While there are more sophisticated solutions like Logstash, Graylog or check_logfiles this should be a very specific solution just for test cases.

I'm not quite sure how I'll handle more complicated tests but the goal is to end up with several Icinga services running different test cases and one (ore one for each test-service) service that shows whether the tests were successful. This could be a very powerful help in testing new versions.

Introduce temporary files

For saving check counts, etc.

Their name could be derived from the name of the used configuration file or from a "testname". The later could be used via commandline, too.

Write a common logfile for all tests

Maybe into the default Icinga 2 log directory. Maybe make configurable if syslog should be used.

Use an easy to parse syntax for parsing with Logstash.

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.