[PATCH 6/6] pmda: handle struct latency_counter and add num_recoveries
David Disseldorp
ddiss at suse.de
Sun Sep 4 12:27:38 MDT 2011
Rebase the CTDB PMDA from 1.0.114 to master:
- Add tevent and ctdb_protocol includes
- Handle latency metrics now stored under struct latency_counter
- Add new metric for the num_recoveries counter
---
utils/pmda/help | 2 ++
utils/pmda/pmda_ctdb.c | 22 +++++++++++++++-------
utils/pmda/pmns | 1 +
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/utils/pmda/help b/utils/pmda/help
index 4066fde..0e9984e 100644
--- a/utils/pmda/help
+++ b/utils/pmda/help
@@ -102,3 +102,5 @@
@ ctdb.max_lockwait_latency maximum time spent waiting for a tdb chainlock
@ ctdb.max_childwrite_latency maximum time spent performing a childwrite
+
+@ ctdb.num_recoveries number of recoveries finished
diff --git a/utils/pmda/pmda_ctdb.c b/utils/pmda/pmda_ctdb.c
index 7b6b710..927fea5 100644
--- a/utils/pmda/pmda_ctdb.c
+++ b/utils/pmda/pmda_ctdb.c
@@ -23,9 +23,10 @@
#include <pcp/impl.h>
#include <pcp/pmda.h>
#include "../../include/includes.h"
-#include "../../lib/events/events.h"
+#include "../../lib/tevent/tevent.h"
#include "../../include/ctdb.h"
#include "../../include/ctdb_private.h"
+#include "../../include/ctdb_protocol.h"
#include "domain.h"
/*
@@ -154,6 +155,9 @@ static pmdaMetric metrictab[] = {
/* max_childwrite_latency */
{ NULL, { PMDA_PMID(25,36), PM_TYPE_DOUBLE, PM_INDOM_NULL, PM_SEM_INSTANT,
PMDA_PMUNITS(0,1,0,0,PM_TIME_SEC,0) }, },
+ /* num_recoveries */
+ { NULL, { PMDA_PMID(26,37), PM_TYPE_U32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0,0,0,0,0,0) }, },
};
static struct event_context *ev;
@@ -231,7 +235,8 @@ pmda_ctdb_daemon_connect(void)
ctdb->daemon.queue = ctdb_queue_setup(ctdb, ctdb, ctdb->daemon.sd,
CTDB_DS_ALIGNMENT,
- pmda_ctdb_q_read_cb, ctdb);
+ pmda_ctdb_q_read_cb, ctdb,
+ "to-ctdbd");
if (ctdb->daemon.queue == NULL) {
fprintf(stderr, "Failed to setup queue\n");
goto err_sd;
@@ -437,19 +442,22 @@ pmda_ctdb_fetch_cb(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
atom->ul = stats->max_hop_count;
break;
case 21:
- atom->d = stats->reclock.ctdbd;
+ atom->d = stats->reclock.ctdbd.max;
break;
case 22:
- atom->d = stats->reclock.recd;
+ atom->d = stats->reclock.recd.max;
break;
case 23:
- atom->d = stats->max_call_latency;
+ atom->d = stats->call_latency.max;
break;
case 24:
- atom->d = stats->max_lockwait_latency;
+ atom->d = stats->lockwait_latency.max;
break;
case 25:
- atom->d = stats->max_childwrite_latency;
+ atom->d = stats->childwrite_latency.max;
+ break;
+ case 26:
+ atom->d = stats->num_recoveries;
break;
default:
return PM_ERR_PMID;
diff --git a/utils/pmda/pmns b/utils/pmda/pmns
index 000dee5..38509de 100644
--- a/utils/pmda/pmns
+++ b/utils/pmda/pmns
@@ -45,6 +45,7 @@ ctdb {
max_call_latency CTDB:23:34
max_lockwait_latency CTDB:24:35
max_childwrite_latency CTDB:25:36
+ num_recoveries CTDB:26:37
}
ctdb.node {
--
1.7.1
More information about the samba-technical
mailing list