The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Disk Usage harikamamidala Shell Programming and Scripting 4 08-16-2007 11:22 AM
How to calculate Memory and CPU Usage on AIX asutoshch Shell Programming and Scripting 0 07-31-2007 05:28 AM
disk usage rrs Shell Programming and Scripting 1 04-13-2007 12:48 AM
Disk Usage lewisoco UNIX for Dummies Questions & Answers 3 05-09-2006 05:44 PM
Application servers, proper usage jonwillog UNIX for Dummies Questions & Answers 1 08-22-2005 06:19 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-04-2008
Registered User
 

Join Date: Jan 2008
Posts: 9
Calculate disk usage in different servers

Hello,
I'm writing a script to monitor different filesystems in multiple servers. And depending on the % free, my script will send an Alert email if % free is less than threshold.
I want to keep a input_feed_file which would have "server,filesystem".
If I run a script a host 'a', then I can find the file systems usage on that server. But I'm intrested to watch few more filesystems that are in host 'b'.

How do I find the disk usage from my script, of these filesystems which aren't on one single server.
I'm not inclined to use any monitoring tools, so I'm trying to accomplish this in one single Korn shell script.
-------------------------------------------
Example of Input file:
host_a,/export/appl/filesystem_a/
host_a,/export/appl/filesystem_b/
host_b,/export/appl/filesystem_y/
.
.
.
--------------------------------------------

Thanks in advance.
Reply With Quote
Forum Sponsor
  #2  
Old 05-04-2008
Registered User
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 183
short pseudo-code sketch:
Code:
for line in input_file
do
  server=split line ...
  dir = split line ...
  output=`ssh server du -m dir`
  usage=split output ...
  if [ usage > treshold]
  then
    do something
  fi
done
Reply With Quote
  #3  
Old 05-06-2008
Registered User
 

Join Date: Jan 2008
Posts: 9
Quote:
Originally Posted by fabtagon View Post
short pseudo-code sketch:
Code:
for line in input_file
do
  server=split line ...
  dir = split line ...
  output=`ssh server du -m dir`
  usage=split output ...
  if [ usage > treshold]
  then
    do something
  fi
done
Thanks. I knew it could be done with ssh. But I was wondering if there is any way (any command) to find out disk usage for different filesystems not mounted on the server that you're script is running.

For now I'm getting the file system usage by connecting with ssh, but the downside is, I had to get ssh keys setup on all the hosts for my app id.
Reply With Quote
  #4  
Old 05-06-2008
Registered User
 

Join Date: Mar 2008
Posts: 83
use nagios

or

invoke df -H from all server.

Regards,
Bash
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0