Hi,
On 2014-09-17 06:59, Nathan Scott wrote:
>>
>> please find the first cut of (Linux) NFS Server PMDA below. Needs at least a
>> proper domain number, 135 used in the patch was randomly picked up unused
>> number for testing, tested on RHEL 6 / Fedora 20.
>
> There seems to be a fair bit of overlap between these metrics and the
> RPC/NFS server metrics in the Linux kernel PMDA. Do you want to find
> any missing ones and add them into the kernel PMDA instead? (so that
> they're available by default)
>
> See src/pmdas/linux/proc_net_rpc.{c,h} - I think that is doing alot of
> the same sort of procfs file parsing.
err, not sure how I missed that one .. perhaps I was looking something under
proc not under rpc. But extending that is of course the best option.
Please see below for an initial draft patch which adds currently the missing
metrics. But please note few things, perhaps you could help with these? pminfo
can't find rpc.server.reqcounts{,3,4}, there's some code to populate them but
I'm not sure is the corresponding code in pmda.c correct. Also, they are not
listed in the root_linux pmns definition file. Since I'm not clear about this I
didn't add the needed code for th_usage/ra_depth to pmda.c (of these th_usage
is actually helpful, not sure how relevant ra_depth is for most people). It
seemed also that not all server.rpc* were properly collected, adjusted that.
>From 89a3a8966b11735376faa8b71020aa8f561124f6 Mon Sep 17 00:00:00 2001
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Wed, 17 Sep 2014 14:31:46 +0300
Subject: [PATCH] Collect more nfsd statistics
---
src/pmdas/linux/help | 4 ++++
src/pmdas/linux/pmda.c | 10 ++++++++++
src/pmdas/linux/proc_net_rpc.c | 31 ++++++++++++++++++++++++++++---
src/pmdas/linux/proc_net_rpc.h | 8 +++++++-
src/pmdas/linux/root_linux | 4 ++++
5 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/src/pmdas/linux/help b/src/pmdas/linux/help
index 63166cf..b923320 100644
--- a/src/pmdas/linux/help
+++ b/src/pmdas/linux/help
@@ -836,6 +836,10 @@ tools running on IRIX.
@ rpc.server.io_write cumulative count of bytes passed into write requests
@ rpc.server.th_cnt available nfsd threads
@ rpc.server.th_fullcnt number of times the last free nfsd thread was used
+@ rpc.server.th_usage seconds when n percediles of available threads were in
use
+@ rpc.server.ra_size size of read-ahead cache
+@ rpc.server.ra_depth depth where an entry was found in the ra cache
+@ rpc.server.ra_nfound entry not found in the read-ahead cache
@ network.ip.forwarding count of ip forwarding
@ network.ip.defaultttl count of ip defaultttl
diff --git a/src/pmdas/linux/pmda.c b/src/pmdas/linux/pmda.c
index 73d961a..fece891 100644
--- a/src/pmdas/linux/pmda.c
+++ b/src/pmdas/linux/pmda.c
@@ -1761,6 +1761,16 @@ static pmdaMetric metrictab[] = {
{ PMDA_PMID(CLUSTER_NET_NFS,57), PM_TYPE_U32, PM_INDOM_NULL,
PM_SEM_COUNTER,
PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) } },
+/* rpc.server.ra_size */
+ { &proc_net_rpc.server.ra_size,
+ { PMDA_PMID(CLUSTER_NET_NFS,59), PM_TYPE_U32, PM_INDOM_NULL,
PM_SEM_COUNTER,
+ PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) } },
+
+/* rpc.server.ra_nfound */
+ { &proc_net_rpc.server.ra_nfound,
+ { PMDA_PMID(CLUSTER_NET_NFS,69), PM_TYPE_U32, PM_INDOM_NULL,
PM_SEM_COUNTER,
+ PMDA_PMUNITS(0,0,1,0,0,PM_COUNT_ONE) } },
+
/*
* /proc/partitions cluster
*/
diff --git a/src/pmdas/linux/proc_net_rpc.c b/src/pmdas/linux/proc_net_rpc.c
index 1b1a940..2044137 100644
--- a/src/pmdas/linux/proc_net_rpc.c
+++ b/src/pmdas/linux/proc_net_rpc.c
@@ -120,10 +120,33 @@ refresh_proc_net_rpc(proc_net_rpc_t *proc_net_rpc)
&proc_net_rpc->server.io_read,
&proc_net_rpc->server.io_write);
else
- if (strncmp(buf, "th", 2) == 0)
+ if (strncmp(buf, "th", 2) == 0) {
sscanf(buf, "th %u %u",
&proc_net_rpc->server.th_cnt,
&proc_net_rpc->server.th_fullcnt);
+ p = strtok(buf, " ");
+ for (i=-2; p && i < 10; i++) {
+ p = strtok(NULL, " ");
+ if (i < 0)
+ continue;
+ if (p != NULL)
+ proc_net_rpc->server.th_usage[i] = strtof(p, NULL);
+ }
+ }
+ else
+ if (strncmp(buf, "ra", 2) == 0) {
+ sscanf(buf, "ra %u %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %u",
+ &proc_net_rpc->server.ra_size,
+ &proc_net_rpc->server.ra_nfound);
+ p = strtok(buf, " ");
+ for (i=-1; p && i < 10; i++) {
+ p = strtok(NULL, " ");
+ if (i < 0)
+ continue;
+ if (p != NULL)
+ proc_net_rpc->server.ra_depth[i] = strtoul(p, (char
**)NULL, 10);
+ }
+ }
else
if (strncmp(buf, "net", 3) == 0)
sscanf(buf, "net %u %u %u %u",
@@ -133,10 +156,12 @@ refresh_proc_net_rpc(proc_net_rpc_t *proc_net_rpc)
&proc_net_rpc->server.nettcpconn);
else
if (strncmp(buf, "rpc", 3) == 0)
- sscanf(buf, "rpc %u %u %u",
+ sscanf(buf, "rpc %u %u %u %u %u",
&proc_net_rpc->server.rpccnt,
&proc_net_rpc->server.rpcerr, /* always the sum of the
following three fields */
- &proc_net_rpc->server.rpcbadfmt);
+ &proc_net_rpc->server.rpcbadfmt,
+ &proc_net_rpc->server.rpcbadauth,
+ &proc_net_rpc->server.rpcbadclnt);
else
if (strncmp(buf, "proc2", 5) == 0) {
if ((p = strtok(buf, " ")) != NULL)
diff --git a/src/pmdas/linux/proc_net_rpc.h b/src/pmdas/linux/proc_net_rpc.h
index 880dbed..e53d6a7 100644
--- a/src/pmdas/linux/proc_net_rpc.h
+++ b/src/pmdas/linux/proc_net_rpc.h
@@ -21,7 +21,7 @@
#define NR_RPC_COUNTERS 18
#define NR_RPC3_COUNTERS 22
#define NR_RPC4_CLI_COUNTERS 35
-#define NR_RPC4_SVR_COUNTERS 41
+#define NR_RPC4_SVR_COUNTERS 61
typedef struct {
struct {
@@ -70,6 +70,12 @@ typedef struct {
/* /proc/net/rpc/nfsd "th" */
unsigned int th_cnt; /* available nfsd threads */
unsigned int th_fullcnt; /* times last free thread used */
+ float th_usage[10]; /* % of threads in use in secs */
+
+ /* /proc/net/rpc/nfsd "ra" */
+ unsigned int ra_size; /* cache size */
+ unsigned int ra_depth[10]; /* entry found in this depth */
+ unsigned int ra_nfound; /* not found in read-ahead cache */
/* /proc/net/rpc/nfsd "net" */
unsigned int netcnt;
diff --git a/src/pmdas/linux/root_linux b/src/pmdas/linux/root_linux
index d66da28..28c539b 100644
--- a/src/pmdas/linux/root_linux
+++ b/src/pmdas/linux/root_linux
@@ -804,6 +804,10 @@ rpc.server {
io_write 60:7:55
th_cnt 60:7:56
th_fullcnt 60:7:57
+ th_usage 60:7:58
+ ra_size 60:7:59
+ ra_depth 60:7:68
+ ra_nfound 60:7:69
}
nfs3 {
--
1.7.1
--
Marko Myllynen
|