Perl script that will remotely ssh to linux and get memory status back to my machine

Posted on

Perl script that will remotely ssh to linux and get memory status back to my machine – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, ssh, remote, perl, memory-usage.

I need help. I have Linux box (openSUSE 11.4); writing Perl script (Perl 5, version 12).
My script should SSH to the remote Linux machine and get back with the memory results.
So far, I have SSH working with DSA private key for passwordless connection.
Now I’m stuck with getting memory.

I tried to use Filesys::DiskSpace module, but I have some trouble while installing this module. Guess it will not work.

Any help will be appreciated!

Thanks in advance!

Solution :

Why bring perl into the mix? This is just a single-line deal:

$ ssh user@host free

Just execute cat /proc/meminfo on the target machine to retrieve all informations about the current memory usage you could get from the system.

Leave a Reply

Your email address will not be published.