Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Perfdata with volstatus #26

Open
ggzengel opened this issue Oct 30, 2023 · 1 comment
Open

Wrong Perfdata with volstatus #26

ggzengel opened this issue Oct 30, 2023 · 1 comment

Comments

@ggzengel
Copy link

You put Critical in front of perfdata, too:
FreeSize_Volume-1=CRITICAL: 8%;20;10;0;100

# '/srv/icinga/linux/check_qnap3' '-H' 'qnap' '-c' '10' '-p' 'volstatus' '-w' '20'
Volume #1: OK: Ready, Total Size (bytes): 1.81 TB, Free: 152.02 GB (CRITICAL: 8%), Volume #2: OK: Ready, Total Size (bytes): 1.81 TB, Free: 149.36 GB (CRITICAL: 8%)|FreeSize_Volume-1=CRITICAL: 8%;20;10;0;100 FreeSize_Volume-2=CRITICAL: 8%;20;10;0;100

With this changes it works:

I change VOLPCT to VOLPCTM for Output and left VOLPCT for prefdata.

        if [ "$VOLPCT" -le "$strCritical" ]; then
                VOLPCTM="CRITICAL: $VOLPCT"
                CRITICAL=1
        elif [ "$VOLPCT" -le "$strWarning" ]; then
                VOLPCTM="WARNING: $VOLPCT"
                WARNING=1
        fi

        if [ "$VOL" -lt "$VOLCOUNT" ]; then
           ALLOUTPUT="${ALLOUTPUT}Volume #${VOL}: $VOLSTAT, Total Size (bytes): $VOLCAPACITY $UNITtest, Free: $VOLFREESIZE $UNITtest2 (${VOLPCTM}%), "
        else
           ALLOUTPUT="${ALLOUTPUT}Volume #${VOL}: $VOLSTAT, Total Size (bytes): $VOLCAPACITY $UNITtest, Free: $VOLFREESIZE $UNITtest2 (${VOLPCTM}%)"
        fi
# '/srv/icinga/linux/check_qnap3' '-H' 'qnap' '-c' '10' '-p' 'volstatus' '-w' '20'
Volume #1: OK: Ready, Total Size (bytes): 1.81 TB, Free: 152.02 GB (CRITICAL: 8%), Volume #2: OK: Ready, Total Size (bytes): 1.81 TB, Free: 149.34 GB (CRITICAL: 8%)|FreeSize_Volume-1=8%;20;10;0;100 FreeSize_Volume-2=8%;20;10;0;100
@ggzengel
Copy link
Author

My solution is wrong.
You have only to change the position of the code:

        #Performance Data
        if [ $VOL -gt 1 ]; then
          PERFOUTPUT=$PERFOUTPUT" "
        fi
        PERFOUTPUT=$PERFOUTPUT"FreeSize_Volume-$VOL=${VOLPCT}%;$strWarning;$strCritical;0;100"

        if [ "$VOLPCT" -le "$strCritical" ]; then
                VOLPCT="CRITICAL: $VOLPCT"
                CRITICAL=1
        elif [ "$VOLPCT" -le "$strWarning" ]; then
                VOLPCT="WARNING: $VOLPCT"
                WARNING=1
        fi

        if [ "$VOL" -lt "$VOLCOUNT" ]; then
           ALLOUTPUT="${ALLOUTPUT}Volume #${VOL}: $VOLSTAT, Total Size (bytes): $VOLCAPACITY $UNITtest, Free: $VOLFREESIZE $UNITtest2 (${VOLPCT}%), "
        else
           ALLOUTPUT="${ALLOUTPUT}Volume #${VOL}: $VOLSTAT, Total Size (bytes): $VOLCAPACITY $UNITtest, Free: $VOLFREESIZE $UNITtest2 (${VOLPCT}%)"
        fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant