LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2013, 01:08 AM   #1
linuxque
LQ Newbie
 
Registered: Dec 2011
Posts: 3

Rep: Reputation: Disabled
check disk space of multiple computers in a network


Hi,
Can I get the output of df -h of multiple systems in the network by a command or a script rather than checking each system.
For eg: Specifying the range of ip addresses viz..192.168.1.x to 192.168.1.x ...something like that.

Thanks,
Linuxque
 
Old 01-21-2013, 02:54 AM   #2
tsester
Member
 
Registered: Dec 2011
Distribution: Gentoo
Posts: 47

Rep: Reputation: 2
to get remote df you can do : ssh $REMOTE_IP $COMMAND, for example ssh 192.168.0.2 df -h
 
Old 01-21-2013, 05:01 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
For just one time checking and if you can enter password each time with ssh command, you can:
Code:
#!/bin/bash
IPLIST=/tmp/listofips # Contains a list of ip addresses, each per line
RESULTFILE=/tmp/dfresult.txt
while read -r ip
do
echo "$ip" >> $RESULTFILE
echo "-------------------" >> $RESULTFILE
ssh username@$ip "df -h" >> $RESULTFILE # It will ask for username's password everytime it executes
echo "-------------------" >> $RESULTFILE
done < $IPLIST
On the other hand, if you want to do it daily or periodically (like automation or cronjob), you better go with concept of password less login on those system and then execute this script.

Last edited by shivaa; 01-21-2013 at 05:04 AM. Reason: Code modified
 
2 members found this post helpful.
Old 01-22-2013, 05:51 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Wheel reinvention-wise there's tools dealing with ^whatever.on.*multiple hosts like ClusterSSH, Dsh, Fanout / Fanterm, Tentakel, Shocto, SwitchTower, MUC, Parallel SSH and RGANG. Going a whole different route getting stats without even requiring SSH or password-less logins is possible too with a simple (X)inetd-based script or using SNMP.
 
Old 01-22-2013, 12:15 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Additionally, one can simply set up a network monitoring program such as Nagios or Zenoss to check the status and health of multiple computers, send alerts, etc. Ultimately, this is the most scalable solution, but it requires a bit more work up front to get going.
 
Old 01-22-2013, 12:45 PM   #6
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Rep: Reputation: 119Reputation: 119
+1 nagios. I'm running a few servers (backup server, DNS servers, web Servers, Monitor servers) and I have 1 simple login to nagios which gives me the load, diskspace, login users, etc on a charge through nrpe plugin.

its simple to install but may be a little tough to configure at first but once you understand it becomes easy and highly configurable. It will all email notifications such as low diskspace. nagios doesn't use much resources at all either.
 
  


Reply



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 check the whole disk space? thomas2004ch Linux - Newbie 7 08-06-2012 05:41 AM
[SOLVED] how to check disk space mario.almeida Linux - Server 8 09-26-2010 06:16 AM
ran df to check space and multiple /etc? spooge Slackware 7 11-22-2009 02:54 AM
How do you check disk space? verlaine Linux - Software 4 11-12-2006 01:57 PM
How do you check disk space? tim1348 Linux - Newbie 10 10-31-2006 09:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:07 PM.

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