2

I'd like to write my own server monitoring app. Ideally it could show stats like load, uptime, cpu activity, most active processes, memory usage by process, etc. What's the best way to grab that information from the server? I was initially thinking of running ssh -e commands, but wanted to see if there was a more efficient way than polling the server.

Alternatively, would it be best to tie into data that's being aggregated by Munin or a similar monitoring tool?

UPDATE

To be more clear, I'm mainly interested in the best way to get the sorts of data mentioned above from a server so I can render it in an Android app I'm interested in building. Writing the actual probes on the server itself isn't really in the domain of work I want to do, which is why I'm hoping Nagios or something similar might already provide the data im looking for. I would just need to pull that data and render it in my own tool.

Brian Wigginton
  • 745
  • 1
  • 6
  • 9

3 Answers3

4

One way to handle this is by running an snmp agent on your servers, and collecting the results with something like munin or cacti. Here's a decent cacti tutorial which explains how to set up the net-snmp agent on a linux box.

The advantage of using snmp is it's a lowest common denominator reporting mechanism for network devices. Almost all networked devices can be configured to run an snmp client (except for very low end consumer switches and routers). Thus if you use snmp to monitor your linux machines it's simple to also use snmp to monitor your switches, routers, networked printers, etc. In general you will poll the devices on a regular interval.

Note that the older version of the snmp protocol (2c) is quite insecure. To deal with that many people just set up the snmp agent to run read-only. In practice, as long as you are using read-only snmp on your internal network the security risk is low. However you should be aware of the limitations of the snmp security model before using it.

Phil Hollenback
  • 14,947
  • 4
  • 35
  • 52
1

I'd probably suggest that you look at what is already done, instead of trying to re-invent the wheel. I find that Nagios does pretty good, and provides a base from which you can easily extend the monitoring points. The agents do communicate using secure protocol but are configured to the functionality that you need.

mdpc
  • 11,856
  • 28
  • 53
  • 67
  • See my update above. Would I be able to pull the data out of Nagios easily? I would just want it for it's data, not so much all it's reporting and monitoring. – Brian Wigginton Nov 01 '11 at 19:31
1

Your starting at the wrong place. What you monitor is less important than how you monitor it. The former will always change, you need to start with a system which:

  • schedules the running of the probes
  • invokes appropriate probes for the targets
  • collates the results
  • provides real time alerts,
  • trend reporting
  • dashboards

There are lots of tools available off-the-shelf which provide the above and usually come bundled with all sorts of standard probes. I like Nagios due to its clear seperation between the probes and the scheduling/reporting engine - which makes it trivial to add additional probes, and has a big library of pre-written probes and add-ons (the default dashboard is not that great IMHO, but writing my own was easy).

symcbean
  • 21,009
  • 1
  • 31
  • 52