Advertisement

01.25.2008 at 02:51PM PST, ID: 23112630
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Health monitor script for unix filesystems without use of any perl modules
Tags: Perl Script
Hi, Can some one post me or send me the perl script which can be used to monitor the diskspace of unix filesystems. Please note not to use any of the perl modules.
1. Please note that this perl script should send out a mail in case the unix filesystem diskspace reaches threshold
2. Should be able to provide the statistics such as disk free available, disk free used, Total disk freespace etc.
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: gravindra1977
Solution Provided By: Adam314
Participating Experts: 2
Solution Grade: A
Views: 73
Translate:
Loading Advertisement...
01.25.2008 at 02:57PM PST, ID: 20747112

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.25.2008 at 03:09PM PST, ID: 20747197

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.25.2008 at 04:47PM PST, ID: 20747775

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.26.2008 at 04:59PM PST, ID: 20751863

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.26.2008 at 05:04PM PST, ID: 20751877

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2008 at 03:53AM PST, ID: 20776222

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2008 at 07:56AM PST, ID: 20777986

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2008 at 03:18PM PST, ID: 20782569

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2008 at 04:32PM PST, ID: 20783004

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2008 at 06:14PM PST, ID: 20783375

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2008 at 06:31PM PST, ID: 20783436

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2008 at 07:20AM PST, ID: 20787371

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2008 at 01:03PM PST, ID: 20791099

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2008 at 01:55PM PST, ID: 20791641

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2008 at 02:07PM PST, ID: 20791770

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2008 at 02:21PM PST, ID: 20791908

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2008 at 06:19PM PST, ID: 20793558

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2008 at 08:04PM PST, ID: 20794120

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.01.2008 at 09:16AM PST, ID: 20798501

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
01.25.2008 at 02:57PM PST, ID: 20747112

Rank: Sage

Why Perl?
Why no additional modules?
What Unix flavours will you be monitoring?
 
01.25.2008 at 03:09PM PST, ID: 20747197
Perl because it is the standard in our org and all the other scripts are written in perl.
I donot want use the FileSys::diskspace or Filesys:df. Perhaps if there are any standard modules which comes along with the perl installation, we could use them
Unix flavours that should be supported are HP UX, Solaris
 
01.25.2008 at 04:47PM PST, ID: 20747775

Rank: Sage

I don't really understand why you don't want to use any additional modules, as the Sys::Filesystem module would be perfect for this job. Anyway.....


Are you monitoring just the local filesystems?  Then you could do something along the lines of:


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
#!/usr/bin/perl
use strict;
my $uname = `uname -s`;
chomp $uname;
 
if ($uname eq 'Linux' or $uname eq 'Solaris') {
  open DF, "df|" or die "Can not run df $!\n";
 
  while (<DF>) {
    next unless /\//;
    my ($dev,$total,$used,$free,$percent,$fs) = split;
    # Do whatever calculation you need based on the figures
  }
}
Open in New Window
 
01.26.2008 at 04:59PM PST, ID: 20751863
Ok thanks, Can you post me code using any of the modules?
 
01.30.2008 at 03:53AM PST, ID: 20776222
Hi,
Could anyone point me in right direction
I tried to install the Filesys::Diskspace module and I got an error, "An error occured. statvfs failed. Did you run h2ph?" It said skipped t/linuxbsd and validation failed.
I want the following logic to be written . Please provide me with complete code. I am new to perl scripting and just started to learn. Hence request you to please provide me with the complete code.
Help is greatly appreciated.

Argument to be passed will be an environment [ Either DEV,QA or PROD]

Logic:

check the environment passed as an argument
If environment passed is DEV
set unix-file-system to FSDEV
else if environment passed is QA
then unix-file-system to FSQA
else if environment passed is PROD
then unix-file-system is FSPRD
end if

Set threshold to 10%

Get the total space, total used and total unused disk space on the unix-file-system set above.
Calculate the % of unused space.
If it falls below threshold then
 send a mail /exit with non-zero
end if

Loop thru all the filesystems
Check the unused space for all the filesystems which are of uXX  i.e., /u01, /u02, /u03 [ Basically trying to get space of the filesystems where oracle is installed]
Log the unused space of these filesystems in a log file
If any of these falls below threshold,
  send a mail / exit with non-zero
end if

Thanks,
RAVI
 
01.30.2008 at 07:56AM PST, ID: 20777986

Rank: Genius

Here is a version.  It uses parts from Tintin's code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
 
my $sendmail = '/usr/bin/sendmail';
my $from     = 'me@company.com';
my $to       = 'you@company.com';
 
my %env_to_fs =
  (DEV  => 'FSDEV',
   QA   => 'FSQA',
   PROD => 'FSPRD',
   );
 
