views:

252

answers:

1

I have a couple of linux (ubuntu) servers that work together every night to do some heavy processing. Say. I have 2 worker servers and 1 big indexing server. The worker servers feed the indexing server. The indexing server operates under a high load (based on input it's getting from the worker-servers.)

I would like to be able to let the worker-servers work at a speed as a function of the load of the indexing-server, so to ensure the maximum throughput. I know throughput is influcened by other factors but the indexing server is essentially cpu-bound and a rough guide (so I m told) is to ensure that measured load roughly equals the nr of real processors in the indexing server.

For this I need to periodically query the load (10secs? , 1min , 5min or something) of the indexing server fro within a worker-application running on a worker-server.

Now, I would need a monitroing solution like Nagious or Munin for the near future anyway, so was wondering how to use one or the other to query stats from within an application?

Thanks, Britske

+1  A: 

If your needs are that basic, you might consider just using SNMP. Most Linux distros will have a snmp-devel, php-snmp (or pretty much every other language) API to easily parse the data.

A pitfall that I once ran into, heavily loaded servers sometimes have slow network I/O, so API calls to get info on remote machines might block up till a timeout occurs. You might consider devoting a single child / thread just to the task of watching the others.

The other option is having something on each server curl()ing (or other methods) its vitals to some location where the rest can read. Since it sounds like you mostly need the contents of /proc/loadavg and /proc/meminfo, that might be better.

Tim Post