From 63b7ff5790b270b7109d6bf3b2d5498c6ff74f40 Mon Sep 17 00:00:00 2001 From: Sebastien Coavoux Date: Mon, 29 Sep 2014 17:12:04 -0400 Subject: [PATCH] Enh: Travis build --- .travis.yml | 7 +-- README.rst | 116 +++++++++++++++++++++++++++++++++++++- requirements.txt | 1 - test/dep_modules.txt | 2 + test/setup_module_test.sh | 32 +++++++++++ 5 files changed, 151 insertions(+), 7 deletions(-) mode change 120000 => 100644 README.rst delete mode 100644 requirements.txt create mode 100644 test/dep_modules.txt create mode 100755 test/setup_module_test.sh diff --git a/.travis.yml b/.travis.yml index 9afe305..02abbfa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,9 @@ python: - "2.6" install: - - "pip install pycurl" - - "sudo useradd shinken" - - "pip install -r requirements.txt" - - "pip install coveralls" + - "[ -d test ] && ./test/setup_module_test.sh || : " -script: nosetests -vx --with-coverage --cover-package=module +script: "[ -d test ] && cd ~/shinken/test && nosetests -vx --with-coverage --cover-package=module || :" after_success: coveralls diff --git a/README.rst b/README.rst deleted file mode 120000 index 176d9c2..0000000 --- a/README.rst +++ /dev/null @@ -1 +0,0 @@ -doc/index.rst \ No newline at end of file diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..27ad148 --- /dev/null +++ b/README.rst @@ -0,0 +1,115 @@ +.. image:: https://api.travis-ci.org/shinken-monitoring/mod-livestatus.svg?branch=master + :target: https://travis-ci.org/shinken-monitoring/mod-livestatus +.. _livestatus_shinken: + +======================= +Shinken Livestatus API +======================= + + +Overview +========= + + + * Jump back to :ref:`Getting Started ` + * Jump back to :ref:`Livestatus module configuration ` + + +What is it +----------- + + +Livestatus API is the modern method of interacting with Shinken and Nagios based systems alike. + +Originally developed for Nagios, MK Livetstatus, was re-implemented in Python for use with Shinken by professional developers. The access methods and query languages are the same. + + +.. image:: /_static/images/livestatus_-_network_communications.png + :scale: 90 % + + +Why use it +----------- + + +It is fast. + +It is network based using TCP. + +It is standard for all Nagios and Shinken monitoring systems. + +It uses in-memory structures for status data + +It uses a back-end database for historical reporting + +It uses an SQL based query language + +It has a host of powerful nuts and bolts features (authentication, caching, connection persistence, multiple object methods (JSON, Python)). + + +What can I do with it? +----------------------- + + +All programs and scripts use (or should use) this method to : + + * Obtain the current state of hosts and services + * Obtain the current configuration related to hosts and services + * Send administrative commands (downtimes, comments, forcing checks) + * Filter information to display + * Obtain basic reports and event statistics + +Shinken being a modern re-implementation of Nagios has additional features that are available in addition to the standard Livestatus API. + +Shinken Livestatus API unique features can : + * Obtain Business Impact information + * Obtain intelligent dependency status hosts or services (combines dependency and parent information) + * Obtain Business Process states (same syntax as standard host and service queries) + + +How does it work +================= + + +Livestatus uses a powerful SQL-like query language. The standard methods and parameters are defined at : + + `MK Livestatus reference methods and query language definition`_ + +Full list of Shinken Livestatus API methods: + +`Shinken mapping.py methods`_ + + +What software uses Livestatus to interact with Shinken +======================================================= + + +Well known Web frontends + * MK Multisite + * Thruk + * NagVis + * Splunk for Nagios + +Mobile Web frontends + * get list + +Scripts + * Downtime management scripts + * Debug scripts + + +Installing Livestatus +---------------------- + + +Have you installed the required packages to use the Livestatus module? You can look at the requirement section of the :ref:`10 minute installation guide ` for the :ref:`requirement lists `. + + +How to enable Livestatus +------------------------- + + +Very simple, jump to the :ref:`Shinken Broker configuration ` section to enable it. + +.. _Shinken mapping.py methods: https://github.com/shinken-monitoring/mod-livestatus/blob/master/module/mapping.py +.. _MK Livestatus reference methods and query language definition: http://mathias-kettner.de/checkmk_livestatus.html diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 13a6f30..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ --e git+https://github.com/naparuba/shinken.git#egg=shinken diff --git a/test/dep_modules.txt b/test/dep_modules.txt new file mode 100644 index 0000000..48c7e9a --- /dev/null +++ b/test/dep_modules.txt @@ -0,0 +1,2 @@ +https://github.com/shinken-monitoring/mod-logstore-sqlite.git +https://github.com/shinken-monitoring/mod-logstore-mongodb.git diff --git a/test/setup_module_test.sh b/test/setup_module_test.sh new file mode 100755 index 0000000..5637427 --- /dev/null +++ b/test/setup_module_test.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +get_name (){ + +echo $(python -c 'import json; print json.load(open("'$1'package.json"))["name"]') +} + +setup_submodule (){ + for dep in $(cat test/dep_modules.txt); do + mname=$(basename $dep | sed 's/.git//g') + git clone $dep ~/$mname + rmname=$(get_name ~/$mname/) + cp -r ~/$mname/module ~/shinken/modules/$rmname + [ -f ~/$mname/requirements.txt ] && pip install -r ~/$mname/requirements.txt + done +} + +name=$(get_name) + +pip install pycurl +pip install coveralls +git clone https://github.com/naparuba/shinken.git ~/shinken +[ -f test/dep_modules.txt ] && setup_submodule +[ -f requirements.txt ] && pip install -r requirements.txt +rm ~/shinken/test/test_*.py +cp test/test_*.py ~/shinken/test/ +[ -d test/etc ] && cp -r test/etc ~/shinken/test/ +cp -r module ~/shinken/modules/$name +ln -sf ~/shinken/modules ~/shinken/test/modules +#cd ~/shinken + +