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

remove check_sensuplugins

parent ada16a78
No related branches found
No related tags found
1 merge request!270Update docs
#!/bin/bash
# ======================================================================
#
# SENSU CHECK FOR VALIDITY OF PLUGIN LINKS
#
# ----------------------------------------------------------------------
#
# ----------------------------------------------------------------------
# 2018-07-17 first lines
# 2022-10-21 v1.1 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space
# ======================================================================
. `dirname $0`/inc_pluginfunctions
tmpfile=/tmp/check_sensuplugins.out
# ----------------------------------------------------------------------
# functions to fetch infos by status
# ----------------------------------------------------------------------
function _getStatus(){
cat $tmpfile | grep '^\.\.\.' | grep " $1\:"
}
function getTotal(){
_getStatus '.*'
}
function getOK(){
_getStatus "OK"
}
function getWarnings(){
_getStatus "WARNING"
}
function getErrors(){
_getStatus "ERROR"
}
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
(/usr/local/bin/link-sensu-checks.sh -i ; /usr/local/bin/link-sensu-checks.sh -f) >$tmpfile
# --- output of errors and warnings
echo --- Check sensu plugins
getErrors
getWarnings
# --- show status
typeset -i iTOTAL=`getTotal | wc -l`
typeset -i iOK=`getOK | wc -l`
typeset -i iERRORS=`getErrors | wc -l`
typeset -i iWARNINGS=`getWarnings | wc -l`
echo --- Status:
echo "total : $iTOTAL"
echo "Errors : $iERRORS"
echo "Warnings: $iWARNINGS"
echo "OK : $iOK"
rm -f $tmpfile
# --- return with wanted exitcode
if [ $iERRORS -gt 0 ]; then
echo exit with error.
exit $EXIT_CRITICAL
fi
if [ $iWARNINGS -gt 0 ]; then
echo exit with warning
exit $EXIT_WARNING
fi
echo exit with OK
exit $EXIT_OK
# ----------------------------------------------------------------------
......@@ -47,7 +47,6 @@ There is one include script used by all checks:
* [check_rearbackup](check_rearbackup.md)
* [check_reboot_required](check_reboot_required.md)
* [check_requirements](check_requirements.md)
* check_sensuplugins
* check_smartstatus
* [check_snmp_data](check_snmp_data.md)
* check_snmp_printer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment