Hi All,
I have a global hash variable which look more like this:
$sla_output{host}{Monitor}{service}{CPU}{total_SLA_UP} = 100;
$sla_output{host}{Monitor}{service}{CPU}{total_SLA_DOWN} = 100;
$sla_output{host}{Monitor}{service}{CPU}{total_SLA_DOWNTIME} = 100;
$sla_output{host}{Monitor}{service}{MEM}{total_SLA_UP} = 100;
$sla_output{host}{Monitor}{service}{MEM}{total_SLA_DOWN} = 100;
$sla_output{host}{Monitor}{service}{MEM}{total_SLA_DOWNTIME} = 100;
.
.
.
$sla_output{host}{win9x}{service}{TEMP}{total_SLA_UP} = 100;
$sla_output{host}{ win9x}{service}{TEMP}{total_SLA_DOWN} = 100;
$sla_output{host}{ win9x}{service}{TEMP}{total_SLA_DOWNTIME} = 100;
$sla_output{host}{ win9x }{service}{DISKSPACE}{total_SLA_UP} = 100;
$sla_output{host}{ win9x }{service}{DISKSPACE}{total_SLA_DOWN} = 100;
$sla_output{host}{ win9x }{service}{DISKSPACE}{total_SLA_DOWNTIME} = 100;
(Please I beg you, don't ask why global – legacy issues)
(owh, and lazy me, not all services has 100%...but I am tired of changing the
values…☺)
My question:
Since I am looping each time with different hostgroups (each hostgroup has a
list members of hosts – see nagios).
I need to do a mass clean up of this hash (I should have used mess, totally I
will agree).
Q: how can I do that ?
Should I use undef(%sla_output) ??! I am not sure (would have guessed
otherwise)
Should I look the keys, and loop the keys of keys and do undef for each and
one of the keys ? I am not sure either
Which course should I use ? should I act otherwise if I got same structure
but one of the keys of keys is a hash_ref to an array
(although this is not the case, I do have same kind of structure with hash
ref to an array, and I wonder if it leaves any memory leaks)
Thanks
Chanan
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl