This commit is contained in:
garnier-quentin 2020-07-27 10:39:50 +02:00
parent e5bab00178
commit ac3cc971ad
4 changed files with 58 additions and 45 deletions

View File

@ -94,8 +94,11 @@ sub run {
short_msg => $numServers . " servers in in folder '" . $folderDN . "'"
);
}
$self->{output}->perfdata_add(
label => 'servers_' . $folderDN,
label => 'servers',
nlabel => 'folder.servers.count',
instances => $folderDN
value => $numServers,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
@ -103,7 +106,6 @@ sub run {
);
}
$self->{output}->display();
$self->{output}->exit();
}

View File

@ -31,19 +31,19 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', },
"domain:s" => { name => 'domain', },
"filter-domain" => { name => 'filter_domain', },
"farm:s" => { name => 'farm', },
"filter-farm" => { name => 'filter_farm', },
"server:s" => { name => 'server', },
"filter-server" => { name => 'filter_server', },
"zone:s" => { name => 'zone', },
"filter-zone" => { name => 'filter_zone', },
});
$options{options}->add_options(arguments => {
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical' },
'domain:s' => { name => 'domain' },
'filter-domain' => { name => 'filter_domain' },
'farm:s' => { name => 'farm' },
'filter-farm' => { name => 'filter_farm' },
'server:s' => { name => 'server' },
'filter-server' => { name => 'filter_server' },
'zone:s' => { name => 'zone' },
'filter-zone' => { name => 'filter_zone' }
});
$self->{wql_filter} = '';
return $self;
}
@ -101,9 +101,11 @@ sub check_options {
sub run {
my ($self, %options) = @_;
$self->{output}->output_add(severity => 'Ok',
short_msg => "All sessions are ok");
$self->{output}->output_add(
severity => 'Ok',
short_msg => 'All sessions are ok'
);
my $wmi = Win32::OLE->GetObject('winmgmts:root\citrix');
if (!defined($wmi)) {
$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,
short_msg => "Server '" . $server . "' active sessions : " . $activeSessions . " [disconnected sessions : " . $disconnectedSessions . "] [total sessions : " . $sessions . "]");
}
$self->{output}->perfdata_add(label => 'active_sessions_' . $server,
value => $activeSessions,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0);
$self->{output}->perfdata_add(
label => 'active_sessions',
nlabel => 'sessions.active.count',
instances => $server,
value => $activeSessions,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0
);
}

View File

@ -31,13 +31,13 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$options{options}->add_options(arguments =>
{
"warning:s" => { name => 'warning', },
"critical:s" => { name => 'critical', },
"zone:s" => { name => 'zone', },
"filter-zone" => { name => 'filter_zone', },
});
$options{options}->add_options(arguments => {
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical' },
'zone:s' => { name => 'zone' },
'filter-zone' => { name => 'filter_zone' }
});
$self->{wql_filter} = '';
return $self;
}
@ -68,9 +68,11 @@ sub check_options {
sub run {
my ($self, %options) = @_;
$self->{output}->output_add(severity => 'Ok',
short_msg => "All zones are ok");
$self->{output}->output_add(
severity => 'Ok',
short_msg => 'All zones are ok'
);
my $wmi = Win32::OLE->GetObject('winmgmts:root\citrix');
if (!defined($wmi)) {
$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,
short_msg => $numServers . " servers in zone '" . $zone . "'");
}
$self->{output}->perfdata_add(label => 'servers_' . $zone,
value => $numServers,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0);
$self->{output}->perfdata_add(
label => 'servers',
nlabel => 'zone.servers.count',
instances => $zone,
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}->exit();
}

View File

@ -30,12 +30,12 @@ sub new {
bless $self, $class;
$self->{version} = '0.1';
%{$self->{modes}} = (
'folder' => 'apps::citrix::local::mode::folder',
'license' => 'apps::citrix::local::mode::license',
'session' => 'apps::citrix::local::mode::session',
'zone' => 'apps::citrix::local::mode::zone',
);
$self->{modes} = {
'folder' => 'apps::citrix::local::mode::folder',
'license' => 'apps::citrix::local::mode::license',
'session' => 'apps::citrix::local::mode::session',
'zone' => 'apps::citrix::local::mode::zone'
};
return $self;
}