pcp
[Top] [All Lists]

My first PMDA, some questions..

To: pcp@xxxxxxxxxxx
Subject: My first PMDA, some questions..
From: Jan-Frode Myklebust <janfrode@xxxxxxxxx>
Date: Sun, 16 Nov 2014 21:09:58 +0100
Delivered-to: pcp@xxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
I'm writing my first python pmda to collect 143 global + numthreads*13
metrics from the Unbound recursive DNS server. A sample of the metrics:

thread0.num.queries=565719821
thread0.num.cachehits=537437733
thread0.num.cachemiss=28282088
thread1.num.queries=565719821
thread1.num.cachehits=537437733
thread1.num.cachemiss=28282088
--
total.num.queries=3359533335
total.num.cachehits=2967548455
total.num.cachemiss=391984880
total.requestlist.avg=293.892
total.requestlist.max=4335
total.requestlist.overwritten=85422
total.requestlist.exceeded=528767
num.query.type.TYPE0=1967231
num.query.type.A=2761228065
num.query.type.NS=2494800
num.query.type.MD=3
num.query.type.MF=3

So one set of metrics that are repeated once for each thread the server
is defined to run, and another set of metrics that will always be there.
The numbers are generated by running the command "unbound-control
stats_noreset".

I have a simple python pmda running that sets up and populates the
total.num metrics, and that works fine, but I don't see how I'm
supposed to handle the dynamic numthreads metrics. Any pointers? What I
have now are simple:

        self.values['total.num.queries'] = 0
        self.add_metric(name + '.total.num.queries', pmdaMetric(
                self.pmid(0, 0),
                c_api.PM_TYPE_U64, c_api.PM_INDOM_NULL, c_api.PM_SEM_COUNTER,
                pmUnits(0, 0, 1, 0, 0, c_api.PM_COUNT_ONE)),
        'Total number of queries from all threads.')


How would I add the "threadX.num.queries" when I don't know how many
threads I will have?

Also, I'm wondering how often the fetch() procedure in the pmda is called,
and if there's any way of controlling that. I don't know how advicable it
will be to be calling the external command for generating all stats every
second..

What's triggering the fetch()? Is it me running "pmval -t 1 total.num.queries",
or will it always be collecting at a given intervall?


   -jf

<Prev in Thread] Current Thread [Next in Thread>