Author: glen Date: Thu Mar 15 07:14:23 2012 GMT Module: packages Tag: HEAD ---- Log message: - add verbose output support
---- Files affected: packages/nagios-plugin-check_ipmi: check_ipmi (1.14 -> 1.15) ---- Diffs: ================================================================ Index: packages/nagios-plugin-check_ipmi/check_ipmi diff -u packages/nagios-plugin-check_ipmi/check_ipmi:1.14 packages/nagios-plugin-check_ipmi/check_ipmi:1.15 --- packages/nagios-plugin-check_ipmi/check_ipmi:1.14 Wed Mar 9 11:23:40 2011 +++ packages/nagios-plugin-check_ipmi/check_ipmi Thu Mar 15 08:14:18 2012 @@ -2,6 +2,7 @@ # License: GPL v2 # Copyright (c) 2007 op5 AB # Author: Hugo Hallqvist <[email protected]> +# Copyright (c) 2010-2012 # Author: Elan Ruusamäe <[email protected]> # # Ported to pure shell by Elan Ruusamäe @@ -20,17 +21,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # -# Description: +# Description: # Nagios plugin for locally checking hardware status (fans, voltage) via ipmi. # It utilizes ipmitool to get results from kernel. # # Usage: check_ipmi <filename> -# +# # filename points to a file which is used as a cache for speeding up the check. PROGRAM=${0##*/} -REVISION=$(echo '$Revision$' | sed -e 's/[^0-9.]//g') PROGPATH=${0%/*} +R='$Revision$'; R=${R#* *}; REVISION=${R%% *} ARGS="$*" . $PROGPATH/utils.sh @@ -38,11 +39,19 @@ ipmitool=/usr/bin/ipmitool sudo=/usr/bin/sudo modprobe=/sbin/modprobe +outfile= +verbose=false die() { eval local rc=\$STATE_$1 [ "$rc" ] || rc=$STATE_UNKNOWN echo "$2" + + # print also verbose output out + if $verbose; then + cat $outfile + rm -f $outfile + fi exit $rc } @@ -64,6 +73,8 @@ grep extended regexp which sensors to ignore -I comma separated list of statuses to ignore + -v + enable verbose output (prints each sensor which is not ignored) EOF } @@ -174,6 +185,9 @@ echo $PROGRAM $REVISION exit 0 ;; + -v) + verbose=: + ;; -c) check_ipmitool=1 ;; @@ -230,6 +244,11 @@ # Fan 4 | 29.40 unspecifi | nc # Fans | 0 unspecified | nc +# setup outfile, because we should print verbose after status message +if $verbose; then + outfile=$(mktemp) || die CRITICAL "Can't create tempfile" +fi + ok_sensors=0 warn_sensors=0 crit_sensors=0 @@ -270,6 +289,9 @@ critical="$critical($label, $status, $result) " ;; esac + if $verbose; then + echo "$label $result $status" >> $outfile + fi done < $t rm -f $t ================================================================ ---- CVS-web: http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_ipmi/check_ipmi?r1=1.14&r2=1.15&f=u _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
