Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Apr 2005 18:05:24 -0700
From:      "Zoltan Frombach" <tssajo@hotmail.com>
To:        <freebsd-ports-bugs@freebsd.org>
Cc:        vinc@freebsd-fr.org
Subject:   please add these patches to cacti port
Message-ID:  <BAY103-DAV15B3D118A4D1FC7666A92DDF250@phx.gbl>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0021_01C54CE6.045DC390
Content-Type: text/plain;
	format=flowed;
	charset="iso-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit

Hello,

I attached two patches for the FreeBSD cacti port. This is something that 
annoyed me for a long time, and I've decided to do something about it... In 
Cacti, if you use the provided "diskfree.pl" and/or "diskfree.sh" scripts 
then all hard drive sizes are reported DOUBLE (x2) in Cacti (under FreeBSD 
only). This is a documented problem, see 
http://forums.cacti.net/viewtopic.php?t=2420&highlight=disk+space+wrong  The 
scripts supplied in Cacti that use the df system command must be changed. 
Cacti was originally developed for Linux (I guess), and under Linux the 
following df command is producing the expected output:

df --block-size=1024

However, this DOES NOT work under FreeBSD. You must change it to:

df -k

This is exactly what the attached patches do. Therefore solving the disk 
space reporting problem outlined on the above mentioned URL. Please include 
these patches in the FreeBSD port of Cacti. Thanks,

Zoltan Frombach 

------=_NextPart_000_0021_01C54CE6.045DC390
Content-Type: application/octet-stream;
	name="patch-scripts-diskfree.pl"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="patch-scripts-diskfree.pl"

--- scripts/diskfree.pl.orig	Fri Apr 29 17:32:01 2005
+++ scripts/diskfree.pl	Wed Mar 23 02:19:37 2005
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
=20
-$ret =3D `df --block-size=3D1024 -P $ARGV[0] | grep -v Filesystem`;
+$ret =3D `df -k $ARGV[0] | grep -v Filesystem`;
 $ret =3D~ s/($ARGV[0])(.* )(.*[0-9])(.* )(.*[0-9])(.* )(.*[0-9])(.* =
)(.*[0-9])%(.* )//;
=20
 print "megabytes:$7 percent:$9";

------=_NextPart_000_0021_01C54CE6.045DC390
Content-Type: application/octet-stream;
	name="patch-scripts-diskfree.sh"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="patch-scripts-diskfree.sh"

--- scripts/diskfree.sh.orig	Fri Apr 29 17:32:01 2005
+++ scripts/diskfree.sh	Wed Mar 23 02:19:47 2005
@@ -1,2 +1,2 @@
 #!/bin/sh
-df --block-size=3D1024 -P $1 | perl -ape '$F[4]=3D~tr/%//d;}{print =
"megabytes:$F[3] percent:$F[4]"';
+df -k $1 | perl -ape '$F[4]=3D~tr/%//d;}{print "megabytes:$F[3] =
percent:$F[4]"';

------=_NextPart_000_0021_01C54CE6.045DC390--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BAY103-DAV15B3D118A4D1FC7666A92DDF250>