[collectd] exec-nagios and pseudo-hashes
Florian Forster
octo at verplant.org
Tue Feb 24 12:24:32 CET 2009
Hi Tom,
`exec-nagios.px' uses the `Config::General' Perl module to parse the
configuration. Since that module has no knowlege of the structure of the
config file, the returned structure depends on the configuration. That
sucks, but is common with script languages :/
On Mon, Feb 23, 2009 at 04:50:03PM -0500, Tom Throckmorton wrote:
> In this case, the script returns an error:
>
> | Pseudo-hashes are deprecated at ./exec-nagios.px line 126.
> | No such pseudo-hash field "script" at ./exec-nagios.px line 126.
Could you please add the following lines _before_ line 126 to get some
more useful output?
require Data::Dumper;
print Data::Dumper->Dump ([$opts, $script], ['opts', 'script']);
> Before I get too deep, can anyone recommend a good way to
> address/correct this?
My guess is that, when two identical blocks are found, they are returned
as an array-reference rather than a hash-reference. If I'm right, the
solution would be something like this:
if (ref ($opts) eq 'ARRAY')
{
for (@$opts)
{
my $opt = $_;
do_something ($opt);
}
}
else
{
do_something ($opts);
}
Regards,
-octo
--
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090224/87512044/attachment.pgp
More information about the collectd
mailing list