Linux Tip: (commands over ssh)
I have a freenas box and I like to periodically check the smart status on my drives to make sure everything’s OK. I just figured out a really sweet way to do it without lifting a finger.
You can run commands though SSH by using ' around the commands.
For example to get the smart status on one of my drives I would go like this.
ssh -l root 192.168.0.121 'smartctl -a /dev/ad0' |
This will output the results of the command on my terminal.
I can take this a step further by writing the results to a file like this
ssh -l root 192.168.0.121 'smartctl -a /dev/ad0' > /tmp/smart |
This will output the results to a txt file in my tmp directory.
I then use this command in conky to display the word PASSED or FAILED on my desktop.
cat /tmp/smart |grep overall-health |cut -c51-56 |
I plan to actually pull reallocated sectors and drive temps from this but with the output in the tmp directory you can take whatever you want.
I can see this coming in handy for all kinds of system monitoring. I never knew you could use SSH to run commands without actually logging in. You can basiclly have a separate conky instance for multiple systems on your workstations desktop.
I'm sorry but Linux rocks, Try doing this in Windows.
Share