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
|