Simple tool to graph memory usage?

Posted on

Simple tool to graph memory usage? – 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, memory, performance-monitoring, , .

Is there a script that will show memory usage as a graph, for example as a pie-chart, with each process being being a separate slice?

I’m not looking for something like Munin to graph memory usage over time, but rather show the memory usage per-process at a single point in time.

To make my request even more obscure, it is for a headless server (so no X applications). The simplest way would be to write a PNG file, or possibly an HTML file (which could use Javascript to allow the filtering of processes, changing between graph-types and so on)

Solution :

Per process memory accounting is tricky for a number of reasons I’ll get into in a minute. For simple monitoring, gkrellmd, or nagios scripts is probably enough. If you want greater accuracy, you’ll need to look harder.

smem introduces the concept of Proportional Set Size:

Because large portions of physical memory are typically shared among multiple applications, the standard measure of memory usage known as resident set size (RSS) will significantly overestimate memory usage. PSS instead measures each application’s “fair share” of each shared area to give a realistic measure.

Example: You start up GNOME, causing a number of processes to start, one for each applet and program. They all link to libglib. Linux loads libglib into one block of memory and maps it into every process that wants libglib. Naive memory accounting counts the full libglib size against every process linking to it.

smem divides up the cost of libglib among the processes using it, to give a closer picture of reality. It also has a number of options to display memory usage (from website):

  1. Show basic process information smem
  2. Show system view smem -R 4G -K /path/to/vmlinux -w
  3. Show totals and percentages smem -t -p
  4. Show different columns smem -c “name user pss”
  5. Show processes filtered by mapping smem -M libxml
  6. Show mappings filtered by process smem -m -P [e]volution
  7. Read data from capture tarball smem –source capture.tar.gz
  8. Show a bar chart labeled by pid smem –bar pid -c “pss uss”
  9. Show a pie chart of RSS labeled by name smem –pie name -s rss

You will, however, need a very recent kernel (> 2.6.27).

Can’t think of anything off the shelf

however, a combo of a PHP script exec’ing ps -AH v | awk ‘{ print $8,$9,$10}’ and using that with pChart could give you a web page that would do what you are looking for? (usage in Kb, percentage of total and process name)

Have a look at sarface – it depends on sar data, and you can monitor your memory usage (and all other sar/sysstat data) live.

and what about collectd ?

Leave a Reply

Your email address will not be published.