mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 16:14:21 +02:00
+ Better management of notifications problems
This commit is contained in:
parent
9928344e3b
commit
60338a9933
@ -78,10 +78,10 @@ sub execute {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{sql}->connect();
|
$self->{sql}->connect();
|
||||||
$self->{sql}->query(query => "SELECT count(*) as num, instance_name FROM " . $self->{option_results}->{centreon_storage_database} . ".logs WHERE ctime > " . $options{time} . " AND msg_type IN ('2', '3') GROUP BY instance_name");
|
$self->{sql}->query(query => "SELECT name, count(NULLIF(log_id, 0)) as num FROM " . $self->{option_results}->{centreon_storage_database} . ".instances LEFT JOIN " . $self->{option_results}->{centreon_storage_database} . ".logs ON logs.ctime > " . $options{time} . " AND logs.msg_type IN ('2', '3') AND logs.instance_name = instances.name WHERE deleted = '0' GROUP BY instance_name");
|
||||||
my $total_notifications = 0;
|
my $total_notifications = 0;
|
||||||
while (($row = $self->{sql}->fetchrow_hashref())) {
|
while ((my $row = $self->{sql}->fetchrow_hashref())) {
|
||||||
$self->{output}->output_add(long_msg => sprintf("%d sent notifications from %s", $row->{num}, $row->{instance}));
|
$self->{output}->output_add(long_msg => sprintf("%d sent notifications from %s", $row->{num}, $row->{name}));
|
||||||
$total_notifications += $row->{num};
|
$total_notifications += $row->{num};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user