r40095 - in /branches/upstream/libnagios-object-perl/current: Build.PL ChangeLog MANIFEST META.yml lib/Nagios/Host.pm lib/Nagios/Object/Config.pm lib/Nagios/Service.pm t/01object-inheritance.t t/70status.dat t/70status.t t/v2_config/servicegroups.cfg

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Fri Jul 17 23:16:01 UTC 2009


Author: jawnsy-guest
Date: Fri Jul 17 23:15:52 2009
New Revision: 40095

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=40095
Log:
[svn-upgrade] Integrating new upstream version, libnagios-object-perl (0.21.6)

Added:
    branches/upstream/libnagios-object-perl/current/lib/Nagios/Host.pm
    branches/upstream/libnagios-object-perl/current/lib/Nagios/Service.pm
    branches/upstream/libnagios-object-perl/current/t/01object-inheritance.t
    branches/upstream/libnagios-object-perl/current/t/70status.dat
    branches/upstream/libnagios-object-perl/current/t/70status.t
    branches/upstream/libnagios-object-perl/current/t/v2_config/servicegroups.cfg
Modified:
    branches/upstream/libnagios-object-perl/current/Build.PL
    branches/upstream/libnagios-object-perl/current/ChangeLog
    branches/upstream/libnagios-object-perl/current/MANIFEST
    branches/upstream/libnagios-object-perl/current/META.yml
    branches/upstream/libnagios-object-perl/current/lib/Nagios/Object/Config.pm

