The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 02:22 PM
How to calculate Memory and CPU Usage on AIX asutoshch Shell Programming and Scripting 0 07-31-2007 08:28 AM
disk usage rrs Shell Programming and Scripting 1 04-13-2007 03:48 AM
Disk Usage lewisoco UNIX for Dummies Questions & Answers 3 05-09-2006 08:44 PM
Application servers, proper usage jonwillog UNIX for Dummies Questions & Answers 1 08-22-2005 09:19 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-04-2008
bperl bperl is offline
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.
  #2 (permalink)  
Old 05-04-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
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
  #3 (permalink)  
Old 05-06-2008
bperl bperl is offline
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.
  #4 (permalink)  
Old 05-06-2008
learnbash learnbash is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 96
use nagios

or

invoke df -H from all server.

Regards,
Bash
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0