mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-23 21:55:16 +02:00
Fix #2077
This commit is contained in:
parent
d6168f3ac6
commit
04bb2dedf9
@ -94,8 +94,11 @@ sub run {
|
|||||||
short_msg => $numServers . " servers in in folder '" . $folderDN . "'"
|
short_msg => $numServers . " servers in in folder '" . $folderDN . "'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'servers_' . $folderDN,
|
label => 'servers',
|
||||||
|
nlabel => 'folder.servers.count',
|
||||||
|
instances => $folderDN
|
||||||
value => $numServers,
|
value => $numServers,
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
@ -103,7 +106,6 @@ sub run {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
}
|
}
|
||||||
|
@ -31,19 +31,19 @@ sub new {
|
|||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'warning:s' => { name => 'warning' },
|
||||||
"warning:s" => { name => 'warning', },
|
'critical:s' => { name => 'critical' },
|
||||||
"critical:s" => { name => 'critical', },
|
'domain:s' => { name => 'domain' },
|
||||||
"domain:s" => { name => 'domain', },
|
'filter-domain' => { name => 'filter_domain' },
|
||||||
"filter-domain" => { name => 'filter_domain', },
|
'farm:s' => { name => 'farm' },
|
||||||
"farm:s" => { name => 'farm', },
|
'filter-farm' => { name => 'filter_farm' },
|
||||||
"filter-farm" => { name => 'filter_farm', },
|
'server:s' => { name => 'server' },
|
||||||
"server:s" => { name => 'server', },
|
'filter-server' => { name => 'filter_server' },
|
||||||
"filter-server" => { name => 'filter_server', },
|
'zone:s' => { name => 'zone' },
|
||||||
"zone:s" => { name => 'zone', },
|
'filter-zone' => { name => 'filter_zone' }
|
||||||
"filter-zone" => { name => 'filter_zone', },
|
});
|
||||||
});
|
|
||||||
$self->{wql_filter} = '';
|
$self->{wql_filter} = '';
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
@ -101,9 +101,11 @@ sub check_options {
|
|||||||
sub run {
|
sub run {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(severity => 'Ok',
|
$self->{output}->output_add(
|
||||||
short_msg => "All sessions are ok");
|
severity => 'Ok',
|
||||||
|
short_msg => 'All sessions are ok'
|
||||||
|
);
|
||||||
|
|
||||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\citrix');
|
my $wmi = Win32::OLE->GetObject('winmgmts:root\citrix');
|
||||||
if (!defined($wmi)) {
|
if (!defined($wmi)) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||||
@ -127,11 +129,15 @@ sub run {
|
|||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => "Server '" . $server . "' active sessions : " . $activeSessions . " [disconnected sessions : " . $disconnectedSessions . "] [total sessions : " . $sessions . "]");
|
short_msg => "Server '" . $server . "' active sessions : " . $activeSessions . " [disconnected sessions : " . $disconnectedSessions . "] [total sessions : " . $sessions . "]");
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => 'active_sessions_' . $server,
|
$self->{output}->perfdata_add(
|
||||||
value => $activeSessions,
|
label => 'active_sessions',
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
nlabel => 'sessions.active.count',
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
instances => $server,
|
||||||
min => 0);
|
value => $activeSessions,
|
||||||
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
|
min => 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,13 +31,13 @@ sub new {
|
|||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'warning:s' => { name => 'warning' },
|
||||||
"warning:s" => { name => 'warning', },
|
'critical:s' => { name => 'critical' },
|
||||||
"critical:s" => { name => 'critical', },
|
'zone:s' => { name => 'zone' },
|
||||||
"zone:s" => { name => 'zone', },
|
'filter-zone' => { name => 'filter_zone' }
|
||||||
"filter-zone" => { name => 'filter_zone', },
|
});
|
||||||
});
|
|
||||||
$self->{wql_filter} = '';
|
$self->{wql_filter} = '';
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
@ -68,9 +68,11 @@ sub check_options {
|
|||||||
sub run {
|
sub run {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->{output}->output_add(severity => 'Ok',
|
$self->{output}->output_add(
|
||||||
short_msg => "All zones are ok");
|
severity => 'Ok',
|
||||||
|
short_msg => 'All zones are ok'
|
||||||
|
);
|
||||||
|
|
||||||
my $wmi = Win32::OLE->GetObject('winmgmts:root\citrix');
|
my $wmi = Win32::OLE->GetObject('winmgmts:root\citrix');
|
||||||
if (!defined($wmi)) {
|
if (!defined($wmi)) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
$self->{output}->add_option_msg(short_msg => "Cant create server object:" . Win32::OLE->LastError());
|
||||||
@ -89,14 +91,17 @@ sub run {
|
|||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => $numServers . " servers in zone '" . $zone . "'");
|
short_msg => $numServers . " servers in zone '" . $zone . "'");
|
||||||
}
|
}
|
||||||
$self->{output}->perfdata_add(label => 'servers_' . $zone,
|
$self->{output}->perfdata_add(
|
||||||
value => $numServers,
|
label => 'servers',
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
nlabel => 'zone.servers.count',
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
instances => $zone,
|
||||||
min => 0);
|
value => $numServers,
|
||||||
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||||
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||||
|
min => 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$self->{output}->display();
|
$self->{output}->display();
|
||||||
$self->{output}->exit();
|
$self->{output}->exit();
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ sub new {
|
|||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '0.1';
|
$self->{version} = '0.1';
|
||||||
%{$self->{modes}} = (
|
$self->{modes} = {
|
||||||
'folder' => 'apps::citrix::local::mode::folder',
|
'folder' => 'apps::citrix::local::mode::folder',
|
||||||
'license' => 'apps::citrix::local::mode::license',
|
'license' => 'apps::citrix::local::mode::license',
|
||||||
'session' => 'apps::citrix::local::mode::session',
|
'session' => 'apps::citrix::local::mode::session',
|
||||||
'zone' => 'apps::citrix::local::mode::zone',
|
'zone' => 'apps::citrix::local::mode::zone'
|
||||||
);
|
};
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user