.f_json_print = json_print_fchost_stats,
.f_svg_print = svg_print_fchost_stats,
.f_raw_print = raw_print_fchost_stats,
+ .f_pcp_print = pcp_print_fchost_stats,
.f_count_new = count_new_fchost,
.item_list = NULL,
.desc = "Fibre Channel HBA statistics",
pmiUnits(0, 0, 0, 0, 0, 0));
#endif /* HAVE_PCP */
}
+
+/*
+ ***************************************************************************
+ * Define PCP metrics for Fibre Channel HBA statistics.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ ***************************************************************************
+ */
+void pcp_def_fchost_metrics(struct activity *a)
+{
+#ifdef HAVE_PCP
+ int inst = 0;
+ static pmInDom indom = PM_INDOM_NULL;
+ struct sa_item *list = a->item_list;
+
+ if (indom == PM_INDOM_NULL) {
+ /* Create domain */
+ indom = pmInDom_build(0, PM_INDOM_FCHOST);
+
+ /* Create instances */
+ while (list != NULL) {
+ pmiAddInstance(indom, list->item_name, inst++);
+ list = list->next;
+ }
+ }
+
+ pmiAddMetric("network.fchost.in.frame",
+ PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
+ pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+ pmiAddMetric("network.fchost.out.frame",
+ PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
+ pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+ pmiAddMetric("network.fchost.in.word",
+ PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
+ pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+
+ pmiAddMetric("network.fchost.out.word",
+ PM_IN_NULL, PM_TYPE_FLOAT, indom, PM_SEM_INSTANT,
+ pmiUnits(0, -1, 1, 0, PM_TIME_SEC, PM_COUNT_ONE));
+#endif /* HAVE_PCP */
+}
void pcp_def_net_udp6_metrics(void);
void pcp_def_huge_metrics(void);
void pcp_def_filesystem_metrics(struct activity *);
+void pcp_def_fchost_metrics(struct activity *);
/* Define domains number */
#define PM_INDOM_CPU 0
#define PM_INDOM_SERIAL 3
#define PM_INDOM_INT 4
#define PM_INDOM_FILESYSTEM 5
+#define PM_INDOM_FCHOST 6
#endif /* _PCP_DEF_METRICS_H */
}
#endif /* HAVE_PCP */
}
+
+/*
+ ***************************************************************************
+ * Display Fibre Channel HBA 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_fchost_stats(struct activity *a, int curr, unsigned long long itv,
+ struct record_header *record_hdr)
+{
+#ifdef HAVE_PCP
+ int i, j, j0, found;
+ struct stats_fchost *sfcc, *sfcp;
+ char buf[64];
+
+ for (i = 0; i < a->nr[curr]; i++) {
+
+ found = FALSE;
+
+ if (a->nr[!curr] > 0) {
+ sfcc = (struct stats_fchost *) ((char *) a->buf[curr] + i * a->msize);
+
+ /* Look for corresponding structure in previous iteration */
+ j = i;
+
+ if (j >= a->nr[!curr]) {
+ j = a->nr[!curr] - 1;
+ }
+
+ j0 = j;
+
+ do {
+ sfcp = (struct stats_fchost *) ((char *) a->buf[!curr] + j * a->msize);
+ if (!strcmp(sfcc->fchost_name, sfcp->fchost_name)) {
+ found = TRUE;
+ break;
+ }
+ if (++j >= a->nr[!curr]) {
+ j = 0;
+ }
+ }
+ while (j != j0);
+ }
+
+ if (!found)
+ continue;
+
+ snprintf(buf, sizeof(buf), "%f",
+ S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv));
+ pmiPutValue("network.fchost.in.frame", sfcc->fchost_name, buf);
+
+ snprintf(buf, sizeof(buf), "%f",
+ S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv));
+ pmiPutValue("network.fchost.out.frame", sfcc->fchost_name, buf);
+
+ snprintf(buf, sizeof(buf), "%f",
+ S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv));
+ pmiPutValue("network.fchost.in.word", sfcc->fchost_name, buf);
+
+ snprintf(buf, sizeof(buf), "%f",
+ S_VALUE(sfcp->f_txwords, sfcc->f_txwords, itv));
+ pmiPutValue("network.fchost.out.word", sfcc->fchost_name, buf);
+ }
+#endif /* HAVE_PCP */
+}
(struct activity *, int, unsigned long long, struct record_header *);
__print_funct_t pcp_print_filesystem_stats
(struct activity *, int, unsigned long long, struct record_header *);
+__print_funct_t pcp_print_fchost_stats
+ (struct activity *, int, unsigned long long, struct record_header *);
__print_funct_t pcp_print_softnet_stats
(struct activity *, int, unsigned long long, struct record_header *);
case A_FS:
pcp_def_filesystem_metrics(act[p]);
break;
+
+ case A_NET_FC:
+ pcp_def_fchost_metrics(act[p]);
+ break;
}
}
}