r66113 - in /branches/upstream/libnagios-object-perl/current: Build.PL ChangeLog MANIFEST META.yml t/find_object-template.cfg t/find_object-template.t t/group_membership.cfg t/group_membership.t t/service_escalation.cfg t/service_escalation.t
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Wed Dec 22 09:37:56 UTC 2010
Author: carnil
Date: Wed Dec 22 09:37:32 2010
New Revision: 66113
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66113
Log:
[svn-upgrade] new version libnagios-object-perl (0.21.14)
Added:
branches/upstream/libnagios-object-perl/current/t/find_object-template.cfg
branches/upstream/libnagios-object-perl/current/t/find_object-template.t
branches/upstream/libnagios-object-perl/current/t/group_membership.cfg
branches/upstream/libnagios-object-perl/current/t/group_membership.t
branches/upstream/libnagios-object-perl/current/t/service_escalation.cfg
branches/upstream/libnagios-object-perl/current/t/service_escalation.t
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
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=66113&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/Build.PL (original)
+++ branches/upstream/libnagios-object-perl/current/Build.PL Wed Dec 22 09:37:32 2010
@@ -13,7 +13,7 @@
},
dist_name => 'Nagios-Object',
- dist_version => "0.21.13",
+ dist_version => "0.21.14",
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=66113&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/ChangeLog (original)
+++ branches/upstream/libnagios-object-perl/current/ChangeLog Wed Dec 22 09:37:32 2010
@@ -116,3 +116,4 @@
- Allow for nested group membership. Thanks to PIRZYK (RT#63804)
- Ensure host membership lists are consistent. Thanks to PIRZYK (RT#63808)
- Allow for name() method to not be unique on service objects. Thanks to PIRZYK (RT#63806)
+0.21.14 - Re-release to include extra test files missed previously
Modified: branches/upstream/libnagios-object-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/MANIFEST?rev=66113&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/MANIFEST (original)
+++ branches/upstream/libnagios-object-perl/current/MANIFEST Wed Dec 22 09:37:32 2010
@@ -29,6 +29,10 @@
t/98nagios-sample-config.t
t/99config-extend.t
t/continuation_lines.t
+t/find_object-template.cfg
+t/find_object-template.t
+t/group_membership.cfg
+t/group_membership.t
t/hostgroup_hostgroups.cfg
t/hostgroup_hostgroups.t
t/jfrancois.cfg
@@ -44,6 +48,8 @@
t/sample-config-bigger.cfg
t/sample-config-minimal.cfg
t/sample-config-v3.cfg
+t/service_escalation.cfg
+t/service_escalation.t
t/status.log
t/statuslog.t
t/testconfig.cfg
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=66113&op=diff
==============================================================================
--- branches/upstream/libnagios-object-perl/current/META.yml (original)
+++ branches/upstream/libnagios-object-perl/current/META.yml Wed Dec 22 09:37:32 2010
@@ -65,4 +65,4 @@
homepage: http://github.com/duncs/perl-nagios-object
license: http://www.gnu.org/licenses/old-licenses/gpl-1.0.txt
repository: http://github.com/duncs/perl-nagios-object
-version: v0.21.13
+version: v0.21.14
Added: branches/upstream/libnagios-object-perl/current/t/find_object-template.cfg
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/find_object-template.cfg?rev=66113&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/find_object-template.cfg (added)
+++ branches/upstream/libnagios-object-perl/current/t/find_object-template.cfg Wed Dec 22 09:37:32 2010
@@ -1,0 +1,61 @@
+###############################################################################
+#
+# HostEscalation Objects
+#
+###############################################################################
+
+define hostescalation{
+ name hostescalation-template
+ first_notification 4
+ last_notification 10
+ notification_interval 60
+ contact_groups all-escalation
+ register 0
+}
+
+define hostescalation{
+ use hostescalation-template
+ host_name host1
+}
+
+###############################################################################
+#
+# ServiceDependency Objects
+#
+###############################################################################
+
+define servicedependency{
+ name servicedependency-template
+ execution_failure_criteria n
+ notification_failure_criteria w,u,c
+ register 0
+}
+
+define servicedependency{
+ use servicedependency-template
+ host_name host1
+ service_description http check
+ dependent_host_name host1
+ dependent_service_description http process check
+}
+
+###############################################################################
+#
+# ServiceEscalation Objects
+#
+###############################################################################
+
+define serviceescalation{
+ name serviceescalation-template
+ first_notification 4
+ last_notification 10
+ notification_interval 60
+ contact_groups all-escalation
+ register 0
+}
+
+define serviceescalation{
+ use serviceescalation-template
+ host_name host1
+ service_description http check
+}
Added: branches/upstream/libnagios-object-perl/current/t/find_object-template.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/find_object-template.t?rev=66113&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/find_object-template.t (added)
+++ branches/upstream/libnagios-object-perl/current/t/find_object-template.t Wed Dec 22 09:37:32 2010
@@ -1,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw( ../lib ./lib );
+
+BEGIN { plan tests => 3 }
+
+use Nagios::Object::Config;
+
+my $err = 0;
+my $file = 'find_object-template.cfg';
+
+my @types = qw/Nagios::ServiceEscalation Nagios::HostEscalation Nagios::ServiceDependency/;
+my @methods = qw/list_serviceescalations list_hostescalations list_servicedependencies/;
+
+eval { chdir('t'); };
+
+my $obj = Nagios::Object::Config->new();
+$obj->parse($file) || die "Could not parse object file ($file)\n";
+$obj->resolve_objects();
+
+for (my $i = 0; $i < scalar @types; $i++) {
+ my $method = $methods[$i];
+ foreach my $o ( @{$obj->$method()} ) {
+ # If we have use a template, find that object.
+ if ( exists $o->{'use'} && defined $o->{'use'} ) {
+ my $res = $obj->find_object($o->{'use'}, $types[$i]);
+ my $ref = ref $res;
+ ok( $ref eq $types[$i], "Looking for a $types[$i] object" );
+ }
+ }
+}
+
+exit $err;
Added: branches/upstream/libnagios-object-perl/current/t/group_membership.cfg
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/group_membership.cfg?rev=66113&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/group_membership.cfg (added)
+++ branches/upstream/libnagios-object-perl/current/t/group_membership.cfg Wed Dec 22 09:37:32 2010
@@ -1,0 +1,32 @@
+define host{
+ host_name host1
+ address 192.168.0.1
+ hostgroups HOSTGROUP1
+}
+
+define host{
+ host_name host2
+ address 192.168.0.2
+ hostgroups HOSTGROUP1
+}
+
+define host
+ host_name host3
+ address 192.168.0.3
+ hostgroups HOSTGROUP1
+}
+
+define host{
+ host_name host4
+ address 192.168.0.4
+ hostgroups HOSTGROUP1
+}
+
+define hostgroup{
+ hostgroup_name HOSTGROUP1
+}
+
+define hostgroup{
+ hostgroup_name HOSTGROUP2
+ members host1,host2,host3,host4
+}
Added: branches/upstream/libnagios-object-perl/current/t/group_membership.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/group_membership.t?rev=66113&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/group_membership.t (added)
+++ branches/upstream/libnagios-object-perl/current/t/group_membership.t Wed Dec 22 09:37:32 2010
@@ -1,0 +1,38 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw( ../lib ./lib );
+
+BEGIN { plan tests => 6 }
+
+use List::Compare;
+use Nagios::Object::Config;
+
+my $err = 0;
+my $file = 'group_membership.cfg';
+
+eval { chdir('t'); };
+
+my $obj = Nagios::Object::Config->new();
+$obj->parse($file) || die "Could not parse object file ($file)\n";
+$obj->resolve_objects();
+$obj->register_objects();
+
+my @hostgroups = @{$obj->list_hostgroups()};
+my @hosts = @{$obj->list_hosts()};
+
+foreach my $h ( @hosts ) {
+ my (@hgs) = @{$h->hostgroups};
+ my ($lc) = List::Compare->new(\@hostgroups, \@hgs);
+ ok( $lc->is_LequivalentR(), "Host " . $h->host_name . " is not listed as a member of all hostgroups.");
+}
+
+foreach my $hg ( @hostgroups ) {
+ my ($h) = $hg->members;
+ my ($lc) = List::Compare->new(\@hosts, $h);
+ ok( $lc->is_LequivalentR(), "Hostgroup " . $hg->hostgroup_name . " does not have all hosts listed.");
+}
+
+exit $err;
Added: branches/upstream/libnagios-object-perl/current/t/service_escalation.cfg
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/service_escalation.cfg?rev=66113&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/service_escalation.cfg (added)
+++ branches/upstream/libnagios-object-perl/current/t/service_escalation.cfg Wed Dec 22 09:37:32 2010
@@ -1,0 +1,57 @@
+define host{
+ host_name host1
+ address 192.168.0.1
+}
+
+define host{
+ host_name host2
+ address 192.168.0.2
+}
+
+define host{
+ host_name host3
+ address 192.168.0.3
+ hostgroups servers
+}
+
+define hostgroup{
+ hostgroup_name servers
+}
+
+define serviceescalation{
+ host_name host3
+ service_description http check
+ contact_groups all-escalation
+}
+
+define serviceescalation{
+ hostgroup_name servers
+ service_description cpu
+ contact_groups all-escalation
+}
+
+define service{
+ host_name host1,host2
+ service_description http check
+ check_command check_http
+}
+
+define service{
+ host_name host1,host2
+ service_description cpu
+ check_command check_load
+}
+
+define service{
+ host_name host3
+ service_description http check
+ contact_groups all-page
+ check_command check_http
+}
+
+define service{
+ hostgroup_name servers
+ service_description cpu
+ contact_groups all-page
+ check_command check_load
+}
Added: branches/upstream/libnagios-object-perl/current/t/service_escalation.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnagios-object-perl/current/t/service_escalation.t?rev=66113&op=file
==============================================================================
--- branches/upstream/libnagios-object-perl/current/t/service_escalation.t (added)
+++ branches/upstream/libnagios-object-perl/current/t/service_escalation.t Wed Dec 22 09:37:32 2010
@@ -1,0 +1,74 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+use lib qw( ../lib ./lib );
+
+BEGIN { plan tests => 2 }
+
+use Nagios::Object::Config;
+use List::Compare;
+#use Data::Dumper;
+#$Data::Dumper::Maxdepth = 3;
+
+my $file = 'service_escalation.cfg';
+
+eval { chdir('t'); };
+
+sub _host_list {
+ my ($self, $method, $h) = @_;
+ if ( $self->can($method) ) {
+ if ( ref $self->$method eq 'ARRAY' ) {
+ map {
+ if ( ref $_ eq '' ) {
+ $h->{$_}++;
+ } else {
+ $h->{$_->host_name}++;
+ }
+ } @{$self->$method};
+ } elsif ( defined $self->$method ) {
+ $h->{ $self->$method }++;
+ }
+ }
+}
+sub get_host_list {
+ my ($self, $obj) = @_;
+ my %h;
+ &_host_list($self, 'host_name', \%h);
+ if ( $self->can('hostgroup_name') ) {
+ if ( ref $self->hostgroup_name eq 'ARRAY' ) {
+ foreach my $hg ( @{$self->hostgroup_name} ) {
+ my $hg2 = ( ref $hg eq ''
+ ? $obj->find_object($hg, 'Nagios::HostGroup')
+ : $hg);
+ &_host_list($hg2, 'members', \%h);
+ }
+ } elsif ( defined $self->hostgroup_name ) {
+ my $hg2 = ( ref $self->hostgroup_name eq ''
+ ? $obj->find_object($self->hostgroup_name, 'Nagios::HostGroup')
+ : $self->hostgroup_name);
+ &_host_list($hg2, 'members', \%h);
+ }
+ }
+ return keys %h;
+}
+
+my $obj = Nagios::Object::Config->new();
+$obj->parse($file) || die "Could not parse object file ($file)\n";
+$obj->resolve_objects();
+$obj->register_objects();
+
+foreach my $esc ( @{$obj->list_serviceescalations()} ) {
+
+ my $svc = $esc->service_description;
+
+ my @esc_hosts = &get_host_list($esc, $obj);
+ my @svc_hosts = &get_host_list($svc, $obj);
+
+ my ($lc) = List::Compare->new(\@esc_hosts, \@svc_hosts);
+
+ ok( scalar @esc_hosts && scalar @svc_hosts && $lc->is_LequivalentR(), "Matching host lists between a service and serviceescalation");
+}
+
+exit 0;
More information about the Pkg-perl-cvs-commits
mailing list