/statusfile-writer

Simple python sniplet writing a status file parseable by check_remote_json and compatible with nagios/icinga plugin api

Primary LanguagePythonGNU General Public License v2.0GPL-2.0

statusfile-writer

Simple python sniplet writing a status file parseable by check_remote_json and compatible with nagios/icinga plugin api

Installation:

This is a bybuilder project. You will need to install pybuilder by: pip install pybuilder

Verify project (unittests and coverage)

pyb verify

Install project dependencies

pyb install_dependencies

Build project

pyb publish

Usage:

Shell

Help

python statusfile_tests.py --help

Write status file

python statusfile_tests.py /var/www/status/mycronjob-status.json 0 "Successfully resized 1000 files"

As python module

from statusfile_writer.statusfile import StatusFile

statusfile = StatusFile("/var/www/status/myapp-status.json")
statusfile.write(2,"Fatal error occured")

Example output:

{
  "status": 0,
  "timestamp": 1390501647,
  "message": "Successfully resized 1000 files"
}

Status Codes:

0 - OK
1 - Warning
2 - Critical
3 - Unknown

(see: http://www.nagios-plugins.org/doc/guidelines.html)