Calculate disk usage in different servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Calculate disk usage in different servers
# 1  
Old 05-04-2008
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  
Old 05-04-2008
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  
Old 05-06-2008
Quote:
Originally Posted by fabtagon
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  
Old 05-06-2008
use nagios

or

invoke df -H from all server.

Regards,
Bash
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to calculate total number of cores on my servers ?

Hi, I want to get total number of cores on my all non-global zones on Solaris 10. I got two methods and both are giving different results. Below link is a script, which tells me that total cores are 8 Mandalika's scratchpad: Oracle Solaris: Show Me the CPU, vCPU, Core Counts and the... (4 Replies)
Discussion started by: ron323232
4 Replies

2. UNIX for Beginners Questions & Answers

Disk usage monitoring and record the disk used in last 24 hour

HI I am Trying to edit the below code to send email every day with difference of disk utilized in for last 24 hours but instead getting same usage everyday. can you please help me to point out where my calculation is going wrong. Thank you. ================= #!/bin/bash TODAY="at $(date... (0 Replies)
Discussion started by: Mi4304
0 Replies

3. Linux

How to calculate total CPU usage from SAR report?

Hi, I want to calculate the total cpu usage from the sar report. Say for example, Linux 2.6.24-21-generic (blade10) 09/10/2012 04:54:36 PM CPU %user %nice %system %iowait %steal %idle 04:54:37 PM all 0.00 0.00 0.00 0.00 ... (1 Reply)
Discussion started by: rohitmd
1 Replies

4. Linux

How to Calculate Disk Queue length and Disk Busy Time

Hi, Am doing an enhancements related to monitoring a Linux disk I/O statistics. The /proc/diskstats file is used to get the each disk I/O statistics. But, It returns the raw value. How to calculate the Disk Queue Length and Disk Busy time from the raw values. Guide me. (1 Reply)
Discussion started by: maruthu
1 Replies

5. Shell Programming and Scripting

calculate swap space usage in Solaris and converts it in Percentage

Hi Folks, I am looking for a way to write a script to calculate swap usage in Solaris so that the current usage will be shown in Percentage value. Thanks!! Based on 'swap -s' command # swap -s total: 1378936k bytes allocated + 1236880k reserved = 2615816k used, 2725104k available (2 Replies)
Discussion started by: jaapar
2 Replies

6. Shell Programming and Scripting

Grep string from logs of last 1 hour on files of 2 different servers and calculate count

Hi, I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files. File structure is same on both servers and for reference as follows: 27-Aug-2010... (4 Replies)
Discussion started by: poweroflinux
4 Replies

7. Shell Programming and Scripting

calculate usage from file

Hello folks, i have a file courierimapuiddb that have contents like 1 1280206508 4 1 1280206466.V805I169cM853838.xxx 2 1280207962.V805I16d5M343672.xxx 3 1280208055.V805I16d6M20816.xxx 1280206508 above means total size and its decreasing when file added in directory. when total... (8 Replies)
Discussion started by: learnbash
8 Replies

8. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

9. UNIX for Dummies Questions & Answers

Need to calculate sftp time beteen two servers.

Hi, I need to calculate time taken by a 100kb file for sftp between two servers. I am new to unix can some body please tell me how do this. Thanks in advance... Vivek (2 Replies)
Discussion started by: koulvivek
2 Replies

10. Shell Programming and Scripting

How to calculate Memory and CPU Usage on AIX

I have written a script that will calculate CPU usage and Memory usage of a particular process on AIX Unix. I know the PID and I am using the command -- # for CPU Usage MSG_CPU_USG=`ps uax | grep ${PID} | awk {'print $3'}` #for Memory Usage MSG_MEM_USG=`ps uax | grep ${PID} | awk {'print... (0 Replies)
Discussion started by: asutoshch
0 Replies
Login or Register to Ask a Question