pcp
[Top] [All Lists]

Re: [pcp] PMDA CIFS

To: AurÃlien Aptel <aurelien.aptel+pcp@xxxxxxxxx>
Subject: Re: [pcp] PMDA CIFS
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Tue, 3 Sep 2013 19:06:20 -0400 (EDT)
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <CA+5B0FPNLbOCOuxPzVCiZN5jevdVy8m7osaTopDWY1tbezCKPA@xxxxxxxxxxxxxx>
References: <CA+5B0FNcq2X8EnNf35nMDGfu2Y5pSgOABVao7umiNiyNOjvFXw@xxxxxxxxxxxxxx> <2018836669.6550029.1377571301699.JavaMail.root@xxxxxxxxxx> <CA+5B0FOJCgd3_432=3n+OSHOAtxJ7RwHkivwnKqkmEUJC9uuKg@xxxxxxxxxxxxxx> <465361629.9900993.1377812441964.JavaMail.root@xxxxxxxxxx> <CA+5B0FPNLbOCOuxPzVCiZN5jevdVy8m7osaTopDWY1tbezCKPA@xxxxxxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: NoqjleUVj5vZUeyDkwjTppGak+8uTw==
Thread-topic: PMDA CIFS
Hi,

----- Original Message -----
> I'm almost done

Good work!  :)

> but I *still* don't get how pmda_inst_lookup() and
> hash-indom work...
> 
> I have the following at the end of cifs_fetch():
> 
>     $PMDA->replace_indom(ALL_MOUNT_INDOM, \%SHARES);
>     $PMDA->replace_indom(SMB1_MOUNT_INDOM, \%smb1);
>     $PMDA->replace_indom(SMB2_MOUNT_INDOM, \%smb2);
>     $PMDA->log("fetch: ".Dumper(\%smb1));

Is there an initial call somewhere like pmdasimple does:

$now_indom = $pmda->add_indom($now_indom, {}, '', ''); # initialized on-the-fly

> And this in the cifs_fetch() callback:
> 
>     my ($cluster, $item, $inst) = @_;
>     my $pmid = pmda_pmid($cluster, $item);
>     my $indom = $PMID_INDOM{$pmid};
> 
>     if ($inst != PM_IN_NULL && $indom != PM_INDOM_NULL) {
>         my $v = pmda_inst_lookup($indom, $inst);
>         $PMDA->log("fetch_cb: ".Dumper($v));
>     }
> ...
> Why is $v undefined? It should be set to a hashref of a share set
> above in fetch()!

Not sure without the rest of the code to experiment on; from a look
over in src/perl/PMDA/PMDA.xs which has the pmda_inst_lookup code,
there are three reasons why undef might be returned.  The first
two would be caused by the missing add_indom call above, the third
appears to be pmdaCacheLookup not finding an active instance.  If
it is not obvious, send thru the code & I'll take a look - and/or,
try instrumenting the PMDA.xs code to see which undef return point
is being triggered (__pmNotifyErr(LOG_DEBUG,... will work there).

cheers.

--
Nathan

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