Hello,
Here s my problem (which I can't solve since a long long tiiiime), I can live with it but I was wondering if it could be solved :)
1/ I have a perl script reading a XML file :
<conf name="snoopdogg" serial="1" target="172.16.1.3">
<services>
<service name="cpu">
<plugins>
<plugin name="cpu" target="172.16.1.3" schedule="60">
<probes>
<probe name="load1">
<warn value="4" operator=">"/>
<crit value="10" operator=">"/>
</probe>
(...)
2/ I read it this way :
my $configuration = $xml->XMLin(
$conf,
GroupTags => { services => 'service',
plugins => 'plugin',
probes => 'probe'
},
ForceArray => [ qw(service plugin probe) ],
KeyAttr => { 'service' => 'name',
'plugin' => 'name',
'probe' => 'name'
},
KeepRoot => 0
);
The problem is the following :
I want to access a probe's warn value, to do so I have to :
my $warn = $configuration->{snoopdogg}{services}{cpu}{plugins}{cpu}{pr
+obes}{load1}{warn}{value};
What I would like is to access the value this way :
my $warn = $configuration->{snoopdogg}{cpu}{cpu}{load1}{warn}{value};
Is there a way with XML::Simple to achieve something like
GroupTags => { services => 'service' => name }
Thank you very much ! :)