pcp
[Top] [All Lists]

Possibly quirky libpcp_pmda behavior?

To: dchatterton@xxxxxxxxxx
Subject: Possibly quirky libpcp_pmda behavior?
From: Nathan Scott <nscott@xxxxxxxxxx>
Date: Thu, 22 Mar 2007 11:35:43 +1100
Cc: pcp@xxxxxxxxxxx
Organization: Aconex
Reply-to: nscott@xxxxxxxxxx
Sender: pcp-bounce@xxxxxxxxxxx
Hi Dave,

(IIRC, you wrote this bit of code, so maybe you'll remember). I have
an agent which is returning PM_ERR_APPVERSION for some of its metric
values, for metrics not supported on a particular platform version.

>From pmapi.h:
#define PM_ERR_APPVERSION       (-PM_ERR_BASE-5)    /* Metric not
supported by this version of monitored application */

And the code in question in libpcp_pmda is here (callback.c)...

int
pmdaFetch(int numpmid, pmID pmidlist[], pmResult **resp, pmdaExt *pmda)
{
...
if ((sts = (*(pmda->e_fetchCallBack))(metap, inst, &atom)) < 0) {
    if (sts == PM_ERR_PMID)
        __pmNotifyErr(LOG_ERR,
                "pmdaFetch: PMID %s not handled by fetch callback\n",
                pmIDStr(dp->pmid));
    else if (sts == PM_ERR_INST) {
#ifdef PCP_DEBUG
        if (pmDebug & DBG_TRACE_LIBPMDA) {
            __pmNotifyErr(LOG_ERR,
                "pmdaFetch: Instance %d of PMID %s not handled by fetch 
callback\n",
                inst, pmIDStr(dp->pmid));
        }
#endif
    }
    else
        __pmNotifyErr(LOG_ERR,
                "pmdaFetch: Fetch callback error: %s\n",
                pmErrStr(sts));
}
...
... if (sts >= 0) {
        vset->valfmt = sts;
        j++;
    }

The problem I'm facing is that I end up getting one line in the
pmda's logfile everytime a fetch is done for an instance tree for
every metric that isnt supported for that platform version.  In
some situations this ends up being frequent, and I end up with a
huge log file after a few days/weeks, and none of the messages are
helpful as its expected.

So, the pmResult structure is filled in correctly, and the clients
get the correct error for those metrics, but it seems either the
library is being too chatty (at least for this particular errno),
or I should be coding the fetch callback differently.  Thoughts?

We could resolve my immediate problem using the attached patch, but
maybe I'm not approaching this the right way (maybe the fetch method
itself should do this?) - any insight would be much appreciated!

thanks.

-- 
Nathan

Attachment: quiet-libpcp_pmda-appversion
Description: Text Data

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