moved to https://gitea.schlittermann.de/IUS/monitoring-plugin-lvmthin default tip
authorMatthias Förste <foerste@schlittermann.de>
Wed, 30 Nov 2022 15:38:45 +0100
changeset 4 896ffeb44d7c
parent 3 11e1f1430bfd
moved to https://gitea.schlittermann.de/IUS/monitoring-plugin-lvmthin
README
check_lvmthin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Wed Nov 30 15:38:45 2022 +0100
@@ -0,0 +1,1 @@
+moved to https://gitea.schlittermann.de/IUS/monitoring-plugin-lvmthin
--- a/check_lvmthin	Sat Jun 11 00:19:59 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-#!/bin/sh -e
-
-ME=$(basename $0)
-NAME='LVMTHIN'
-E=3
-INFO=
-PERFDATA=
-
-lvsresults=$(mktemp /tmp/$ME.XXX)
-
-cleanup() {
-    [ -n "$lvsresults" ] && rm $lvsresults;
-}
-
-nagiosexit() {
-    local STATUS='UNKNOWN'
-    if [ $E = '2' ]; then STATUS='CRITICAL'
-    elif [ $E = '1' ]; then STATUS='WARNING'
-    elif [ $E = '0' ]; then STATUS='OK'
-    fi
-    echo "$NAME $STATUS${INFO:+: ${INFO}}${PERFDATA:+|$PERFDATA}"
-    exit $E
-}
-
-trap 'trap - EXIT; cleanup; nagiosexit $E' INT QUIT TERM EXIT
-
-die() {
-    INFO="$@"
-    exit 3
-}
-
-parse_lvs() {
-    results=$1
-    label=$2
-    local id=
-    if [ ! -s "$results" ]; then
-        id=$(id -u)
-        die "No volumes found (effective user ID: $id)"
-    fi
-    while read vg lv u; do
-        [ -n "$vg" -a -n "$lv" -a -n "$u" ] || die "Can't parse results"
-        addinfo=
-        if [ "$u" '>' "$C" ]; then
-            E=2
-            addinfo='yes'
-        elif [ "$u" '>' "$W" ]; then
-            [ $E != '2' ] && E=1
-            addinfo='yes'
-        fi 
-        [ -n "$addinfo" ] && INFO="${INFO:+${INFO}; }$vg/$lv$label $u%"
-        PERFDATA="${PERFDATA:+${PERFDATA} }$vg/$lv$label=$u%;$W;$C"
-    done <$results
-}
-
-W='80.00'
-C='90.00'
-T=
-P=
-
-while getopts "hm?c:p:t:w:" opt; do
-  case $opt in
-    h|\?)
-        cleanup; exec pod2usage -verbose 1 -exit 0 $0
-        ;;
-    m)
-        cleanup; exec pod2usage -verbose 3 -exit 0 $0
-        ;;
-    c)
-        C="$OPTARG"
-        ;;
-    p)
-        P="$P $OPTARG"
-        ;;
-    t)
-        T=$T $OPTARG
-        ;;
-    w)
-        W=$OPTARG
-        ;;
-  esac
-done
-shift $((OPTIND-1))
-
-lvs --noheadings -S 'segtype=thin||segtype=thin-pool' -o vg_name,lv_name,data_percent $T $P >$lvsresults; parse_lvs $lvsresults
-[ -n "$T" -a -z "$P" ] || lvs --noheadings -S 'segtype=thin-pool' -o vg_name,lv_name,metadata_percent $P >$lvsresults; parse_lvs $lvsresults '(meta)'
-
-[ $E = '3' ] && E=0
-exit $E
-
-: <<EOP
-
-=encoding utf8
-
-=pod
-
-=head1 NAME
-
-check_lvmthin - check usage of thin provisioned logical volumes (lvm)
-
-=head1 SYNOPSIS
-
-check_lvmthin [-t volume] [-p volume]
-
-check_lvmthin -h|-?|-m
-
-=head1 DESCRIPTION
-
-This script checks the usage of thin provisioned logical volumes.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-h|-?>
-
-Display help.
-
-=item B<-m>
-
-Display man page.
-
-=item B<-c> I<threshold>
-
-Exit with status 'CRITICAL' if any checked volume uses more than I<threshold> percent of its size.
-
-=item B<-t> I<thinlv>
-
-check usage of thin provisioned logical volume I<thinlv>.
-
-=item B<-p> I<poollv>
-
-check data and metadata usage of pool volume I<poollv>.
-
-=item B<-w> I<threshold>
-
-Exit with status 'WARNING' if any checked volume uses more than I<threshold> percent of its size.
-
-=back
-
-I<thinlv> and I<poollv> should be given as names understood by lvs. If both are omitted, then data usage for all thinlv and poollv and metadata usage for all poollv is checked. Thresholds should be given in decimal notation with 2 positions after the decimal point.
-
-=head1 EXAMPLE
-
-check_lvmthin -w 76.54 -t vg/lv
-
-=head1 AUTHOR
-
-Matthias Förste <foerste@schlittermann.de>
-
-The lastest version is available at L<https://ssl.schlittermann.de/hg/ius/nagios/nagios-plugin-lvmthin/>
-
-=cut
-
-EOP