Modified: branches/upstream/libnagios-object-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/Build.PL?rev=40095&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/Build.PL (original)
+++ branches/upstream/libnagios-object-perl/current/Build.PL Fri Jul 17 23:15:52 2009
@@ -4,7 +4,7 @@
 
 my $build = Module::Build->new(
     dist_name => 'Nagios-Object',
-    dist_version => "0.21.5",
+    dist_version => "0.21.6",
     dist_author => 'Duncan Ferguson <duncs at cpan.org>',
     dist_abstract => 'Nagios::Object - Nagios object configuration parsing.',
     license => 'gpl',

Modified: branches/upstream/libnagios-object-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/ChangeLog?rev=40095&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/ChangeLog (original)
+++ branches/upstream/libnagios-object-perl/current/ChangeLog Fri Jul 17 23:15:52 2009
@@ -99,3 +99,4 @@
        - Apply patch from Jason Smith - RT#46495
        - Apply patch from Jason Smith - RT#46497
 0.21.5 - Rerelease to pick up missing test files
+0.21.6 - Apply patch from 'PAYERLE' - RT#47781

Modified: branches/upstream/libnagios-object-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/MANIFEST?rev=40095&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/MANIFEST (original)
+++ branches/upstream/libnagios-object-perl/current/MANIFEST Fri Jul 17 23:15:52 2009
@@ -1,64 +1,69 @@
+bin/config_status_demo.pl
+bin/decode_flags.pl
+bin/parse.pl
+bin/statusdat_demo.pl
+bin/test_configuration.pl
+Build.PL
+ChangeLog
+lib/Nagios/Config.pm
+lib/Nagios/Config/File.pm
+lib/Nagios/Host.pm
+lib/Nagios/Object.pm
+lib/Nagios/Object/Config.pm
+lib/Nagios/Service.pm
+lib/Nagios/StatusLog.pm
+MANIFEST
+META.yml
+README
 t/00object.t
+t/01object-inheritance.t
 t/05object_config.t
 t/10config_file.t
 t/50config.t
 t/51config-wildcards.t
 t/54dump.t
+t/60flexible-attributes.t
+t/60flexible-attributes1.cfg
+t/60flexible-attributes2.cfg
+t/70status.dat
+t/70status.t
+t/98nagios-sample-config.t
 t/99config-extend.t
+t/hostgroup_hostgroups.cfg
+t/hostgroup_hostgroups.t
+t/jfrancois.cfg
+t/jfrancois.pl
+t/multi_type_entries.cfg
+t/multi_type_entries.t
+t/nagios-missing-file.cfg
 t/nagios.cfg
-t/nagios-missing-file.cfg
-t/status.log
-t/statuslog.t
-t/v2log.dat
-t/testconfig2.cfg
-t/testconfig3.cfg
-t/testconfig.cfg
 t/nagios2config.t
 t/nestedtemplates.cfg
 t/nestedtemplates.t
 t/sample-config-bigger.cfg
 t/sample-config-minimal.cfg
-t/98nagios-sample-config.t
-t/jfrancois.pl
-t/jfrancois.cfg
-t/v2_wildcards.cfg
+t/sample-config-v3.cfg
+t/status.log
+t/statuslog.t
+t/testconfig.cfg
+t/testconfig2.cfg
+t/testconfig3.cfg
 t/v2_config/cgi.cfg
+t/v2_config/checkcommands.cfg
+t/v2_config/contactgroups.cfg
+t/v2_config/contacts.cfg
+t/v2_config/dependencies.cfg
+t/v2_config/escalations.cfg
 t/v2_config/hostextinfo.cfg
-t/v2_config/contacts.cfg
-t/v2_config/nagios.cfg
-t/v2_config/dependencies.cfg
-t/v2_config/resource.cfg
-t/v2_config/checkcommands.cfg
+t/v2_config/hostgroups.cfg
 t/v2_config/hosts.cfg
-t/v2_config/serviceextinfo.cfg
-t/v2_config/contactgroups.cfg
-t/v2_config/escalations.cfg
-t/v2_config/hostgroups.cfg
 t/v2_config/minimal.cfg
 t/v2_config/misccommands.cfg
+t/v2_config/nagios.cfg
+t/v2_config/resource.cfg
+t/v2_config/serviceextinfo.cfg
+t/v2_config/servicegroups.cfg
 t/v2_config/services.cfg
 t/v2_config/timeperiods.cfg
-t/multi_type_entries.cfg
-t/hostgroup_hostgroups.cfg
-t/multi_type_entries.t
-t/hostgroup_hostgroups.t
-Build.PL
-MANIFEST
-META.yml
-README
-ChangeLog
-bin/test_configuration.pl
-bin/config_status_demo.pl
-bin/parse.pl
-bin/decode_flags.pl
-bin/statusdat_demo.pl
-lib/Nagios/Config/File.pm
-lib/Nagios/Object/Config.pm
-lib/Nagios/Object.pm
-lib/Nagios/Config.pm
-lib/Nagios/StatusLog.pm
-t/60flexible-attributes.t
-t/60flexible-attributes1.cfg
-t/60flexible-attributes2.cfg
-t/sample-config-v3.cfg
-
+t/v2_wildcards.cfg
+t/v2log.dat

Modified: branches/upstream/libnagios-object-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/META.yml?rev=40095&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/META.yml (original)
+++ branches/upstream/libnagios-object-perl/current/META.yml Fri Jul 17 23:15:52 2009
@@ -1,6 +1,6 @@
 ---
 name: Nagios-Object
-version: 0.21.5
+version: 0.21.6
 author:
   - 'Duncan Ferguson <duncs at cpan.org>'
 abstract: 'Nagios::Object - Nagios object configuration parsing.'
@@ -24,8 +24,8 @@
     file: lib/Nagios/Config/File.pm
     version: 35
   Nagios::Host:
-    file: lib/Nagios/Object.pm
-    version: 0
+    file: lib/Nagios/Host.pm
+    version: 0.21
   Nagios::Host::Status:
     file: lib/Nagios/StatusLog.pm
     version: 0.1
@@ -40,13 +40,13 @@
     version: 38
   Nagios::Object::Config:
     file: lib/Nagios/Object/Config.pm
-    version: 35
+    version: 36
   Nagios::Program::Status:
     file: lib/Nagios/StatusLog.pm
     version: 0.1
   Nagios::Service:
-    file: lib/Nagios/Object.pm
-    version: 0
+    file: lib/Nagios/Service.pm
+    version: 0.21
   Nagios::Service::Status:
     file: lib/Nagios/StatusLog.pm
     version: 0.1
@@ -56,7 +56,7 @@
   Nagios::StatusLog:
     file: lib/Nagios/StatusLog.pm
     version: 38
-generated_by: Module::Build version 0.32
+generated_by: Module::Build version 0.33
 meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.2.html
-  version: 1.2
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4

Added: branches/upstream/libnagios-object-perl/current/lib/Nagios/Host.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/lib/Nagios/Host.pm?rev=40095&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/lib/Nagios/Host.pm (added)
+++ branches/upstream/libnagios-object-perl/current/lib/Nagios/Host.pm Fri Jul 17 23:15:52 2009
@@ -1,0 +1,47 @@
+package Nagios::Host;
+use base qw( Nagios::Object Nagios::Object::Config );
+our $VERSION = '0.21';
+
+=pod
+
+No documentation here yet.  This module may not even survive on it's own.
+There is one method, list_services which will list all the services for a
+host.  It's very slow though.
+
+=cut
+
+# really slow, brute force way of listing services
+sub list_services {
+    my $self = shift;
+    my $conf = $self->{object_config_object};
+
+    my @retval = ();
+    foreach my $s ( $conf->list_services ) {
+        next if ( !$s->service_description );
+        if ( $s->host_name ) {
+            foreach my $h ( @{$s->host_name} ) {
+                if ( $h->host_name eq $self->host_name ) {
+                    push( @retval, $s );
+                }
+            }
+        }
+        if ( $s->hostgroup_name ) {
+            foreach my $hg ( @{$s->hostgroup_name} ) {
+                foreach my $h ( @{$hg->members} ) {
+                    if ( $h->host_name eq $self->host_name ) {
+                        push( @retval, $s );
+                    }
+                }
+           }
+        }
+    }
+    return @retval;
+}
+
+# I use a patched version of Nagios right now, so I need these to
+# keep the parser from bombing. (Al Tobey)
+sub snmp_community { }
+sub set_snmp_community { }
+
+1;
+

Modified: branches/upstream/libnagios-object-perl/current/lib/Nagios/Object/Config.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/lib/Nagios/Object/Config.pm?rev=40095&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/lib/Nagios/Object/Config.pm (original)
+++ branches/upstream/libnagios-object-perl/current/lib/Nagios/Object/Config.pm Fri Jul 17 23:15:52 2009
@@ -27,7 +27,7 @@
 
 # NOTE: due to CPAN version checks this cannot currently be changed to a
 # standard version string, i.e. '0.21'
-our $VERSION = '35';
+our $VERSION = '36';
 our $fast_mode = undef;
 our $strict_mode = undef;
 
@@ -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

Added: branches/upstream/libnagios-object-perl/current/lib/Nagios/Service.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/lib/Nagios/Service.pm?rev=40095&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/lib/Nagios/Service.pm (added)
+++ branches/upstream/libnagios-object-perl/current/lib/Nagios/Service.pm Fri Jul 17 23:15:52 2009
@@ -1,0 +1,12 @@
+package Nagios::Service;
+
+our $VERSION = '0.21';
+
+=pod
+
+This is an empty module right now.  Please see Nagios::Object where the bulk
+of Nagios::Service is generated.
+
+=cut
+
+1;

Added: branches/upstream/libnagios-object-perl/current/t/01object-inheritance.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/01object-inheritance.t?rev=40095&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/01object-inheritance.t (added)
+++ branches/upstream/libnagios-object-perl/current/t/01object-inheritance.t Fri Jul 17 23:15:52 2009
@@ -1,0 +1,32 @@
+#!/usr/bin/perl -w
+
+use lib qw( ../lib ./lib );
+use Test::More qw(no_plan);
+use Test::NoWarnings;
+
+use_ok( 'Nagios::Object' );
+
+diag( "creating an object ..." ) if ( $ENV{TEST_VERBOSE} );
+my $tp = Nagios::TimePeriod->new(
+      timeperiod_name => '24x7',
+      alias           => '24x7',
+      sunday          => '00:00-24:00',
+      monday          => '00:00-12:00,12:00-24:00',
+      tuesday         => '00:00-24:00',
+      wednesday       => '00:00-24:00',
+      thursday        => '00:00-24:00',
+      friday          => '00:00-24:00',
+      saturday        => '00:00-24:00'
+);
+isa_ok( $tp, 'Nagios::Object' );
+is( $tp->use, undef, "use() should return undef for top-level objects" );
+
+my $next = $tp->new(
+    timeperiod_name => 'child',
+    alias           => 'child',
+    sunday          => '00:01-23:01'
+);
+
+is( $next->use, '24x7', "child object should know its parent's name" );
+isa_ok( $next, 'Nagios::Object' );
+

Added: branches/upstream/libnagios-object-perl/current/t/70status.dat
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/70status.dat?rev=40095&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/70status.dat (added)
+++ branches/upstream/libnagios-object-perl/current/t/70status.dat Fri Jul 17 23:15:52 2009
@@ -1,0 +1,185 @@
+########################################
+#          NAGIOS STATUS FILE
+#
+# THIS FILE IS AUTOMATICALLY GENERATED
+# BY NAGIOS.  DO NOT MODIFY THIS FILE!
+########################################
+
+info {
+	created=1233914050
+	version=3.0.6
+	}
+
+programstatus {
+	modified_host_attributes=0
+	modified_service_attributes=0
+	nagios_pid=11378
+	daemon_mode=1
+	program_start=1233854797
+	last_command_check=1233914049
+	last_log_rotation=1233878400
+	enable_notifications=1
+	active_service_checks_enabled=1
+	passive_service_checks_enabled=1
+	active_host_checks_enabled=1
+	passive_host_checks_enabled=1
+	enable_event_handlers=1
+	obsess_over_services=0
+	obsess_over_hosts=0
+	check_service_freshness=1
+	check_host_freshness=1
+	enable_flap_detection=1
+	enable_failure_prediction=1
+	process_performance_data=1
+	global_host_event_handler=
+	global_service_event_handler=
+	next_comment_id=469
+	next_downtime_id=469
+	next_event_id=135
+	next_problem_id=89
+	next_notification_id=564
+	total_external_command_buffer_slots=10000
+	used_external_command_buffer_slots=0
+	high_external_command_buffer_slots=0
+	active_scheduled_host_check_stats=0,0,0
+	active_ondemand_host_check_stats=3,10,31
+	passive_host_check_stats=0,0,0
+	active_scheduled_service_check_stats=8,48,146
+	active_ondemand_service_check_stats=0,0,0
+	passive_service_check_stats=0,0,0
+	cached_host_check_stats=2,9,27
+	cached_service_check_stats=0,0,0
+	external_command_stats=0,0,0
+	parallel_host_check_stats=1,1,3
+	serial_host_check_stats=0,0,0
+	}
+
+hoststatus {
+	host_name=doesnt_exist_1
+	modified_attributes=1
+	check_command=check_host_15!-H $HOSTADDRESS$ -t 3 -w 500.0,80% -c 1000.0,100%
+	check_period=
+	notification_period=24x7
+	check_interval=0.000000
+	retry_interval=1.000000
+	event_handler=
+	has_been_checked=1
+	should_be_scheduled=0
+	check_execution_time=3.186
+	check_latency=0.067
+	check_type=0
+	current_state=2
+	last_hard_state=2
+	last_event_id=24
+	current_event_id=31
+	current_problem_id=18
+	last_problem_id=0
+	plugin_output=CRITICAL - 192.168.50.10: rta nan, lost 100%
+	long_plugin_output=
+	performance_data=rta=0.000ms;500.000;1000.000;0; pl=100%;80;100;;
+	last_check=1233216743
+	next_check=0
+	check_options=0
+	current_attempt=1
+	max_attempts=2
+	current_event_id=31
+	last_event_id=24
+	state_type=1
+	last_state_change=1233216701
+	last_hard_state_change=1233216701
+	last_time_up=1231947413
+	last_time_down=1231947569
+	last_time_unreachable=1231947633
+	last_notification=1233911011
+	next_notification=1233914611
+	no_more_notifications=0
+	current_notification_number=46
+	current_notification_id=553
+	notifications_enabled=1
+	problem_has_been_acknowledged=0
+	acknowledgement_type=0
+	active_checks_enabled=1
+	passive_checks_enabled=1
+	event_handler_enabled=0
+	flap_detection_enabled=1
+	failure_prediction_enabled=1
+	process_performance_data=1
+	obsess_over_host=0
+	last_update=1233914050
+	is_flapping=0
+	percent_state_change=0.00
+	scheduled_downtime_depth=0
+	}
+
+servicestatus {
+	host_name=doesnt_exist_1
+	service_description=TCP/IP
+	modified_attributes=1
+	check_command=check_icmp!-H $HOSTADDRESS$ -w 100.0,20% -c 500.0,60%
+	check_period=24x7
+	notification_period=24x7
+	check_interval=5.000000
+	retry_interval=1.000000
+	event_handler=
+	has_been_checked=1
+	should_be_scheduled=1
+	check_execution_time=3.677
+	check_latency=0.218
+	check_type=0
+	current_state=2
+	last_hard_state=2
+	last_event_id=0
+	current_event_id=23
+	current_problem_id=17
+	last_problem_id=0
+	current_attempt=1
+	max_attempts=3
+	current_event_id=23
+	last_event_id=0
+	state_type=1
+	last_state_change=1233216735
+	last_hard_state_change=1233216735
+	last_time_ok=1231947411
+	last_time_warning=0
+	last_time_unknown=0
+	last_time_critical=1233914007
+	plugin_output=CRITICAL - 192.168.50.10: rta nan, lost 100%
+	long_plugin_output=
+	performance_data=rta=0.000ms;100.000;500.000;0; pl=100%;20;60;;
+	last_check=1233914007
+	next_check=1233914307
+	check_options=0
+	current_notification_number=0
+	current_notification_id=0
+	last_notification=0
+	next_notification=0
+	no_more_notifications=0
+	notifications_enabled=1
+	active_checks_enabled=1
+	passive_checks_enabled=1
+	event_handler_enabled=1
+	problem_has_been_acknowledged=0
+	acknowledgement_type=0
+	flap_detection_enabled=1
+	failure_prediction_enabled=1
+	process_performance_data=1
+	obsess_over_service=0
+	last_update=1233914050
+	is_flapping=0
+	percent_state_change=0.00
+	scheduled_downtime_depth=0
+	}
+
+contactstatus {
+	contact_name=admin
+	modified_attributes=0
+	modified_host_attributes=0
+	modified_service_attributes=0
+	host_notification_period=24x7
+	service_notification_period=24x7
+	last_host_notification=0
+	last_service_notification=0
+	host_notifications_enabled=1
+	service_notifications_enabled=1
+	}
+

Added: branches/upstream/libnagios-object-perl/current/t/70status.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/70status.t?rev=40095&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/70status.t (added)
+++ branches/upstream/libnagios-object-perl/current/t/70status.t Fri Jul 17 23:15:52 2009
@@ -1,0 +1,20 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+use Test::NoWarnings;
+use Test::Exception;
+
+use lib qw( ../lib ./lib );
+use Nagios::StatusLog;
+
+my $host = 'localhost';
+
+( my $filename = $0 ) =~ s/t$/dat/;
+
+my $log = Nagios::StatusLog->new(
+    Filename => $filename,
+    Version  => 3,
+);
+
+isa_ok($log, 'Nagios::StatusLog');

Added: branches/upstream/libnagios-object-perl/current/t/v2_config/servicegroups.cfg
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/v2_config/servicegroups.cfg?rev=40095&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/v2_config/servicegroups.cfg (added)
+++ branches/upstream/libnagios-object-perl/current/t/v2_config/servicegroups.cfg Fri Jul 17 23:15:52 2009
@@ -1,0 +1,26 @@
+################################################################################
+# Sample object config file for Nagios 
+#
+# Read the documentation for more information on this configuration file.  I've
+# provided some comments here, but things may not be so clear without further
+# explanation, so make sure to read the HTML documentation!
+# 
+# Last Modified: 11 Mar 2009
+#
+################################################################################
+
+
+################################################################################
+# SERVICE GROUP DEFINITIONS
+#
+# SYNTAX:
+#
+################################################################################
+
+# 'novell-servers' host group definition
+define servicegroup{
+	servicegroup_name	svcgroup1
+	alias		Service Group 1
+	members		novell1, FTP, novell1, POP3, novell2, SMTP
+	}
+




More information about the Pkg-perl-cvs-commits mailing list