Bug 57224 - diskcheck is broken and fails without warning
Summary: diskcheck is broken and fails without warning
Keywords:
Status: CLOSED DUPLICATE of bug 54578
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: diskcheck
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-12-07 10:48 UTC by daniel.deimert
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-12-13 15:55:55 UTC
Embargoed:


Attachments (Terms of Use)

Description daniel.deimert 2001-12-07 10:48:52 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)

Description of problem:
The diskcheck script is broken, it completely ignores the defaultCutoff 
setting. The administrator will never get the warning she expects to get 
from diskcheck.  

Version-Release number of selected component (if applicable): 1.0-1


How reproducible:
Always

Steps to Reproduce:
1. Install default configuration
2. Set defaultCutoff=1 in /etc/diskcheck.conf 
3. Run /etc/cron.hourly/diskcheck
	

Actual Results:  Nothing.

Expected Results:  Diskcheck was supposed to send an e-mail to root 
warning for low disk space on the host.


Additional info:

The diskcheck script is broken.  Search for "defaultCutoff" in the python 
script, and it is mentioned only once. It should clearly be used in the if-
elif comparing pct >= cutoff[volume].

It is very easy to patch the problem:

Change line 76-77

elif test or cutoff.has_key(volume):
           if test or pct >= cutoff[volume]:

to

elif test or pct >= defaultCutoff:
            high = 1



The disckcheck program is a tool supposed to warn the administrator of a 
potentially critical condition, so a rpm really should be released on 
up2date.

Comment 1 daniel.deimert 2001-12-07 12:10:59 UTC
Actually, two additional changes has to be made.      The diskcheck script 
makes string comparisons, but should really make integer comparisons.


Line 76:

 if test or pct) >= cutoff[volume]:

should to be changed to

 if test or int(pct) >= int(cutoff[volume]):


Line 76 (after the changes I described in my original bug report)

  elif test or pct >= defaultCutoff:

should be changed to

  elif test or int(pct) >= int(defaultCutoff):




Comment 2 Need Real Name 2001-12-11 09:41:26 UTC
And it reports:

>Traceback (innermost last):
>  File "/etc/cron.hourly/diskcheck", line 65, in ?
>    (volume, total, used, avail, pct, mountpt) = string.split(line)
>ValueError: unpack list of wrong size

if my "df" looks like:

[root@netzmeister root]# df
Dateisystem          1k-Blvcke    Benutzt Verf|gbar Ben% montiert auf
/dev/hda5              6048320   4130160   1610920  72% /
/dev/hda3                54447     14169     37467  28% /boot
/dev/hda8             11337564   7041000   3720636  66% /data
/dev/hda6              6048320   4395136   1345944  77% /home
/dev/hda7              1011928     16428    944096   2% /mnt/test
none                    127516         0    127516   0% /dev/shm
/dev/hdb1             39389776  35348940   2039944  95% /mnt/40gb
/dev/hdd1             19228276  15207636   3043892  84% /mnt/20gb
//synectic-spock/Raphael_C
                       9759232   7268352   2490880  75% /mnt/synectic/spock/c
//synecticgateway/daten
                      39077888  15393792  23684096  40% /mnt/synectic/gateway/daten



The problem are these lines with the first column too lonk (mounted SMB-Shares)
so the following columns gets printed on an extra line.



Solution:
---------
In /etc/cron.hourly/diskcheck change line 44 & 45 from

list = os.popen("df  %s" % ignore).readlines()
listHuman = os.popen("df -h %s" % ignore).readlines()


to

list = os.popen("df -P %s" % ignore).readlines()
listHuman = os.popen("df -hP %s" % ignore).readlines()


as you see, "df -P" forces all infos in one line and all will be fine!


Bodo

Comment 3 Harald Hoyer 2001-12-14 13:12:54 UTC

*** This bug has been marked as a duplicate of 54578 ***


Note You need to log in before you can comment on or make changes to this bug.