From owner-freebsd-questions Fri Mar 17 11:04:38 1995 Return-Path: questions-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id LAA06365 for questions-outgoing; Fri, 17 Mar 1995 11:04:38 -0800 Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id LAA06357 for ; Fri, 17 Mar 1995 11:04:36 -0800 Received: by halloran-eldar.lcs.mit.edu; id AA23275; Fri, 17 Mar 1995 14:00:42 -0500 Date: Fri, 17 Mar 1995 14:00:42 -0500 From: Garrett Wollman Message-Id: <9503171900.AA23275@halloran-eldar.lcs.mit.edu> To: Lars Koeller Cc: questions@freefall.cdrom.com Subject: NFS stats (was: Re: ANNOUNCING: xperfmon++ for FreeBSD-2.X) In-Reply-To: <199503170809.JAA01097@odie.physik2.uni-rostock.de> References: <199503170809.JAA01097@odie.physik2.uni-rostock.de> Sender: questions-owner@FreeBSD.org Precedence: bulk < said: > Hello! > |> On FreeBSD 2.0, I don't have NFS configured into the kernel, so I get the > |> error: > |> vmstat: undefined symbols: _nfsstats > Thanks, I try to fix it. For recent versions of FreeBSD, the correct way to get NFS statistics is to read the fs.nfs group statistics MIB variable, as the `nfsstats' program does. /* * Read the nfs stats using sysctl(3) for live kernels, or kvm_read * for dead ones. */ void readstats(struct nfsstats *stp) { if(deadkernel) { if(kvm_read(kd, (u_long)nl[N_NFSSTAT].n_value, stp, sizeof *stp) < 0) { err(1, "kvm_read"); } } else { int name[3]; size_t buflen = sizeof *stp; name[0] = CTL_FS; name[1] = MOUNT_NFS; name[2] = NFS_NFSSTATS; if(sysctl(name, 3, stp, &buflen, (void *)0, (size_t)0) < 0) { err(1, "sysctl"); } } } -GAWollman -- Garrett A. Wollman | Shashish is simple, it's discreet, it's brief. ... wollman@lcs.mit.edu | Shashish is the bonding of hearts in spite of distance. Opinions not those of| It is a bond more powerful than absence. We like people MIT, LCS, ANA, or NSA| who like Shashish. - Claude McKenzie + Florent Vollant