Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 4 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
2  lib/Thruk/Controller/cmd.pm
@@ -405,7 +405,7 @@ sub _redirect_or_success {
);
}
if(defined $c->stash->{'lastservice'} and $c->stash->{'lastservice'} ne '') {
- $options->{'header'}->{'WaitObject'} = $c->stash->{'lasthost'}." ".$c->stash->{'lastservice'};
+ $options->{'header'}->{'WaitObject'} = $c->stash->{'lasthost'}.";".$c->stash->{'lastservice'};
$c->{'db'}->get_services( filter => [ Thruk::Utils::Auth::get_auth_filter( $c, 'services' ),
{ 'host_name' => $c->stash->{'lasthost'} },
{ 'description' => $c->stash->{'lastservice'} }
View
26 plugins/plugins-available/conf/lib/Monitoring/Config.pm
@@ -234,8 +234,6 @@ sub get_objects_by_name {
my $templates_only = shift || 0;
my $name2 = shift;
- my @objs;
-
# object with secondary name
if(defined $name2 and $name2 ne '') {
my $subtype;
@@ -248,14 +246,16 @@ sub get_objects_by_name {
$id = $objects->{'hostgroup_name'}->{$name2};
}
if(defined $id) {
- push @objs, $self->get_object_by_id($id);
+ return [$self->get_object_by_id($id)];
}
- return \@objs;
+ return [];
}
# existing template
- if(defined $self->{'objects'}->{'byname'}->{'templates'}->{$type}->{$name}) {
- push @objs, $self->get_object_by_id($self->{'objects'}->{'byname'}->{'templates'}->{$type}->{$name});
+ my $objs = {};
+ my $tid = $self->{'objects'}->{'byname'}->{'templates'}->{$type}->{$name};
+ if(defined $tid) {
+ $objs->{$tid} = $self->get_object_by_id($tid);
}
# existing object
@@ -263,22 +263,18 @@ sub get_objects_by_name {
if(defined $self->{'objects'}->{'byname'}->{$type}->{$name}) {
my $id = $self->{'objects'}->{'byname'}->{$type}->{$name};
unless(ref $id) {
- push @objs, $self->get_object_by_id($id);
+ $objs->{$id} = $self->get_object_by_id($id);
} else {
- my %ids;
for my $subtype (keys %{$id}) {
for my $subid (values %{$id->{$subtype}}) {
- $ids{$subid} = 1;
+ $objs->{$subid} = $self->get_object_by_id($id);
}
}
- for my $id (keys %ids) {
- push @objs, $self->get_object_by_id($id);
- }
}
}
}
- return \@objs;
+ return [ values %{$objs} ];
}
@@ -521,7 +517,7 @@ sub update_object {
my $newname = $obj->get_name();
- if($oldname ne $newname) {
+ if(defined $oldname and $oldname ne $newname) {
$self->rename_dependencies($obj, $oldname, $newname);
}
@@ -1249,7 +1245,7 @@ sub _update_obj_in_index {
$objects->{'byid'}->{$obj->{'id'}} = $obj;
# by type
- if(!defined $tname) {
+ if(!defined $obj->{'conf'}->{'register'} or $obj->{'conf'}->{'register'} != 0) {
push @{$objects->{'bytype'}->{$obj->{'type'}}}, $obj->{'id'};
}
}
View
13 plugins/plugins-available/conf/lib/Monitoring/Config/Object/Parent.pm
@@ -97,15 +97,12 @@ sub is_template {
=head2 get_template_name
-return the objects template name
+return the objects template name or undef
=cut
sub get_template_name {
my $self = shift;
- if(defined $self->{'conf'}->{'register'} and $self->{'conf'}->{'register'} == 0 and defined $self->{'conf'}->{'name'}) {
- return $self->{'conf'}->{'name'};
- }
- return;
+ return $self->{'conf'}->{'name'};
}
@@ -118,7 +115,7 @@ return the objects name
=cut
sub get_name {
my $self = shift;
- if(defined $self->{'conf'}->{'register'} and $self->{'conf'}->{'register'} == 0 and defined $self->{'conf'}->{'name'}) {
+ if($self->is_template()) {
return $self->get_template_name();
}
return $self->get_primary_name();
@@ -163,10 +160,6 @@ sub get_primary_name {
my $full = shift || 0;
my $conf = shift || $self->{'conf'};
- if(defined $conf->{'register'} and $conf->{'register'} == 0 and defined $conf->{'name'}) {
- return;
- }
-
return $conf->{$self->{'primary_key'}} unless ref $self->{'primary_key'};
unless($full) {
View
4 plugins/plugins-available/conf/lib/Thruk/Controller/conf.pm
@@ -1193,10 +1193,10 @@ sub _get_context_object {
my @newobjs;
for my $o (@{$objs}) {
if($templates == 1) {
- push @newobjs, $o if defined $o->{'conf'}->{'register'} and $o->{'conf'}->{'register'} == 0;
+ push @newobjs, $o if $o->is_template();
}
if($templates == 2) {
- push @newobjs, $o if !defined $o->{'conf'}->{'register'} or $o->{'conf'}->{'register'} == 1;
+ push @newobjs, $o if !defined $o->{'conf'}->{'register'} or $o->{'conf'}->{'register'} != 0;
}
}
@{$objs} = @newobjs;
View
11 plugins/plugins-available/conf/lib/Thruk/Utils/Conf.pm
@@ -515,16 +515,23 @@ sub _compare_configs {
##########################################################
sub _link_obj {
my($obj,$line) = @_;
- my $path;
+ my($path, $link);
if(defined $line) {
$path = $obj;
+ $link = 'file='.$path.'&line='.$line;
} else {
$line = $obj->{'line'};
$path = $obj->{'file'}->{'path'};
+ $link = 'data.id='.$obj->get_id();
}
my $shortpath = $path;
$shortpath =~ s/.*\///gmx;
- return('<a href="conf.cgi?sub=objects&amp;file='.$path.'&amp;line='.$line.'">'.$shortpath.':'.$line.'</a>');
+ if($line == 0) {
+ $line = '';
+ } else {
+ $line = ':'.$line
+ }
+ return('<a href="conf.cgi?sub=objects&amp;'.$link.'">'.$shortpath.$line.'</a>');
}
##########################################################
View
6 templates/extinfo_type_1.tt
@@ -212,6 +212,12 @@
N/A
[% END %]
&nbsp;(notification [% host.current_notification_number %])
+ [% IF host.current_notification_number == 0 && host.first_notification_delay > 0 %]
+ [% first_remaining = calculate_first_notification_delay_remaining(host) %]
+ [% IF first_remaining >= 0 %]
+ &nbsp;<span title="This host will send out notifications in [% first_remaining %] minutes">~[% first_remaining %]min</span>
+ [% END %]
+ [% END %]
</td>
</tr>
<tr>
View
6 templates/extinfo_type_2.tt
@@ -208,6 +208,12 @@
N/A
[% END %]
(notification [% service.current_notification_number %])
+ [% IF service.current_notification_number == 0 && service.first_notification_delay > 0 %]
+ [% first_remaining = calculate_first_notification_delay_remaining(service) %]
+ [% IF first_remaining >= 0 %]
+ &nbsp;<span title="This service will send out notifications in [% first_remaining %] minutes">~[% first_remaining %]min</span>
+ [% END %]
+ [% END %]
</td>
</tr>
<tr>

No commit comments for this range

Something went wrong with that request. Please try again.