pcp
[Top] [All Lists]

RE: Possibly quirky libpcp_pmda behavior?

To: <nscott@xxxxxxxxxx>
Subject: RE: Possibly quirky libpcp_pmda behavior?
From: "David Chatterton" <dchatterton@xxxxxxxxxx>
Date: Thu, 22 Mar 2007 12:24:42 +1100
Cc: <pcp@xxxxxxxxxxx>
In-reply-to: <1174523743.5051.439.camel@edge>
Sender: pcp-bounce@xxxxxxxxxxx
Thread-index: AcdsGbM2k32LYMqNS3u/Kyr2orTqxwABp1/A
How about this? That way you can still trap these if you are debugging an
agent.


                else if (sts != PM_ERR_APPVERSION) {
                    __pmNotifyErr(LOG_ERR,
                                 "pmdaFetch: Fetch callback error: %s\n",
                                 pmErrStr(sts)); 
                } else if (pmDebug & DBG_TRACE_LIBPMDA) {
                    __pmNotifyErr(LOG_ERR,
                                        "pmdaFetch: Unsupported metric
%s\n", pmIDStr(dp->pmid));
                }

David


-----Original Message-----
From: Nathan Scott [mailto:nscott@xxxxxxxxxx] 
Sent: Thursday, 22 March 2007 11:36 AM
To: dchatterton@xxxxxxxxxx
Cc: pcp@xxxxxxxxxxx
Subject: Possibly quirky libpcp_pmda behavior?

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


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