Howto: Monitoring ARC Cache Statistics for ZFS on Linux

Hi there,
I’m running a Promox VE hypervisor and am using ZFS with 2x HDD drives and one SSD to fasten up things.
The special_proxmox_ve datasource only provided me with two ZFS checks, but I wanted to get more intel about the status of my ARC Caches, so I did some research.

Apart from a plugin for collectd, I couldn’t find any useful information. Until I found the solaris check_mk_agent and this thread.

By simply adjusting the script to work on a linux machine, I was able to have a plugin for both the ARC and the L2ARC Cache. I hope this will get some attention and makes it into a downloadable plugin in a newer version of CMK. Maybe it even gets implemented into the main agent for linux. Who knows? :slight_smile:

Anyways, here’s the script for those that don’t want to wait until then:

#!/bin/bash
echo '<<<zfs_arc_cache>>>'
if [ ! -x /proc/spl/kstat/zfs/arcstats ]
then
        cat /proc/spl/kstat/zfs/arcstats |
        sed -e '1,2d' |
        awk '{printf "%s = %s\n", $1, $3;}'
fi

Place it under /usr/lib/check_mk_agent/plugins/zfs_arc_cache and have fun! :sunglasses:

EDIT: It looks like this when it’s activated

2 Likes