Skip Menu |

This queue is for tickets about the Nagios-Object CPAN distribution.

Report information
The Basics
Id: 47781
Status: resolved
Priority: 0/
Queue: Nagios-Object

People
Owner: duncan_j_ferguson [...] yahoo.co.uk
Requestors: payerle [...] physics.umd.edu
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.21.5
Fixed in: (no value)



Subject: Nagios::Object::Config not handling include_file=, include_dir= directives
There appears to be a poorly (if at all) documented feature in nagios object configuration files for including other files: the include_file=_path_to_file_ and include_dir=_path_to_dir_ Seem to operate much like cfg_file, cfg_dir, but also appear to be allowed in object config files (not sure if available in main config, but cfg_file/cfg_dir seem to do same thing.) Since someone at our site discovered this "feature" way back, we make heavy use of, and w/out attached patch most of our config is silently ignored. Have only tested the include_file portion of patch, and not positive if include_dir requires the .cfg suffix or not (am planning to submit documentation bug report to Nagios re this). Thanks for the package. Looks like will be quite useful here.
Subject: patch.diff
diff -Naur Nagios-Object-0.21.5/lib/Nagios/Object/Config.pm Nagios-Object-0.21.5-patched/lib/Nagios/Object/Config.pm --- Nagios-Object-0.21.5/lib/Nagios/Object/Config.pm 2009-06-08 11:16:32.000000000 -0400 +++ Nagios-Object-0.21.5-patched/lib/Nagios/Object/Config.pm 2009-07-10 15:11:45.000000000 -0400 @@ -180,6 +180,24 @@ $append = undef; } + if ( $line =~ /include_file\s*=\s*([\w\-\/\\\:\.]+)/ ) + { my $incfile = $1; + $self->parse($incfile); + next; + } + if ( $line =~ /include_dir\s*=\s*([\w\-\/\\\:\.]+)/ ) + { my $incdir = $1; + opendir(INCDIR, $incdir) or next; #Just ignore if can't open directory? + my @files = readdir(INCDIR); + closedir(INCDIR); + @files = grep /\.cfg$/, @files; #Only want *.cfg files + @files = grep { -f "$incdir/$_" } @files; #Only want files + foreach my $file (@files) + { $self->parse($file); + } + next; + } + # end of object definition # Some object attributes are strings, which can contain a right-curly bracket and confuse this parser: # - The proper fix would be to make the parser sensitive to arbitrary string attributes, but I will just
I have applied the code patch - could you also please supply a suitable doc patch? Thanks Duncs
From: payerle [...] umd.edu
Sorry for delayed response --- I did not originally notice your request. I do not see a need for update to Nagios::Object et al documentation, as that documentation does not go into detail re Nagios configuration commands anyway. I submitted a report to the main Nagios application RT ( http://tracker.nagios.org/bug_view_advanced_page.php?bug_id=55&history=1#history) requesting their documentation be updated, but no action has been taken. But I think the Perl module bug can be closed (successfully fixed; thank you.) On Fri Jul 17 09:10:55 2009, duncs wrote Show quoted text
> I have applied the code patch - could you also please supply a suitable > doc patch?
Thanks for the update