diskfree script doesn't seem to work.

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
GrandMasterLee
Posts: 17
Joined: Tue Jul 23, 2002 5:53 pm
Contact:

diskfree script doesn't seem to work.

Post by GrandMasterLee »

I type 'perl diskfree.pl /' and nothing gets returned to the command line.
Anyone else get that to work? TIA.

--The GrandMaster
GrandMasterLee
Posts: 17
Joined: Tue Jul 23, 2002 5:53 pm
Contact:

More info, just FYI.

Post by GrandMasterLee »

I'm using LVM on some of my volumes....but I would expect that that wouldn't cause the problem. / and /usr are not LVM, and they don't return anything either.

--The GrandMaster
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

The problem you are having is due to the fact that 'diskfree.pl' expects a device file as input:

Code: Select all

perl diskfree.pl /dev/hda1
Should output something like:

Code: Select all

4049868:30%
-Ian
GrandMasterLee
Posts: 17
Joined: Tue Jul 23, 2002 5:53 pm
Contact:

Post by GrandMasterLee »

Hrmmm...I tried that too...just after posting and looking at the code again..but nothing.

Code: Select all

My HDA5:
/dev/hda5              2091648    258968   1832680  13% /

Execute script:
$perl diskfree.pl /dev/hda5
$
That's it, nothing else. really odd.

Here is the code of diskfree.pl that I've got on my system from 0.6.8:

Code: Select all

#!/usr/bin/perl

$ret = `df --block-size=1024 $ARGV[0] | grep -v Filesystem`;
$ret =~ s/($ARGV[0])(.* )(.*[0-9])(.* )(.*[0-9])(.* )(.*[0-9])(.* )(.*[0-9]%)(.*
)//;

print "$7:$9";

TIA.
--The GrandMaster
Guest

Post by Guest »

Ok..found something odd...
I think my term is overwriting the results...I tried it with a few other scripts, like loadavg, and memfree..no output.


I added \n to the last print, and the results show up on my command line.

That's odd, but WTF. It works :-D

--The GrandMaster
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Excellent! Glad it seems to work. Make sure the scripts still work from within cacti after adding the newlines though. My first reaction tells me that they should.

-Ian
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest