[collectd] Collectd-nagios - percentage of swap used

Marc Fournier marc.fournier at camptocamp.com
Thu Jun 17 16:03:08 CEST 2010


Hello,

> I've been trying for three hours now and I seem unable to get the
> right collectd-nagios command line to get the percentage of swap used.
> 
> I get the right values when I do the following:
> 
>       yhamon at grimston:/var/lib/collectd/rrd/yhamon-dev/swap$ sudo -u
> nagios /usr/bin/collectd-nagios -s /var/run/collectd-unixsock -H
> yhamon-dev -n swap/swap-free OKAY: 0 critical, 0 warning, 1 okay |
> value=5.09403e+08;;;;
> yhamon at grimston:/var/lib/collectd/rrd/yhamon-dev/swap$ sudo -u
> nagios /usr/bin/collectd-nagios -s /var/run/collectd-unixsock -H
> yhamon-dev -n swap/swap-used OKAY: 0 critical, 0 warning, 1 okay |
> value=1.06496e+06;;;;
> 
> But impossible to get a percentage, whatever I try.
> Any help would be highly appreciated, as I won't get very far with
> just this :(

collectd-nagios can only check against values found in RRD files.
AFAIK, collectd's "swap" plugin doesn't record this value.

Why don't you use nagios's check_swap plugin ? It has exactly the
option you are looking for:

$ /usr/lib/nagios/plugins/check_swap -w 100% 
SWAP WARNING - 99% free (1955 MB out of 1983 MB) |swap=1955MB;1983;0;0;1983

By the way, I use collectd-nagios to check "vmem/vmpage_io-swap", which
I find more relevant to monitor than the percentage of swap used.

I hope this helps !
Marc



More information about the collectd mailing list