It feels like I have taken on to of a big task.. but I want to learn but dont know where to start.. Rome wasnt built in one day right..
I have around 30+ servers running linux/unix flavours and need to be able to do this in a script that will be a cronjob.
- ssh to all 30+ servers
- do df -kh
- save server name and result to TodaysDate.log
- check result if diskspace/partition is less then 20%
- send an email if the above is true.
Bare in mind I have never written any advanced scipt.. so this is probably simple for you h4x0rs out there..
In my head
SERVERLIST=servers.txt
SSH first hit from servers.txt
ssh
user@server.lan df -kh
save result in Todaysdate.log
move to next server in list
if no more server then check todaysdate.log
if space is less then 20% then
email
admin@n00badmin.com
end
not sure I will be able to do ssh keys on every machine.. so an option would be to save the pwds in a file.. its a closed LAN.. its sounds bad I know but if I could start with that..