[Israel.pm] Hash cleanup

Berler Chanan bc.other at gmail.com
Mon Mar 30 05:01:57 PDT 2009


Not like that, I have the nagios.log file parsed into the MySQL db
And need to run and collect data from it, and create the reports for SLA,
Availability....

My idea, was to create a dynamic sql statement, run it and collect the data
I need to display the reports needed.
For SLA report, I need run / and undef the building structure for each month
- therefore I need to undef the hash
I build each loop. The only Issue I found now, that lakes on my structure,
it that nagios can have lots of hosts, 
With lots of services, will the structure hold for so many of them (like
1000 hosts, with 1000~ services each).

My question is: will undef %uptime_data should be enough ? will the Perl GC
handle the memory for me.
As I understood it will... 

Thanks
Chanan

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of sawyer x
Sent: Monday, March 30, 2009 10:49 AM
To: Perl in Israel
Subject: Re: [Israel.pm] Hash cleanup

Hi

I'm having the same technical issue with Nagios. What I do is keep a
scalar as a template, and run loops that determine each time each host
and then create the host entry using the template, and put it in
another scalar. That way I keep adding hosts to it within these loops
till I got a scalar complete with everything. Then I write that scalar
in a definitions file.

If your current situation is using a hash for all of them and
considering it's legacy code (global! oh my god, the horror! :) ),
then it probably won't be easy at all for you to convert it to loops.

But, I'm going to rewrite it in the near future and do it with Moose
objects and subtypes and Template Toolkit. That way each host and
service is an object, and the subtypes make sure that I'm feeding (or
reading from a conf) the correct type of the field. The Template
Toolkit will help me define and create templates more easily.

The best way to keep the information would obviously be a MySQL DB but
sometimes it's too much overhead. When you deal with multiple servers,
or have a lot of changes.. you'll need to either write (and maintain)
a web interface or program to help maintain the database to help
maintain Nagios to help maintain servers. It's a lot of hassle. I use
YAML (or JSON) configuration files. Easier to ship, easier to edit.
Usually.
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://mail.perl.org.il/mailman/listinfo/perl
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.238 / Virus Database: 270.11.31/2028 - Release Date: 03/29/09
16:56:00



More information about the Perl mailing list