Missing some ZFS values in sysctl output
Willem Jan Withagen
wjw at digiware.nl
Tue Mar 24 11:23:36 UTC 2015
On 22-3-2015 23:44, Willem Jan Withagen wrote:
> Hoi,
>
> There is this zfs-snmp script that allows one the graph certain things
> from a ZFS setup.
> The original uses solaris' kstat, but just about all values are in
> Sysctl with FreeBSD.
>
> However I seem to overlook the values for:
>
> Original code:
> ====
> def zfs_read(oid):
> return ('counter', kstat("unix:0:vopstats_zfs:read_bytes") / 1024 %
> 2**32) # 32 bit KB counter
>
> def zfs_readdir(oid):
> return ('counter', kstat("unix:0:vopstats_zfs:readdir_bytes") / 1024
> % 2**32) # 32 bit KB counter
>
> def zfs_write(oid):
> return ('counter', kstat("unix:0:vopstats_zfs:write_bytes") / 1024 %
> 2**32) # 32 bit KB counter
> =======
>
> Read and write are available for L2 arc, but for the global values I
> seem to miss them.
>
> Are they really not in ZFS?
> And is it possible to add them?
Right,
Just to answer my own question....
I looked into the illumos code, and it looks like the vopstats are stats
that are kept per filesystem-type on solaris, and these are the ZFS
variants....
typedef struct vopstats {
kstat_named_t nopen; /* VOP_OPEN */
kstat_named_t nclose; /* VOP_CLOSE */
kstat_named_t nread; /* VOP_READ */
kstat_named_t read_bytes;
kstat_named_t nwrite; /* VOP_WRITE */
kstat_named_t write_bytes;
kstat_named_t nioctl; /* VOP_IOCTL */
kstat_named_t nsetfl; /* VOP_SETFL */
kstat_named_t ngetattr; /* VOP_GETATTR */
kstat_named_t nsetattr; /* VOP_SETATTR */
kstat_named_t naccess; /* VOP_ACCESS */
kstat_named_t nlookup; /* VOP_LOOKUP */
kstat_named_t ncreate; /* VOP_CREATE */
kstat_named_t nremove; /* VOP_REMOVE */
kstat_named_t nlink; /* VOP_LINK */
kstat_named_t nrename; /* VOP_RENAME */
kstat_named_t nmkdir; /* VOP_MKDIR */
kstat_named_t nrmdir; /* VOP_RMDIR */
kstat_named_t nreaddir; /* VOP_READDIR */
kstat_named_t readdir_bytes;
kstat_named_t nsymlink; /* VOP_SYMLINK */
kstat_named_t nreadlink; /* VOP_READLINK */
kstat_named_t nfsync; /* VOP_FSYNC */
kstat_named_t ninactive; /* VOP_INACTIVE */
kstat_named_t nfid; /* VOP_FID */
kstat_named_t nrwlock; /* VOP_RWLOCK */
kstat_named_t nrwunlock; /* VOP_RWUNLOCK */
kstat_named_t nseek; /* VOP_SEEK */
kstat_named_t ncmp; /* VOP_CMP */
kstat_named_t nfrlock; /* VOP_FRLOCK */
kstat_named_t nspace; /* VOP_SPACE */
kstat_named_t nrealvp; /* VOP_REALVP */
kstat_named_t ngetpage; /* VOP_GETPAGE */
kstat_named_t nputpage; /* VOP_PUTPAGE */
kstat_named_t nmap; /* VOP_MAP */
kstat_named_t naddmap; /* VOP_ADDMAP */
kstat_named_t ndelmap; /* VOP_DELMAP */
kstat_named_t npoll; /* VOP_POLL */
kstat_named_t ndump; /* VOP_DUMP */
kstat_named_t npathconf; /* VOP_PATHCONF */
kstat_named_t npageio; /* VOP_PAGEIO */
kstat_named_t ndumpctl; /* VOP_DUMPCTL */
kstat_named_t ndispose; /* VOP_DISPOSE */
kstat_named_t nsetsecattr; /* VOP_SETSECATTR */
kstat_named_t ngetsecattr; /* VOP_GETSECATTR */
kstat_named_t nshrlock; /* VOP_SHRLOCK */
kstat_named_t nvnevent; /* VOP_VNEVENT */
kstat_named_t nreqzcbuf; /* VOP_REQZCBUF */
kstat_named_t nretzcbuf; /* VOP_RETZCBUF */
} vopstats_t;
As far as I can tell we do not have these structures in vnode.{c,h} and
as such do not keep tracks of these statistics. Nothing equal to this
jumps out from the sysctl-tree. But I happily stand corrected.
Tinkering this in just the ZFS code would be a serious undertaking. At
least for me. And all this just to some snmp-stats.
--WjW
More information about the freebsd-fs
mailing list