Bug 1754201

Summary: check_disk produces extraneous output
Product: [Fedora] Fedora Reporter: Stephen John Smoogen <smooge>
Component: nagios-pluginsAssignee: Stephen John Smoogen <smooge>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 31CC: alexander.kohr, alexander.kohr, athmanem, b.heden, bitmage, extras-qa, herrold, kritek, lemenkov, sftw, smooge, smooge, spamfaenger, swilkerson, tmz, wesley, yongs123456
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: nagios-plugins-2.2.2-1.20190919git00cff01.fc30 nagios-plugins-2.2.2-1.20190919git00cff01.fc29 nagios-plugins-2.2.2-2.20190926git1b8ad57.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1752219 Environment:
Last Closed: 2019-09-30 01:00:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1752219    
Bug Blocks:    

Description Stephen John Smoogen 2019-09-21 18:09:29 UTC
+++ This bug was initially created as a clone of Bug #1752219 +++

Description of problem:
There is extraneous output produced, making the check's output unable to be read on one line.

Version-Release number of selected component (if applicable):
nagios-plugins-disk-2.2.1-17.20190829gitfb792ff.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Upgrade from nagios-plugins-disk-2.2.1-16.20180725git3429dad.el7.x86_64 to nagios-plugins-disk-2.2.1-17.20190829gitfb792ff.el7.x86_64
2. Run check_disk with any appropriate options (e.g. check_disk -w 20 -c 10)
3.

Actual results:
dfree_units 0 0
disk_result is 0dfree_units 0 0
disk_result is 0dfree_units 0 2
disk_result is 2dfree_units 0 0
disk_result is 0dfree_units 0 0
disk_result is 0DISK CRITICAL - free space: <SNIP>

Expected results:
DISK CRITICAL - free space: <SNIP>

Additional info:
I have reported an Issue and submitted a Pull Request upstream:
https://github.com/nagios-plugins/nagios-plugins/issues/472

I used a higher severity since I have encountered monitoring solutions that used a regex against the output rather than relying on the exit code. This would break that methodology of checking the check's result, with this extra output "^DISK OK" would now be a failure.

--- Additional comment from Stephen John Smoogen on 2019-09-16 15:12:17 UTC ---



--- Additional comment from Alexander Kohr on 2019-09-16 15:50:15 UTC ---

Will be adding this to https://github.com/nagios-plugins/nagios-plugins/issues/472 as well. 

However I would also like to point out that this extraneous dfree_units lines and the 0 just before the status type also occur for an OK check, however if you do a more verbose check the extraneous 0 in the line starting with DISK looses the 0 before the status. 

/usr/lib64/nagios/plugins/check_disk -w 10% -c 5% -p /boot

I am returned 

dfree_units 0 0
disk_result is 0DISK OK - free space: /boot 315 MiB (63.43% inode=100%);| /boot=181MiB;446;471;0;496

I would expect to see  
DISK OK - free space: /boot 315 MiB (63.43% inode=100%);| /boot=181MiB;446;471;0;496



