Simple python sniplet writing a status file parseable by check_remote_json and compatible with nagios/icinga plugin api
This is a bybuilder project. You will need to install pybuilder by: pip install pybuilder
pyb verify
pyb install_dependencies
pyb publish
python statusfile_tests.py --help
python statusfile_tests.py /var/www/status/mycronjob-status.json 0 "Successfully resized 1000 files"
from statusfile_writer.statusfile import StatusFile
statusfile = StatusFile("/var/www/status/myapp-status.json")
statusfile.write(2,"Fatal error occured")
{
"status": 0,
"timestamp": 1390501647,
"message": "Successfully resized 1000 files"
}
0 - OK
1 - Warning
2 - Critical
3 - Unknown