#Get argument, set $fs
my $fs_arg = shift;
die "Usage: $0 <Environment>\n" unless $fs_arg;
die "Invalid environment, it must be one of: " . join(", ", keys %env_to_fs) . "\n" unless exists($env_to_fs{$fs_arg});
my $fs = $env_to_fs{$fs_arg};
 
 
 
my $exitcode=0;
 
open DF, "df|" or die "Can not run df $!\n";
<DF>;   #Get header line
 
#Get all other lines
while (<DF>) {
	my ($dev,$total,$used,$free,$percent,$fs) = split /\s+/;
	if($dev =~ m!($fs|/u\d+)!) {
		if($free/$total < .1) {
			$exitcode=1;
			open(SM, "$sendmail -t") or die "Could not open sendmail: $!\n";
			print SM "From: $from\n";
			print SM "To: $to\n";
			print SM "Subject: Device $dev is low on space\n";
			print SM "\n";
			print SM "The device $dev is low on space:\n";
			print SM "  Total: $total\n";
			print SM "  Used : $used\n";
			print SM "  Free : $free\n";
			close(SM);
		}
	}
}
 
close(DF);
 
exit($exitcode);
Open in New Window
 
01.30.2008 at 03:18PM PST, ID: 20782569
Thanks , this is fantastic. Do we need to install the perl module Data::Dumper for this and how/where is it been used in the above code?
 
01.30.2008 at 04:32PM PST, ID: 20783004

Rank: Genius

The module is usually installed by default.  However, it isn't used in this script, and that line can be removed.

I left in in from a previous script, and forgot to remove that line.
 
01.30.2008 at 06:14PM PST, ID: 20783375
Wonderful !! This is exactly what I require. Can we also write all the info into a report file which would be in specific directory. Bascially this report should contain the all the data that we are capturing like diskspace total, allocated, free etc for FSPRD and other /uXX filesystems. At the end of program it should close this report file. Also can we put an log file which can capture all the errors that may be obtained during the run of the program. Again thanks very much for your input.
 
01.30.2008 at 06:31PM PST, ID: 20783436
Another thing is I am getting the following output if I print total, used and free
The filesystem is :  /u01
  Total: (/dev/vx/dsk/oradg/u01):21596644
  Used : blocks
  Free : 3254247
and hence it is coming as
Argument "(/dev/vx/dsk/oradg/u01):21596644" isn't numeric in division.
Illegal division by zero at df.pl line 33, <DF> line 10.

I put the following lines after
"if($dev =~ m!($fs|/u\d+)!) {"

print "The filesystem is :  $dev\n";
                print "  Total: $total\n";
                print "  Used : $used\n";
                print "  Free : $free\n";

and the output I am getting is as below:

The filesystem is :  /u01
  Total: (/dev/vx/dsk/oradg/u01):21596644
  Used : blocks
  Free : 3254247

Please advice. Probably split is not done properly, I guess. Please advice.

Thanks a lot again
 
01.31.2008 at 07:20AM PST, ID: 20787371

Rank: Genius

What is the output from df?
(go to a terminal/prompt, type df, press return)
 
01.31.2008 at 01:03PM PST, ID: 20791099
Output from df is as follows: Also attached the file for the same.

/                  (/dev/vx/dsk/bootdg/rootvol): 3533744 blocks   417512 files
/proc              (/proc             ):       0 blocks    29421 files
/etc/mnttab        (mnttab            ):       0 blocks        0 files
/dev/fd            (fd                ):       0 blocks        0 files
/var               (/dev/vx/dsk/bootdg/var): 3843060 blocks   489235 files
/var/run           (swap              ):39591600 blocks  3219307 files
/dev/vx/dmp        (dmpfs             ):39591600 blocks  3219307 files
/dev/vx/rdmp       (dmpfs             ):39591600 blocks  3219307 files
/tmp               (swap              ):  960928 blocks  3219307 files
/redo002           (/dev/vx/dsk/orardodg02/redo002):104745016 blocks  7188431 fs
/u01               (/dev/vx/dsk/oradg/u01):21100702 blocks  3254641 files
/stage             (/dev/vx/dsk/oradg/stage):24403074 blocks  1793502 files
/redo001           (/dev/vx/dsk/orardodg01/redo001):104510852 blocks  7188416 fs
/u008              (/dev/vx/dsk/oradatdg02/u008):177416744 blocks 14376930 files
/arch001           (/dev/vx/dsk/oraarcdg01/arch001):224134440 blocks 28746140 fs
/uhcdba            (/dev/vx/dsk/oradg/uhcdba):57641054 blocks  7181513 files
/u006              (/dev/vx/dsk/oradatdg01/u006):168425668 blocks 14376890 files
/u007              (/dev/vx/dsk/oradatdg02/u007):16914724 blocks 14376720 files
/u003              (/dev/vx/dsk/oradatdg01/u003):91315850 blocks 14376878 files
/u005              (/dev/vx/dsk/oradatdg01/u005):182653128 blocks 14376909 files
/u004              (/dev/vx/dsk/oradatdg01/u004):115505694 blocks 14376872 files
/u009              (/dev/vx/dsk/oradatdg03/u009):53605372 blocks 14376936 files
/u010              (/dev/vx/dsk/oradatdg03/u010):87544968 blocks 14376923 files
/OAPDEV            (nasgw010pn:/vol/eagan15/oapdev):53315504 blocks 31712083 fis
/u011              (/dev/vx/dsk/orau011dg/u011):40284380 blocks 14376919 files
/u012              (/dev/vx/dsk/orau012dg/u012):12841628 blocks 14376924 files
/u013              (/dev/vx/dsk/orau013dg/u013):189903986 blocks 14376917 files
/u014              (/dev/vx/dsk/orau014dg/u014):202216442 blocks 14376934 files
/u015              (/dev/vx/dsk/orau015dg/u015):202640584 blocks 14376934 files
/INTERFACES_SIMS/SIMSDEV(nasgw010pn:/vol/eagan17/simsdev): 2097152 blocks 31320s
/uhtrels           (/dev/vx/dsk/rootdg/uhtrels): 4306766 blocks   362072 files
/prdctl            (/dev/vx/dsk/rootdg/prdctl): 1151956 blocks   291716 files
/home              (/dev/vx/dsk/bootdg/home): 1231912 blocks   517025 files
 
