pmda: handle struct latency_counter and add num_recoveries
authorDavid Disseldorp <ddiss@suse.de>
Fri, 2 Sep 2011 15:34:19 +0000 (17:34 +0200)
committerDavid Disseldorp <ddiss@suse.de>
Tue, 6 Sep 2011 12:01:18 +0000 (14:01 +0200)
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

(This used to be ctdb commit 2165a6f5117a71f9f97f46be9708fa34c037e17c)

ctdb/utils/pmda/help
ctdb/utils/pmda/pmda_ctdb.c
ctdb/utils/pmda/pmns

index 4066fde3ade950df4fb5fe94544eeb7ec7b5f519..0e9984eab3a6abffd59a01ce95d7b2b259da241d 100644 (file)
 @ 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
index 7b6b710dea3b45edf9640ee57b29e40664d6bc07..927fea5805dfe6451073908807731502edd0e90a 100644 (file)
 #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;
index 000dee53c79bc3e9adc3da277192192e71e92193..38509defb99708cf5aa5262d40a724e14d7cd6e5 100644 (file)
@@ -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 {