When using the -vvv  (note that between DISK and OK the extraneous 0 has disappeared and the last line is like what I would expect on a normal run.
 /usr/lib64/nagios/plugins/check_disk -vvv -w 10% -c 5% -p /boot
calling stat on /boot
Thresholds(pct) for /boot warn: 10.000000 crit 5.000000
calling stat on /boot
For /boot, used_pct=36.57 free_pct=63.43 used_units=181 free_units=315 total_units=496 used_inodes_pct=0.07 free_inodes_pct=99.93 fsp.fsu_blocksize=4096 mult=1048576
Freespace_units result=0
Freespace% result=0
dfree_units 0 0
disk_result is 0Usedspace_units result=0
Usedspace_percent result=0
Usedinodes_percent result=0
Freeinodes_percent result=0
DISK OK - free space: /boot 315 MiB (63.43% inode=100%);| /boot=181MiB;446;471;0;496

--- Additional comment from Lee Clemens on 2019-09-16 17:06:40 UTC ---

(In reply to Alexander Kohr from comment #2)
> [SNIP]
> When using the -vvv  (note that between DISK and OK the extraneous 0 has
> disappeared and the last line is like what I would expect on a normal run.
> [SNIP]
> dfree_units 0 0
> disk_result is 0Usedspace_units result=0
> Usedinodes_percent result=0
> Freeinodes_percent result=0
> DISK OK - free space: /boot 315 MiB (63.43% inode=100%);|
> /boot=181MiB;446;471;0;496

The second extraneous printf does not include a trailing newline, which is why you see it on the same line as "Usedspace_units" in the -vvv output.
The verbose Freeinodes statement has a newline and is printed afterwards  (correctly) giving you a newline before "DISK OK".

--- Additional comment from Alexander Kohr on 2019-09-16 18:06:28 UTC ---

Thank you. I had posted this prior to trying to review the code in github.  In my github post (To the link above.) I suggested that the line I think is responsible for that needed a line break after it, if the line is going to be maintained as a verbose output.

-Alex

--- Additional comment from Lee Clemens on 2019-09-17 01:41:34 UTC ---

For reference, the Pull Request has been merged:

https://github.com/nagios-plugins/nagios-plugins/pull/473

--- Additional comment from Wesley on 2019-09-20 16:45:15 UTC ---

This is also a issue on EL6 not only on EL7

> [root@webXXXXXX ~]# /usr/lib64/nagios/plugins/check_disk  -w 10% -c 5% -W 10% -K 5% -p /
> dfree_units 0 0
> disk_result is 0DISK OK - free space: / 4737 MiB (64.48% inode=79%);| /=2608MiB;6971;7358;0;7746
> 
> nagios-plugins-disk-2.2.1-17.20190829gitfb792ff.el6.x86_64

--- Additional comment from Rick Dicaire on 2019-09-21 14:46:31 UTC ---

Nor is there a yum downgrade option.
I see https://github.com/nagios-plugins/nagios-plugins/pull/473 was merged 5 days ago, but I don't see an updated pkg in yum check-update for centos 7.

--- Additional comment from Stephen John Smoogen on 2019-09-21 16:37:02 UTC ---

I do this in what spare time I have which is not a lot. You get 4 hours a weekend if I am lucky. If that is not enough, then there are several probably better resourced alternatives that you can use or pay for.

--- Additional comment from Stephen John Smoogen on 2019-09-21 17:15:52 UTC ---

And that comment was crap on my part. I am updating the spec file and trying to get builds out as we speak.

--- Additional comment from Todd Zullinger on 2019-09-21 17:49:03 UTC ---

(In reply to Stephen John Smoogen from comment #9)
> And that comment was crap on my part. I am updating the spec file and trying
> to get builds out as we speak.

Hi Smooge,

I don't know if this will save you any time now that you've started to work on it, but I worked on updating all the git branches and ran scratch builds last night.

Scratch builds:
rawhide: http://koji.fedoraproject.org/koji/taskinfo?taskID=37767647
f31:     http://koji.fedoraproject.org/koji/taskinfo?taskID=37767607
f30:     http://koji.fedoraproject.org/koji/taskinfo?taskID=37767614
f29:     http://koji.fedoraproject.org/koji/taskinfo?taskID=37767621
epel8:   http://koji.fedoraproject.org/koji/taskinfo?taskID=37771425
epel7:   http://koji.fedoraproject.org/koji/taskinfo?taskID=37771431
el6:     http://koji.fedoraproject.org/koji/taskinfo?taskID=37771435

Git repo: https://src.fedoraproject.org/fork/tmz/rpms/nagios-plugins

If that looks decent and you think it'll save  you any time or effort, I can file PR's for each branch.

Thanks for all the effort you put in on this and everything else in Fedora/EPEL.  Sorry I couldn't get these builds/PR's up sooner. :)

Comment 1 Fedora Update System 2019-09-21 18:10:19 UTC
FEDORA-2019-0179ba8205 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-0179ba8205

Comment 2 Stephen John Smoogen 2019-09-21 18:14:19 UTC
Thanks Todd. That explains why the source code I was downloading was not able to upload. I have started working on making builds

Comment 3 Fedora Update System 2019-09-21 19:45:48 UTC
FEDORA-2019-2fd0e71822 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-2fd0e71822

Comment 4 Fedora Update System 2019-09-21 19:46:07 UTC
FEDORA-2019-8259c96a3d has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-8259c96a3d

Comment 5 Fedora Update System 2019-09-22 03:01:16 UTC
nagios-plugins-2.2.2-1.20190919git00cff01.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-2fd0e71822

Comment 6 Fedora Update System 2019-09-22 03:09:38 UTC
nagios-plugins-2.2.2-1.20190919git00cff01.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-0179ba8205

Comment 7 Fedora Update System 2019-09-22 04:29:10 UTC
nagios-plugins-2.2.2-1.20190919git00cff01.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-8259c96a3d

Comment 8 Fedora Update System 2019-09-26 23:29:40 UTC
FEDORA-2019-363ede8e0e has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-363ede8e0e

Comment 9 Fedora Update System 2019-09-27 02:29:27 UTC
nagios-plugins-2.2.2-2.20190926git1b8ad57.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-363ede8e0e

Comment 10 Fedora Update System 2019-09-30 01:00:17 UTC
nagios-plugins-2.2.2-1.20190919git00cff01.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2019-09-30 01:39:12 UTC
nagios-plugins-2.2.2-1.20190919git00cff01.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2019-10-04 20:05:20 UTC
nagios-plugins-2.2.2-2.20190926git1b8ad57.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Martin Häcker 2019-10-08 11:07:42 UTC
It seems the epel packages where not updated as part of this effort - what can I do to include the epel package maintainer in the conversation? I haven't found a separate bug for that, and am not sure it is useful to open a new one?

Comment 14 Stephen John Smoogen 2019-10-08 12:15:16 UTC
Did you check epel-testing? Packages in epel-testing stay there for a long time until someone gives them karma that they work. [I am currently the maintainer all across the board.]

Comment 15 Alexander Kohr 2019-10-08 12:49:03 UTC
The check_disk in RHEL 7 epel testing is working as expected, and I don't appear to be having trouble with the other 10 plugins I am using in rhel 7. I do not have epel-testing set up in any RHEL 6 boxes.

-Alex

Comment 16 Martin Häcker 2019-10-14 09:54:11 UTC
Can confirm, the package in epel-testing works as expected and doesn't provide the extraneous output. (I'm currently looking into how to provide karma for that package)

Comment 17 Martin Häcker 2019-10-14 12:39:22 UTC
Not sure if that is the right place to give karma - I did it here https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-d5a42a332c after testing the update. Please suggest correction if wrong.

Comment 18 Stephen John Smoogen 2019-10-14 12:47:23 UTC
That is the correct place.

Comment 19 yongs123456 2019-10-16 10:22:02 UTC
What is the solution for nagios console to only show "dfree_units 0 0" in service status, instead of the disk info. 

I've tried -vvv
/usr/lib64/nagios/plugins/check_disk -vvv -w 10% -c 5% -p /boot

But nagios is still showing "dfree_units 0 0" in service status

Comment 20 Stephen John Smoogen 2019-10-16 14:46:31 UTC
@yongs123456 please ask at the nagios plugin github https://github.com/nagios-plugins/nagios-plugins . This isn't really something we can answer here. [I just compile the stuff.. ]