pcp
[Top] [All Lists]

Re: [pcp] Experimental patch (was Re: mmv pmda: stuff always fails the f

To: Martin Hicks <mort@xxxxxxxx>
Subject: Re: [pcp] Experimental patch (was Re: mmv pmda: stuff always fails the first time?)
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Mon, 16 Nov 2009 07:20:29 +1100
Cc: pcp@xxxxxxxxxxx
In-reply-to: <1258227985.3041.19.camel@localhost>
References: <1370327498.387811258077480321.JavaMail.root@xxxxxxxxxxxxxxxxxx> <58136227.387901258077641856.JavaMail.root@xxxxxxxxxxxxxxxxxx> <20091113135030.GJ5895@xxxxxxxxxxxxxxxxxxxxxxxxx> <1258158943.3041.8.camel@localhost> <20091114162915.GI5035@xxxxxxxxxxxxxxxx> <1258227985.3041.19.camel@localhost>
Reply-to: kenj@xxxxxxxxxxxxxxxx
Found this one.

In mmv.c ...

mmv_children_getlist(__pmnsNode *base, int *nmetrics, char *p, char **list, int 
*leaf)
{
    __pmnsNode *node;
    int count = *nmetrics;
    char *start = p;

    for (node = base; node != NULL; node = node->next) {
        if (NONLEAF(node)) {
            p = mmv_children_getlist(node->first, &count, p, list, leaf);
            start = p;                          <------ THIS WAS MISSING 
---------
            continue;
        }
        leaf[count] = PMNS_LEAF_STATUS;
        list[count] = start;
        p = mmv_absolute_name(node, p);
        *(p-1) = '\0';  /* overwrite final '.' */
        start = p;
        count++;
    }
    *nmetrics = count;
    return p;
}

This makes Martin's test work, and QA 647 works (modulo the order of the
metrics is no longer the same and my pmdaproc.sh fix changes the
(previously wrong) Install message for the mmv PMDA.

I'm not sure this will fix the failure Martin saw, as this seems to
involve not consuming enough of the allocated buffer, rather than
over-running the buffer.

But it is a start ... 8^)>

On Sun, 2009-11-15 at 06:46 +1100, Ken McDonell wrote:
> Thanks Martin.
> 
> May I have your permission to include these code snippets into the QA
> suite ... clearly there is a coverage issue here.
> 
> For me, the code works and the metric appears and is being updated as
> expected.
> 
> But there is a problem ... mmv.mymmv.export_value appears TWICE in the
> PMNS with the same PMID ...
> $ pminfo -m mmv
> mmv.mymmv.export_value PMID: 70.1.1
> mmv.mymmv.export_value PMID: 70.1.1
> (and note mmv.reload is no longer in the PMNS)
> 
> I've seen the same thing with QA 647 where after the mmv PMDA is
> installed, this metric appears (I have an independent pmdaproc.sh fix to
> make the warning message go away from the Check line) ...
> 
> Check mmv metrics have appeared ... 1 metrics and 1 values
> $ pminfo -fm mmv
> 
> mmv.reload PMID: 70.0.0
>     value 0
> 
> but then as soon as the mmv PMDA has a data file to work on, mmv.reload
> vanishes from the PMNS and mmv.test.strings appears twice in the PMNS.
> 
> $ pminfo -fm mmv
> 
> mmv.test.strings PMID: 70.1.6
>     inst [0 or "zero"] value "00oo00"
>     inst [1 or "hero"] value ""
> 
> mmv.test.string PMID: 70.1.5
>     value "g'day world"
> 
> mmv.test.interval PMID: 70.1.4
>     inst [0 or "bird"] value 0
>     inst [1 or "tree"] value 0
>     inst [2 or "eggs"] value 28
> 
> mmv.test.indom PMID: 70.1.3
>     inst [0 or "zero"] value 43
>     inst [1 or "hero"] value 0
> 
> mmv.test.discrete PMID: 70.1.2
>     value 42
> 
> mmv.test.counter PMID: 70.1.1
>     value 41
> 
> mmv.test.strings PMID: 70.1.6
>     inst [0 or "zero"] value "00oo00"
>     inst [1 or "hero"] value ""
> 
> Hopefully this is enough evidence for Nathan to go ... ahhhaa ... but if
> that does not happen over the next day or so, I'll go digging some more.
> 
> On Sat, 2009-11-14 at 11:29 -0500, Martin Hicks wrote:
> > On Sat, Nov 14, 2009 at 11:35:43AM +1100, Ken McDonell wrote:
> > > Martin,
> > > 
> > > Any chance you can post gendata.sh and mmvtest.pl (or send me copies) so
> > > I can investigate? ... this is certainly in a place where the dynamic
> > > pmns changes were made.
> > 
> > Attached.  It was my first, quick attempt to get something working, and
> > an example for someone who wanted to extract a metric out of another
> > commands stdout to export to PCP.
> > 
> > mh
> > 
> 
> 
> _______________________________________________
> pcp mailing list
> pcp@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/pcp


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