Skip to content
Snippets Groups Projects
Commit 98356696 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

icingacli - detect unreadable config or non writable output file

parent 538460fc
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@
_product="ICINGA PASSIVE CLIENT"
_version="0.3"
_version="0.4"
_license="GNU GPL 3.0"
_copyright='(c) 2020 Institute for Medical Education * University of Bern'
......@@ -178,6 +178,11 @@ function processAllChecks(){
function _parseCheckConfig(){
local _myconfig=$1
if [ ! -r $_myconfig ]; then
echo "ERROR: config file is not readable [$_myconfig]"
exit 1
fi
# EXAMPLE a config contains ...
# checkname=check_cronstatus
# command=check_cronstatus -param1 -param2
......@@ -308,6 +313,11 @@ function processCheck(){
# $myFullscript $myparams | tee $_outfile
eval $myFullscript $myparams > $_outfile
rc=$?
if [ $rc -ne 0 ]; then
echo "ERROR: unable to write file $_outfile. Maybe the setup is inclomplete or someone created a file as root."
ls -ld ${dir_data} $_outfile
exit 1
fi
typeset -i local iTsEnd=`date +%s`
outPerfdata=`grep '|' $_outfile | cut -f 2 -d '|'`
echo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment