LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-29-2011, 12:28 AM   #1
priyophan
Member
 
Registered: Apr 2009
Posts: 36

Rep: Reputation: 0
Create disk space alerts


#!/usr/bin/perl
use Term::ANSIColor;
####TIME DETAILS ######
print colored ( "PLEASE SPECIFY HOURS FOR THE FILESIZEREPORT TO RUN \n", ' bold green on_blue' );
$hrstorun = ;
chomp ($hrstorun);
print colored ( "PLEASE SPECIFY INTERVAL (min) FOR THE FILESIZEREPORT TO RUN \n", ' bold green on_blue' );
$intmin = ;
chomp ($intmin);


####END TIME #####
$count = $hrstorun*60/$intmin;
$interval = $intmin*60;
#print "Free Space ";
for ($c=0; $c < $count; $c++ )
{
sleep $interval;

&frespacetest;

$Free = FreeSpace;
select undef, undef, undef, 0.25;
print "\r";
printf ("%10s%20s",$Free ,$frsp );
}
}
###SUBROUTINES ###

{
sub frespacetest
{
$x = `dfoutputscript `;
@freesp = split(' ',$x);
$frsp = ("%s\n",$freesp[3]);
if ( $frsp <>
{
print " FREE SPACE IS BELOW THRESHOLD\n"; ##SEND MAIL OR ALERT##
}
if (!$frspini)
{
$frspini = $frsp;
}
else
{
$frspfinal = $frsp;
if ($frspini > $frspfinal)
{
$deltafrsp = $frspini - $frspfinal;
$frspini = $frspfinal;
if ( $deltafrsp > 1 )
{
print "FREE SPACE DECREASING AT HIGH RATE \n";##SEND MAIL OR ALERT##
}
}
}
}
}
 
Old 03-29-2011, 02:48 AM   #2
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Rep: Reputation: Disabled
Bookmarking.
Thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Create Disk Space Quota JustinK101 Linux - Server 2 05-26-2010 02:28 AM
Cedega "Disk space required for the installation exceeds available disk space" Solved Spewdemon LinuxQuestions.org Member Success Stories 1 10-18-2007 07:19 PM
LXer: Create Custom Weather Alerts LXer Syndicated Linux News 0 06-12-2007 01:01 AM
Need to create more disk space for linux. tommy12 Linux - General 2 08-31-2006 08:01 AM
3Gb of disk space lost! Disk space problem or mother board conflicts with HDD Mistreated Linux - Hardware 4 12-06-2004 04:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration