How to monitor remote Linux machines and retrieve installed software in Perl?

I have a couple of Perl scripts that allow me to monitor remote Windows machinses through WMI. Right now I can check CPU usage, Memory usage, Disk usage and Installed Software. But what if I want to do the same job on a remote Linux machine? Ofcourse there's no WMI so I guess I shall use something similar. I have read on another old StackOverflow question that Linux exposes informations through /proc and /sys but can I query them from a remote computer? And how can I do that exactly in Perl? Is there a dedicated module?

EDIT: Just to clarify, the script MUST be agent-free.

Answers


Check these :

http://www.net-snmp.org/docs/mibs/host.html

http://www.oidview.com/mibs/0/RFC1213-MIB.html

This will give you memory / disk usage :

snmptable -v1 -c public localhost hrStorageTable
snmptable -v1 -c public localhost .1.3.6.1.2.1.25.2.3

This will give you processor utilisation :

snmptable -v1 -c public localhost hrProcessorTable
snmptable -v1 -c public localhost .1.3.6.1.2.1.25.3.3

Interface Status :

snmptable -v1 -c public localhost ifTable
snmptable -v1 -c public localhost .1.3.6.1.2.1.2.2

If you use rpm-based linux, this will give you installed software :

snmptable -v1 -c public localhost hrSWInstalledTable
snmptable -v1 -c public localhost .1.3.6.1.2.1.25.6.3

You can make this work for .deb flavours of linux :

http://community.zenoss.org/blogs/zenossblog/2009/02/18/tip-of-the-month-snmp-software-inventory-for-debian-and-ubuntu-machines

Sample output of `snmptable -v1 -c public localhost hrProcessorTable`

        hrProcessorFrwID hrProcessorLoad
 SNMPv2-SMI::zeroDotZero              54
 SNMPv2-SMI::zeroDotZero              22

On the box you are querying, does public have read access to .1.3.6.1.2.1.25 ?

You may need to add something like this to your /etc/snmp/snmpd.conf

com2sec monitor  default         monitor

group monitorGroup v1      monitor
group monitorGroup v2c     monitor

view hardware included .1.3.6.1.2.1.25
view hardware included .1.3.6.1.2.1.2

access monitorGroup ""      any       noauth    exact  hardware    none    none

The restart snmpd

Then specify -c monitor in the commands above instead of -c public


Need Your Help

Global struct memory error

c struct heap valgrind libconfig

My program's reading from config file using libconfig and saving values to the global struct. It's working fine but valgrind says there's error. And the error only shows for char pointer variable. ...

PDO Connection First Query Delay

php mysql pdo

I have a site which uses PHP's PDO library to access a mysql database. The mysql database is highly optimised and has all the suitable indexes to make the queries fast and so on. I am encountering ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.