]> granicus.if.org Git - sysstat/commitdiff
sadf: PCP: Add support for A_NET_NFSD activity
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 24 Mar 2019 14:14:43 +0000 (15:14 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 24 Mar 2019 14:14:43 +0000 (15:14 +0100)
Add metrics displayed by "sar -n NFSD" (NFS server statistics) to PCP
archive.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
activity.c
pcp_def_metrics.c
pcp_def_metrics.h
pcp_stats.c
pcp_stats.h
sadf_misc.c

index b2a3ef2e9c69cf0d6728d7ac3be72b90cd09c289..45a32198df508b7af4ad6c404e83338bfe28c6f6 100644 (file)
@@ -740,6 +740,7 @@ struct activity net_nfsd_act = {
        .f_json_print   = json_print_net_nfsd_stats,
        .f_svg_print    = svg_print_net_nfsd_stats,
        .f_raw_print    = raw_print_net_nfsd_stats,
+       .f_pcp_print    = pcp_print_net_nfsd_stats,
        .f_count_new    = NULL,
        .item_list      = NULL,
        .desc           = "NFS server statistics",
index 9313590513bf6de65cbb1114d74360ceff1e8f5e..3d15946d98ca6f880984a2d798984cbfcadf1ba7 100644 (file)
@@ -632,3 +632,57 @@ void pcp_def_net_nfs_metrics(void)
                     pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
 #endif /* HAVE_PCP */
 }
+
+/*
+ ***************************************************************************
+ * Define PCP metrics for NFS server statistics.
+ ***************************************************************************
+ */
+void pcp_def_net_nfsd_metrics(void)
+{
+#ifdef HAVE_PCP
+       pmiAddMetric("network.fs.server.call",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.badcall",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.packets",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.udp",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.tcp",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.hits",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.misses",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.read",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.write",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.access",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+       pmiAddMetric("network.fs.server.gettattr",
+                    PM_IN_NULL, PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+                    pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+#endif /* HAVE_PCP */
+}
index 1ec2cd12e0cb8592242194ff41344d27573746b3..a1a555f90e5483909f05745fe2a713d3cf0cabd6 100644 (file)
@@ -24,6 +24,7 @@ void pcp_def_queue_metrics(void);
 void pcp_def_serial_metrics(struct activity *);
 void pcp_def_net_dev_metrics(struct activity *);
 void pcp_def_net_nfs_metrics(void);
+void pcp_def_net_nfsd_metrics(void);
 
 /* Define domains number */
 #define PM_INDOM_CPU           0
index 692f11eef4ac0ecc7d3b6328f0aa3b483e417cfe..8e263efc8ed7455fe9fe210650cf383e644dcf68 100644 (file)
@@ -838,3 +838,69 @@ __print_funct_t pcp_print_net_nfs_stats(struct activity *a, int curr, unsigned l
        pmiPutValue("network.fs.client.getatt", NULL, buf);
 #endif /* HAVE_PCP */
 }
+
+/*
+ ***************************************************************************
+ * Display NFS server statistics in PCP format.
+ *
+ * IN:
+ * @a          Activity structure with statistics.
+ * @curr       Index in array for current sample statistics.
+ * @itv                Interval of time in 1/100th of a second.
+ * @record_hdr Record header for current sample.
+ ***************************************************************************
+ */
+__print_funct_t pcp_print_net_nfsd_stats(struct activity *a, int curr, unsigned long long itv,
+                                        struct record_header *record_hdr)
+{
+#ifdef HAVE_PCP
+       char buf[64];
+       struct stats_net_nfsd
+               *snndc = (struct stats_net_nfsd *) a->buf[curr],
+               *snndp = (struct stats_net_nfsd *) a->buf[!curr];
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv));
+       pmiPutValue("network.fs.server.call", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv));
+       pmiPutValue("network.fs.server.badcall", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv));
+       pmiPutValue("network.fs.server.packets", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_netudpcnt, snndc->nfsd_netudpcnt, itv));
+       pmiPutValue("network.fs.server.udp", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_nettcpcnt, snndc->nfsd_nettcpcnt, itv));
+       pmiPutValue("network.fs.server.tcp", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_rchits, snndc->nfsd_rchits, itv));
+       pmiPutValue("network.fs.server.hits", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_rcmisses, snndc->nfsd_rcmisses, itv));
+       pmiPutValue("network.fs.server.misses", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_readcnt, snndc->nfsd_readcnt, itv));
+       pmiPutValue("network.fs.server.read", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_writecnt, snndc->nfsd_writecnt, itv));
+       pmiPutValue("network.fs.server.write", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_accesscnt, snndc->nfsd_accesscnt, itv));
+       pmiPutValue("network.fs.server.access", NULL, buf);
+
+       snprintf(buf, sizeof(buf), "%f",
+               S_VALUE(snndp->nfsd_getattcnt, snndc->nfsd_getattcnt, itv));
+       pmiPutValue("network.fs.server.getattr", NULL, buf);
+#endif /* HAVE_PCP */
+}
index 7a7f96bca01e18dd73f6ff6635e4521ebc83db0e..60c3e36dd8a77aadcb5852352fde2b6e89330cd5 100644 (file)
@@ -39,5 +39,7 @@ __print_funct_t pcp_print_net_edev_stats
        (struct activity *, int, unsigned long long, struct record_header *);
 __print_funct_t pcp_print_net_nfs_stats
        (struct activity *, int, unsigned long long, struct record_header *);
+__print_funct_t pcp_print_net_nfsd_stats
+       (struct activity *, int, unsigned long long, struct record_header *);
 
 #endif /* _PCP_STATS_H */
index d9153cc12bb0525c35cf414279426eb37e2028dc..799f6aa847728a4b4a11b55ca0bc1fd973f88266 100644 (file)
@@ -545,6 +545,10 @@ __printf_funct_t print_pcp_statistics(int *tab, int action, struct activity *act
                                case A_NET_NFS:
                                        pcp_def_net_nfs_metrics();
                                        break;
+
+                               case A_NET_NFSD:
+                                       pcp_def_net_nfsd_metrics();
+                                       break;
                        }
                }
        }