Zenoss swap usage threshold as percentage

Published: Mon 05 November 2012
By Sirex

In Linux.

For some reason, setting a threshold in zenoss for percentage amount of swap usage is not as easy as you may hope. You can set a threshold as a fixed value easily enough, but doing it as a percentage (such that it will work on machines with differing amounts of ram) is a little more tricky. Below is what worked for me.

I should mention, 'Dpetzel' of zenoss community IRC helped greatly with this, and I doubt I would have got it working without his aid.

Firstly, zenoss by default has knowledge only of the amount of available swap memory. This isn't going to be of much use without knowing the total amount installed in the machine. Fortunately this is exposed via snmp, so you'll need to add a new datasource & snmp oid.

Adding the datasource

(This is reported over SNMP in kB)

You'll also need to add a datapoint for that datasource (once added, select the new data source and on the 'cog' menu above it, select "add data point".

Now you have the information needed to calculate the amount, so you can add the threshold:

Adding the threshold

The 'or 10000000000' value in this expression is to avoid errors being generated by the threshold when the rrd data is not available. That will happen when the device is newly added, and no data has yet been collected.

Note that this is a threshold of low amount free, so * .99 is 99% free, i.e: 1% in use. You'll likely want a value in the region of * .70 or so (30% in use) but for my particular use case almost any swap usage is considered bad.

blogroll

social