LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Checking the disk usage of different linux servers using df -h linux command (https://www.linuxquestions.org/questions/linux-newbie-8/checking-the-disk-usage-of-different-linux-servers-using-df-h-linux-command-780513/)

jhunex909 01-07-2010 06:09 AM

Checking the disk usage of different linux servers using df -h linux command
 
Anybody knows how to Check the disk usage of different linux servers using df -h linux command. My host server is 66.50.100.1, I can check its disk usage by using df -h command. I got my disk usage. Now using my host server Im going to check the server 66.50.100.3 disk usage. Is its possible to check the disk usage of 66.50.100.3 using my host server?. Please advice... Thanks..

zQUEz 01-07-2010 06:34 AM

Create an ssh rsa key, with no passphrase, on the remote host(s).
Then from your server, ssh into that server using the private identity file and throw a single command:

`ssh accountname@66.50.100.3 "df -h"`

kirukan 01-07-2010 06:39 AM

Do you want to check disk usage periodically for all of your remote servers? Don't you use any monitoring tools like nagios, openNMS, MRTG etc

jhunex909 01-07-2010 11:59 PM

Thanks zQUEz and Kirukan.. I think ssh accountname@66.50.100.3 "df -h" is the one good answer to my problem. Create an ssh rsa key, with no passphrase, on the remote host(s) How can I do this one?.

Thanks for the advice..

zQUEz 01-09-2010 07:07 AM

assume server=66.50.100.1, remotesvr=66.50.100.3
On remotesvr, run `ssh-keygen` and follow the prompts to create an rsa-id. When asked for a passphrase, just press enter as you don't want a passphrase. You should end up with 2 files. One will be "something.pub" and the other maybe id-rsa or whatever you told it to call it. The .pub file will be 1 long line (might break across rows) and is the public key.
Still on remotesvr, (and ssh-keygen may have done this for you, i can't remember),
`mkdir ~/.ssh~
`chmod 700 ~/.ssh`
copy the .pub file above, and rename it to "~/.ssh/authorized_keys2".
`chmod 600 ~/.ssh/authorized_keys2`.
Copy the rsa-id file to server and call whatever you like. You should keep this file secure.

On server, ssh into remotesvr using the command: `ssh -i rsa-id usera@remotesvr` - the first time you will have to confirm the remote ID. This is a one time thing.


All times are GMT -5. The time now is 11:53 AM.