df output from terminal
 
 
01.31.2008 at 01:55PM PST, ID: 20791641

Rank: Genius

I'm not familiar with that format for the output of df.  It looks like it is giving only the total size and total number of files.

Are you familiar with the df command?  Do you know of an option on your system to have it print any 2 of: total, used, free?

If not, post the man page from df.
(at a prompt:   man df > man_df.txt, then post the man_df.txt here)
 
01.31.2008 at 02:07PM PST, ID: 20791770
Please find file attached of man_df.txt
 
Man of df command
 
 
01.31.2008 at 02:21PM PST, ID: 20791908

Rank: Genius

It looks like you need:    df -k

In the script, on line 26, replace "df|" with "df -k|".

If that doesn't work, post the output from   df -k  at a prompt.
 
01.31.2008 at 06:19PM PST, ID: 20793558
It did not work. The ouput shown is as below

The filesystem is :  /dev/vx/dsk/bootdg/rootvol
  Total: 4138926
  Used : 2372054
  Free : 1725483
The filesystem is :  /proc
  Total: 0
  Used : 0
  Free : 0
Illegal division by zero at df.pl line 33, <DF> line 3.

/proc should not have gone thru if condition. I am not sure how it did pass through. Also I am attaching output of df -k from the prompt.
 
output of df -k at prompt
 
 
01.31.2008 at 08:04PM PST, ID: 20794120
I tried to print all the filesystem, total, used, avail, capacity, mounted on using df -k and after the split correct values are coming in. Please see the attached output file. But even for the filesystem /proc and / , the if statement seems statisify and hence resulting in the error. Probably the if condition is incorrect. Can you please check that and let me know . Many thanks for your help.

I have added the code snippet as well. Please verify.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
#!/usr/bin/perl
use strict;
use warnings;
 
my %env_to_fs =
  (DEV  => 'OAPDEV',
   QA   => 'OAPQA',
   PROD => 'OAPPRD',
   );
 
#Get argument, set $fs
my $env_arg = shift;
die "Usage: $0 <Environment>\n" unless $env_arg;
die "Invalid environment, it must be one of: " . join(", ", keys %env_to_fs) . "\n" unless exists($env_to_fs{$env_arg});
my $fs = $env_to_fs{$env_arg};
 
 
 
my $exitcode=0;
 
open DF, "df -k|" or die "Can not run df $!\n";
<DF>;   #Get header line
 
#Get all other lines
while (<DF>) {
	print;
	my ($dev,$total,$used,$free,$percent,$fs) = split /\s+/;
	print "DEV: $dev\n";
         print "TOTAL: $total\n";
	print "Used : $used\n";
	print "free : $free\n";
	print "percent: $percent\n";
	print "fs: $fs\n";
 
	#if($dev =~ m!($fs|/u\d+)!) {
	#	print "The filesystem is :  $dev\n";
	#	print "  Total: $total\n";
	#	print "  Used : $used\n";
	#	print "  Free : $free\n";
 
	#	if($free/$total < .1) 
	#	{
	#		$exitcode=1;
	#	}
	#}
}
close(DF);
exit($exitcode);
Open in New Window
 
output of the program
 
 
02.01.2008 at 09:16AM PST, ID: 20798501

Rank: Genius

The problem is $fs is used twice, line 15 and line 27.  One of these needs to have a different name.
    Change the $fs in line 15 to $fs_arg
    Change the $fs in line 35 to $fs_arg
Accepted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628