Sample shell script to find the disk details of remote server in linux. Here i denotes the server from 1 to 13 and shark1 is the file where the output are stored.
In Shell script you may need to disable host key checking using StrictHostKeyChecking
For more details on sshpass Click here
for i in `seq 1 1 13`; do sshpass -ftest.txt ssh -o StrictHostKeyChecking=no tester@xxx$i.example.com "hostname && df -Th " >> shark1; done
[root@test ~]# cat shark1
xxx1.
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 18G 20G 47% /
/dev/sda5 ext3 2.0G 74M 1.8G 4% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 88G 117G 43% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx2
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 22G 16G 58% /
/dev/sda5 ext3 2.0G 446M 1.5G 24% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 184G 21G 90% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx3
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 22G 15G 60% /
/dev/sda5 ext3 2.0G 47M 1.8G 3% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 143G 62G 70% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx4
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 16G 21G 44% /
/dev/sda5 ext3 2.0G 36M 1.9G 2% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 136G 69G 67% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx5
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 28G 9.0G 76% /
/dev/sda5 ext3 2.0G 1.5G 399M 79% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 186G 19G 91% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx6
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 25G 13G 67% /
/dev/sda5 ext3 2.0G 44M 1.8G 3% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 75G 130G 37% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx7
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 22G 16G 58% /
/dev/sda5 ext3 2.0G 36M 1.9G 2% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 3.7G 201G 2% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx8
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 39G 23G 15G 61% /
/dev/sda5 ext3 2.0G 44M 1.8G 3% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 167G 38G 82% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx9
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda5 ext3 39G 5.0G 32G 14% /
/dev/sda3 ext3 2.0G 36M 1.9G 2% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 2.1G 202G 2% /data
/dev/sda1 ext3 190M 18M 163M 10% /boot
tmpfs tmpfs 16G 0 16G 0% /dev/shm
xxx10
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda5 ext3 39G 15G 22G 41% /
/dev/sda3 ext3 2.0G 68M 1.8G 4% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 97G 107G 48% /data
/dev/sda1 ext3 190M 12M 169M 7% /boot
tmpfs tmpfs 7.9G 0 7.9G 0% /dev/shm
xxx11
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext3 39G 28G 9.7G 74% /
/dev/sda5 ext3 2.0G 913M 969M 49% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 91G 114G 45% /data
/dev/sda1 ext3 190M 12M 169M 7% /boot
tmpfs tmpfs 32G 0 32G 0% /dev/shm
xxx12
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext3 39G 21G 17G 55% /
/dev/sda5 ext3 2.0G 1.2G 679M 64% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 163G 42G 80% /data
/dev/sda1 ext3 190M 12M 169M 7% /boot
tmpfs tmpfs 32G 0 32G 0% /dev/shm
xxx13
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext3 39G 32G 5.7G 85% /
/dev/sda5 ext3 2.0G 956M 925M 51% /tmp
/dev/mapper/VolGroup00-data
ext3 216G 163G 42G 80% /data
/dev/sda1 ext3 190M 12M 169M 7% /boot
tmpfs tmpfs 32G 0 32G 0% /dev/shm
No comments:
Post a Comment