Add modes for Kingdee EAS(Enterprise Application Suite).

This commit is contained in:
Aladdin Chan 2017-11-21 16:16:10 +08:00
parent 4ac33c1124
commit b6e0b6f318
19 changed files with 3741 additions and 0 deletions

View File

@ -0,0 +1,154 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::activeusers;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkactiveusers.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /.*ActiveUsers_1m=.*/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find eas actvie users info."
);
$self->{output}->option_exit();
}
my @activeusers = split(" ",$webcontent);
my $info;
foreach $info (@activeusers) {
if ( $info =~ /(.*)=(.*)/ ) {
my ($counttype ,$num) = ($1 , $2);
$self->{output}->output_add(severity => "ok", short_msg => $info);
$self->{output}->perfdata_add(label => $counttype, unit => '',value => $num);
}
}
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check eas active users info.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkclassloading.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold.
=item B<--critical>
Critical Threshold.
=back
=cut

View File

@ -0,0 +1,169 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::classloading;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkclassloading.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /(LoadedClassCount|UnloadedClassCount)/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find classloading status."
);
$self->{output}->option_exit();
}
my ($loadedclasscount, $unloadedclasscount) = (0, 0);
if ($webcontent =~ /LoadedClassCount=\s*(\d+)/mi) {
$loadedclasscount = $1;
}
if ($webcontent =~ /UnloadedClassCount=\s*(\d+)/mi) {
$unloadedclasscount = $1;
}
my $exit = $self->{perfdata}->threshold_check(value => $loadedclasscount,
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("ClassLoaded: %d", $loadedclasscount));
$self->{output}->output_add(severity => $exit, short_msg => sprintf("ClassUnloaded: %d", $unloadedclasscount));
$self->{output}->perfdata_add(label => "LoadedClassCount", unit => '',
value => sprintf("%d", $loadedclasscount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->perfdata_add(label => "c[UnloadedClassCount]", unit => '',
value => sprintf("%d", $unloadedclasscount),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS application classLoading status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkclassloading.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for class loaded
=item B<--critical>
Critical Threshold for class unloaded
=back
=cut

View File

@ -0,0 +1,218 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::datasource;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkdatasources.jsp" },
"datasource:s" => { name => 'datasource' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{datasource}) || $self->{option_results}->{datasource} eq "") {
$self->{output}->add_option_msg(short_msg => "Missing datasource name.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} .= "?ds=" . $self->{option_results}->{datasource};
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^Name=/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find datasource \'" . $self->{option_results}->{datasource} . "\' status."
);
}
my $init_pool_size = -1;
my $max_pool_size = -1;
my $idle_timeout = -1;
my $cur_conn_count = -1;
my $cur_avail_conn_count = -1;
my $max_conn_count = -1;
my $create_count = -1;
my $close_count = -1;
$init_pool_size = $1 if $webcontent =~ /InitialPoolSize=(\d+)\s/i;
$max_pool_size = $1 if $webcontent =~ /MaxPoolSize=(\d+)\s/i;
$idle_timeout = $1 if $webcontent =~ /IdleTimeout=(\d+)\s/i;
$cur_conn_count = $1 if $webcontent =~ /CurrentConnectionCount=(\d+)\s/i;
$cur_avail_conn_count = $1 if $webcontent =~ /CurrentAvailableConnectionCount=(\d+)\s/i;
$max_conn_count = $1 if $webcontent =~ /MaxConnectionCount=(\d+)\s/i;
$create_count = $1 if $webcontent =~ /CreateCount=(\d+)\s/i;
$close_count = $1 if $webcontent =~ /CloseCount=(\d+)\s/i;
my $active_conn_count = $cur_conn_count - $cur_avail_conn_count;
$self->{output}->output_add(severity => "ok", short_msg => sprintf("InitialPoolSize: %d", $init_pool_size));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxPoolSize: %d", $max_pool_size));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("IdleTimeout: %d", $idle_timeout));
my $exit = $self->{perfdata}->threshold_check(value => $active_conn_count, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("ActiveConnectionCount: %d", $active_conn_count));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CurrentConnectionCount: %d", $cur_conn_count));
#$self->{output}->output_add(severity => "ok", short_msg => sprintf("CurrentAvailableConnectionCount: %d", $cur_avail_conn_count));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxConnectionCount: %d", $max_conn_count));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CreateCount: %d", $create_count));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CloseCount: %d", $close_count));
$self->{output}->perfdata_add(label => "InitPoolSize", unit => '',
value => sprintf("%d", $init_pool_size),
);
$self->{output}->perfdata_add(label => "MaxPoolSize", unit => '',
value => sprintf("%d", $max_pool_size),
);
$self->{output}->perfdata_add(label => "IdleTimeout", unit => '',
value => sprintf("%d", $idle_timeout),
);
$self->{output}->perfdata_add(label => "ActiveConnectionCount", unit => '',
value => sprintf("%d", $active_conn_count),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->perfdata_add(label => "CurrentConnectionCount", unit => '',
value => sprintf("%d", $cur_conn_count),
);
#$self->{output}->perfdata_add(label => "CurrentAvailableConnectionCount", unit => '',
# value => sprintf("%d", $cur_avail_conn_count),
# );
$self->{output}->perfdata_add(label => "MaxConnectionCount", unit => '',
value => sprintf("%d", $max_conn_count),
);
$self->{output}->perfdata_add(label => "c[CreateCount]", unit => '',
value => sprintf("%d", $create_count),
);
$self->{output}->perfdata_add(label => "c[CloseCount]", unit => '',
value => sprintf("%d", $close_count),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS application datasource status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Specify path to get status page. (Default: '/easportal/tools/nagios/checkdatasources.jsp')
=item B<--datasource>
Specify the datasource name.
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for active connection count.
=item B<--critical>
Critical Threshold for active connection count.
=back
=cut

View File

@ -0,0 +1,154 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::easlicense;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkeaslicense.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /.*BOS=.*/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find eas license usage info."
);
$self->{output}->option_exit();
}
my @licenseinfo = split(" ",$webcontent);
my $info;
foreach $info (@licenseinfo) {
if ( $info =~ /(.*)=(.*)/ ) {
my ($modname ,$num) = ($1 , $2);
$self->{output}->output_add(severity => "ok", short_msg => $info);
$self->{output}->perfdata_add(label => $modname, unit => '',value => $num);
}
}
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check eas license usage info.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkclassloading.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold.
=item B<--critical>
Critical Threshold.
=back
=cut

View File

@ -0,0 +1,230 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::httphandler;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(
arguments => {
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkhttphandler.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
}
);
$self->{http} = centreon::plugins::http->new( output => $self->{output} );
return $self;
}
sub check_options {
my ( $self, %options ) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options( %{ $self->{option_results} } );
}
sub run {
my ( $self, %options ) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /MaxThreads=\d+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find httphandler status in response: '" . $webcontent . "'"
);
$self->{output}->option_exit();
}
my ($maxthreads, $minsparethreads, $maxsparethreads, $maxqueuesize, $idletimeout, $processedcount) = (0, 0, 0, 0, 0, 0);
my ($currentthreadcount, $availablethreadcount, $busythreadcount, $maxavailablethreadcount, $maxbusythreadcount) = (0, 0, 0, 0, 0);
my ($maxprocessedtime, $createcount, $destroycount) = (0, 0, 0);
$maxthreads = $1 if $webcontent =~ /MaxThreads=(\d+)/mi ;
$minsparethreads = $1 if $webcontent =~ /MinSpareThreads=(\d+)/mi ;
$maxsparethreads = $1 if $webcontent =~ /MaxSpareThreads=(\d+)/mi ;
$maxqueuesize = $1 if $webcontent =~ /MaxQueueSize=(\d+)/mi ;
$idletimeout = $1 if $webcontent =~ /IdleTimeout=(\d+)/mi ;
$processedcount = $1 if $webcontent =~ /ProcessedCount=(\d+)/mi ;
$currentthreadcount = $1 if $webcontent =~ /CurrentThreadCount=(\d+)/mi ;
$availablethreadcount = $1 if $webcontent =~ /AvailableThreadCount=(\d+)/mi ;
$busythreadcount = $1 if $webcontent =~ /BusyThreadCount=(\d+)/mi ;
$maxavailablethreadcount = $1 if $webcontent =~ /MaxAvailableThreadCount=(\d+)/mi ;
$maxbusythreadcount = $1 if $webcontent =~ /MaxBusyThreadCount=(\d+)/mi ;
$maxprocessedtime = $1 if $webcontent =~ /MaxProcessedTime=(\d+)/mi ;
$createcount = $1 if $webcontent =~ /CreateCount=(\d+)/mi ;
$destroycount = $1 if $webcontent =~ /DestroyCount=(\d+)/mi ;
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxThreads: %d", $maxthreads));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MinSpareThreads: %d", $minsparethreads));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxSpareThreads: %d", $maxsparethreads));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxQueueSize: %d", $maxqueuesize));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("IdleTimeout: %ds", $idletimeout));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("ProcessedCount: %d", $processedcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CurrentThreadCount: %d", $currentthreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("AvailableThreadCount: %d", $availablethreadcount));
my $exit = $self->{perfdata}->threshold_check(value => $busythreadcount, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("BusyThreadCount: %d", $busythreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxAvailableThreadCount: %d", $maxavailablethreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxBusyThreadCount: %d", $maxbusythreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxProcessedTime: %dms", $maxprocessedtime));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CreateCount: %d", $createcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("DestroyCount: %d", $destroycount));
$self->{output}->perfdata_add(label => "MaxThreads", unit => '',
value => sprintf("%d", $maxthreads),
);
$self->{output}->perfdata_add(label => "MinSpareThreads", unit => '',
value => sprintf("%d", $minsparethreads),
);
$self->{output}->perfdata_add(label => "MaxSpareThreads", unit => '',
value => sprintf("%d", $maxsparethreads),
);
$self->{output}->perfdata_add(label => "MaxQueueSize", unit => '',
value => sprintf("%d", $maxqueuesize),
);
$self->{output}->perfdata_add(label => "IdleTimeout", unit => 's',
value => sprintf("%d", $idletimeout),
);
$self->{output}->perfdata_add(label => "c[ProcessedCount]", unit => '',
value => sprintf("%d", $processedcount),
);
$self->{output}->perfdata_add(label => "CurrentThreadCount", unit => '',
value => sprintf("%d", $currentthreadcount),
);
$self->{output}->perfdata_add(label => "AvailableThreadCount", unit => '',
value => sprintf("%d", $availablethreadcount),
);
$self->{output}->perfdata_add(label => "BusyThreadCount", unit => '',
value => sprintf("%d", $busythreadcount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->perfdata_add(label => "MaxAvailableThreadCount", unit => '',
value => sprintf("%d", $maxavailablethreadcount),
);
$self->{output}->perfdata_add(label => "MaxBusyThreadCount", unit => '',
value => sprintf("%d", $maxbusythreadcount),
);
$self->{output}->perfdata_add(label => "MaxProcessedTime", unit => 'ms',
value => sprintf("%d", $maxprocessedtime),
);
$self->{output}->perfdata_add(label => "c[CreateCount]", unit => '',
value => sprintf("%d", $createcount),
);
$self->{output}->perfdata_add(label => "c[DestroyCount]", unit => '',
value => sprintf("%d", $destroycount),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS instance httphandler(Apusic) threads pool status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Protocol to use http or https, http is default
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkhttphandler.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for busy thread count.
=item B<--critical>
Critical Threshold for busy thread count.
=back
=cut

View File

@ -0,0 +1,158 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::ibmjvmgc;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkgc_j9gen.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /CollectionCount=\d+/mi ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find ibm jdk j9 gc status."
);
$self->{output}->option_exit();
}
my ($collectioncount, $collectiontime) = (0, 0);
($collectioncount, $collectiontime) = ($1, $2) if ($webcontent =~ /CollectionCount=(\d+)\sCollectionTime=(\d+)/mi);
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CollectionCount: %d", $collectioncount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CollectionTime: %dms", $collectiontime));
$self->{output}->perfdata_add(label => "c[CollectionCount]", unit => '',
value => sprintf("%d", $collectioncount),
);
$self->{output}->perfdata_add(label => "c[CollectionTime]", unit => 'ms',
value => sprintf("%d", $collectiontime),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS application jvm gc status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkgc_j9.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for class loaded
=item B<--critical>
Critical Threshold for class unloaded
=back
=cut

View File

@ -0,0 +1,172 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::javaruntime;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use POSIX;
use centreon::plugins::http;
use centreon::plugins::misc;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkjavaruntime.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /VmName=/mi ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find java runtime status."
);
$self->{output}->option_exit();
}
my $vmname = $1 if $webcontent =~ /VmName=\'(.*?)\'/i;
my $specversion = $1 if $webcontent =~ /SpecVersion=([\d\.]+)/i;
my $vmversion = $1 if $webcontent =~ /VmVersion=(.*?)\s/i;
my $vender = $1 if $webcontent =~ /VmVendor=\'(.*?)\'/i;
my $uptime = $1 if $webcontent =~ /Uptime=(\d*)/i; #unit:ms
my $startime = $1 if $webcontent =~ /StartTime=(\d*)/i;
my $exit = $self->{perfdata}->threshold_check(value => $uptime / 1000, threshold => [
{ label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("Uptime: %s",
centreon::plugins::misc::change_seconds(value => floor($uptime / 1000), start => 'd'))
);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("%s %s (build %s), %s",
$vmname ,$specversion, $vmversion,$vender)
);
$self->{output}->perfdata_add(label => "Uptime", unit => 's',
value => sprintf("%d", floor($uptime / 1000)),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->perfdata_add(label => "SpecVersion", unit => '',
value => sprintf("%s", $specversion),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS application java runtime status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkjavaruntime.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for uptime (sec)
=item B<--critical>
Critical Threshold for uptime (sec)
=back
=cut

View File

@ -0,0 +1,367 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::memory;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(
arguments => {
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkmemory.jsp" },
"warning-heap:s" => { name => 'warning-heap' , default => ",,,"},
"warning-nonheap:s" => { name => 'warning-nonheap' , default => ",,,"},
"critical-heap:s" => { name => 'critical-heap' , default => ",,,"},
"critical-nonheap:s" => { name => 'critical-nonheap' , default => ",,,"},
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
}
);
$self->{http} = centreon::plugins::http->new( output => $self->{output} );
return $self;
}
sub check_options {
my ( $self, %options ) = @_;
$self->SUPER::init(%options);
($self->{warn_init_heap}, $self->{warn_max_heap}, $self->{warn_used_heap}, $self->{warn_committed_heap})
= split /,/, $self->{option_results}->{"warning-heap"};
($self->{warn_init_nonheap}, $self->{warn_max_nonheap}, $self->{warn_used_nonheap}, $self->{warn_committed_nonheap})
= split /,/, $self->{option_results}->{"warning-nonheap"};
($self->{crit_init_heap}, $self->{crit_max_heap}, $self->{crit_used_heap}, $self->{crit_committed_heap})
= split /,/, $self->{option_results}->{"critical-heap"};
($self->{crit_init_nonheap}, $self->{crit_max_nonheap}, $self->{crit_used_nonheap}, $self->{crit_committed_nonheap})
= split /,/, $self->{option_results}->{"critical-nonheap"};
# warning-heap
if (($self->{perfdata}->threshold_validate(label => 'warn_init_heap', value => $self->{warn_init_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-heap init threshold '" . $self->{warn_init_heap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_max_heap', value => $self->{warn_max_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-heap max threshold '" . $self->{warn_max_heap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_used_heap', value => $self->{warn_used_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-heap used threshold '" . $self->{warn_used_heap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_committed_heap', value => $self->{warn_committed_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-heap committed threshold '" . $self->{warn_committed_heap} . "'.");
$self->{output}->option_exit();
}
# waring-nonheap
if (($self->{perfdata}->threshold_validate(label => 'warn_init_nonheap', value => $self->{warn_init_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-nonheap init threshold '" . $self->{warn_init_nonheap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_max_nonheap', value => $self->{warn_max_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-nonheap max threshold '" . $self->{warn_max_nonheap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_used_nonheap', value => $self->{warn_used_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-nonheap used threshold '" . $self->{warn_used_nonheap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_committed_nonheap', value => $self->{warn_committed_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning-nonheap committed threshold '" . $self->{warn_committed_nonheap} . "'.");
$self->{output}->option_exit();
}
# critical-heap
if (($self->{perfdata}->threshold_validate(label => 'crit_init_heap', value => $self->{crit_init_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-heap init threshold '" . $self->{crit_init_heap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_max_heap', value => $self->{crit_max_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-heap max threshold '" . $self->{crit_max_heap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_used_heap', value => $self->{crit_used_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-heap used threshold '" . $self->{crit_used_heap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_committed_heap', value => $self->{crit_committed_heap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-heap committed threshold '" . $self->{crit_committed_heap} . "'.");
$self->{output}->option_exit();
}
# critical-nonheap
if (($self->{perfdata}->threshold_validate(label => 'crit_init_nonheap', value => $self->{crit_init_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-nonheap init threshold '" . $self->{crit_init_nonheap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_max_nonheap', value => $self->{crit_max_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-nonheap max threshold '" . $self->{crit_max_nonheap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_used_nonheap', value => $self->{crit_used_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-nonheap used threshold '" . $self->{crit_used_nonheap} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_committed_nonheap', value => $self->{crit_committed_nonheap})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical-nonheap committed threshold '" . $self->{crit_committed_nonheap} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options( %{ $self->{option_results} } );
}
sub run {
my ( $self, %options ) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /(^Type=HeapMemoryUsage|^Type=NonHeapMemoryUsage)/mi ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find heap or nonheap memory usage status."
);
$self->{output}->option_exit();
}
my ( $init_heap, $max_heap, $used_heap, $committed_heap ) = ( 0, 0, 0, 0 );
my ( $init_nonheap, $max_nonheap, $used_nonheap, $committed_nonheap ) = ( 0, 0, 0, 0 );
if ( $webcontent =~ /^Type=HeapMemoryUsage\sinit=(\d+)\smax=(\d+)\sused=(\d+)\scommitted=(\d+)/mi ){
( $init_heap, $max_heap, $used_heap, $committed_heap ) = ( $1, $2, $3, $4 );
$self->{output}->output_add(
severity => 'ok',
short_msg => sprintf(
"Heap Memory: init %d , max %d ,used %d ,commited %d",
$init_heap, $max_heap, $used_heap, $committed_heap
)
);
}
if ( $webcontent =~ /^Type=NonHeapMemoryUsage\sinit=(\d+)\smax=(-{0,1}\d+)\sused=(\d+)\scommitted=(\d+)/mi ){
( $init_nonheap, $max_nonheap, $used_nonheap, $committed_nonheap ) = ( $1, $2, $3, $4 );
$self->{output}->output_add(
severity => 'ok',
short_msg => sprintf(
"NonHeap Memory: init %d , max %d ,used %d ,commited %d",
$init_nonheap, $max_nonheap,
$used_nonheap, $committed_nonheap
)
);
}
my $exit = $self->{perfdata}->threshold_check(value => $init_heap,
threshold => [ { label => 'crit_init_heap', 'exit_litteral' => 'critical' },
{ label => 'warn_init_heap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Init Heap: %d", $init_heap)
);
}
$exit = $self->{perfdata}->threshold_check(value => $max_heap,
threshold => [ { label => 'crit_max_heap', 'exit_litteral' => 'critical' },
{ label => 'warn_max_heap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Max Heap: %d", $max_heap)
);
}
$exit = $self->{perfdata}->threshold_check(value => $used_heap,
threshold => [ { label => 'crit_used_heap', 'exit_litteral' => 'critical' },
{ label => 'warn_used_heap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Used Heap: %d", $used_heap)
);
}
$exit = $self->{perfdata}->threshold_check(value => $committed_heap,
threshold => [ { label => 'crit_committed_heap', 'exit_litteral' => 'critical' },
{ label => 'warn_committed_heap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Committed Heap: %d", $committed_heap)
);
}
$exit = $self->{perfdata}->threshold_check(value => $init_nonheap,
threshold => [ { label => 'crit_init_nonheap', 'exit_litteral' => 'critical' },
{ label => 'warn_init_nonheap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Init NonHeap: %d", $init_nonheap)
);
}
$exit = $self->{perfdata}->threshold_check(value => $max_nonheap,
threshold => [ { label => 'crit_max_nonheap', 'exit_litteral' => 'critical' },
{ label => 'warn_max_nonheap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Max NonHeap: %d", $max_nonheap)
);
}
$exit = $self->{perfdata}->threshold_check(value => $used_nonheap,
threshold => [ { label => 'crit_used_nonheap', 'exit_litteral' => 'critical' },
{ label => 'warn_used_nonheap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Used NonHeap: %d", $used_nonheap)
);
}
$exit = $self->{perfdata}->threshold_check(value => $committed_nonheap,
threshold => [ { label => 'crit_committed_nonheap', 'exit_litteral' => 'critical' },
{ label => 'warn_committed_nonheap', 'exit_litteral' => 'warning' } ]);
if ($exit ne "ok"){
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("Committed NonHeap: %d", $committed_nonheap)
);
}
$self->{output}->perfdata_add(
label => "init_heap",
value => $init_heap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_init_heap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_init_heap'),
);
$self->{output}->perfdata_add(
label => "max_heap",
value => $max_heap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_max_heap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_max_heap'),
);
$self->{output}->perfdata_add(
label => "used_heap",
value => $used_heap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_used_heap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_used_heap'),
);
$self->{output}->perfdata_add(
label => "committed_heap",
value => $committed_heap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_committed_heap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_committed_heap'),
);
$self->{output}->perfdata_add(
label => "init_nonheap",
value => $init_nonheap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_init_nonheap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_init_nonheap'),
);
$self->{output}->perfdata_add(
label => "max_nonheap",
value => $max_nonheap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_max_nonheap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_max_nonheap'),
);
$self->{output}->perfdata_add(
label => "used_nonheap",
value => $used_nonheap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_used_nonheap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_used_nonheap'),
);
$self->{output}->perfdata_add(
label => "committed_nonheap",
value => $committed_nonheap,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_committed_nonheap'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_committed_nonheap'),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS instance heap & nonheap memory usage.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Protocol to use http or https, http is default
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkmemory.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning-*>
Warning Threshold (init,max,used,committed), '*' Can be: 'heap', 'nonheap'.
=item B<--critical-*>
Critical Threshold (init,max,used,committed), '*' Can be: 'heap', 'nonheap'.
=back
=cut

View File

@ -0,0 +1,230 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::muxhandler;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(
arguments => {
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkmuxhandler.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
}
);
$self->{http} = centreon::plugins::http->new( output => $self->{output} );
return $self;
}
sub check_options {
my ( $self, %options ) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options( %{ $self->{option_results} } );
}
sub run {
my ( $self, %options ) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /MaxThreads=\d+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find httphandler status in response: '" . $webcontent . "'"
);
$self->{output}->option_exit();
}
my ($maxthreads, $minsparethreads, $maxsparethreads, $maxqueuesize, $idletimeout, $processedcount) = (0, 0, 0, 0, 0, 0);
my ($currentthreadcount, $availablethreadcount, $busythreadcount, $maxavailablethreadcount, $maxbusythreadcount) = (0, 0, 0, 0, 0);
my ($maxprocessedtime, $createcount, $destroycount) = (0, 0, 0);
$maxthreads = $1 if $webcontent =~ /MaxThreads=(\d+)/mi ;
$minsparethreads = $1 if $webcontent =~ /MinSpareThreads=(\d+)/mi ;
$maxsparethreads = $1 if $webcontent =~ /MaxSpareThreads=(\d+)/mi ;
$maxqueuesize = $1 if $webcontent =~ /MaxQueueSize=(\d+)/mi ;
$idletimeout = $1 if $webcontent =~ /IdleTimeout=(\d+)/mi ;
$processedcount = $1 if $webcontent =~ /ProcessedCount=(\d+)/mi ;
$currentthreadcount = $1 if $webcontent =~ /CurrentThreadCount=(\d+)/mi ;
$availablethreadcount = $1 if $webcontent =~ /AvailableThreadCount=(\d+)/mi ;
$busythreadcount = $1 if $webcontent =~ /BusyThreadCount=(\d+)/mi ;
$maxavailablethreadcount = $1 if $webcontent =~ /MaxAvailableThreadCount=(\d+)/mi ;
$maxbusythreadcount = $1 if $webcontent =~ /MaxBusyThreadCount=(\d+)/mi ;
$maxprocessedtime = $1 if $webcontent =~ /MaxProcessedTime=(\d+)/mi ;
$createcount = $1 if $webcontent =~ /CreateCount=(\d+)/mi ;
$destroycount = $1 if $webcontent =~ /DestroyCount=(\d+)/mi ;
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxThreads: %d", $maxthreads));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MinSpareThreads: %d", $minsparethreads));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxSpareThreads: %d", $maxsparethreads));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxQueueSize: %d", $maxqueuesize));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("IdleTimeout: %ds", $idletimeout));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("ProcessedCount: %d", $processedcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CurrentThreadCount: %d", $currentthreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("AvailableThreadCount: %d", $availablethreadcount));
my $exit = $self->{perfdata}->threshold_check(value => $busythreadcount, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("BusyThreadCount: %d", $busythreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxAvailableThreadCount: %d", $maxavailablethreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxBusyThreadCount: %d", $maxbusythreadcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxProcessedTime: %dms", $maxprocessedtime));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CreateCount: %d", $createcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("DestroyCount: %d", $destroycount));
$self->{output}->perfdata_add(label => "MaxThreads", unit => '',
value => sprintf("%d", $maxthreads),
);
$self->{output}->perfdata_add(label => "MinSpareThreads", unit => '',
value => sprintf("%d", $minsparethreads),
);
$self->{output}->perfdata_add(label => "MaxSpareThreads", unit => '',
value => sprintf("%d", $maxsparethreads),
);
$self->{output}->perfdata_add(label => "MaxQueueSize", unit => '',
value => sprintf("%d", $maxqueuesize),
);
$self->{output}->perfdata_add(label => "IdleTimeout", unit => 's',
value => sprintf("%d", $idletimeout),
);
$self->{output}->perfdata_add(label => "c[ProcessedCount]", unit => '',
value => sprintf("%d", $processedcount),
);
$self->{output}->perfdata_add(label => "CurrentThreadCount", unit => '',
value => sprintf("%d", $currentthreadcount),
);
$self->{output}->perfdata_add(label => "AvailableThreadCount", unit => '',
value => sprintf("%d", $availablethreadcount),
);
$self->{output}->perfdata_add(label => "BusyThreadCount", unit => '',
value => sprintf("%d", $busythreadcount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->perfdata_add(label => "MaxAvailableThreadCount", unit => '',
value => sprintf("%d", $maxavailablethreadcount),
);
$self->{output}->perfdata_add(label => "MaxBusyThreadCount", unit => '',
value => sprintf("%d", $maxbusythreadcount),
);
$self->{output}->perfdata_add(label => "MaxProcessedTime", unit => 'ms',
value => sprintf("%d", $maxprocessedtime),
);
$self->{output}->perfdata_add(label => "c[CreateCount]", unit => '',
value => sprintf("%d", $createcount),
);
$self->{output}->perfdata_add(label => "c[DestroyCount]", unit => '',
value => sprintf("%d", $destroycount),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS instance muxhandler(Apusic) threads pool status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Protocol to use http or https, http is default
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkmuxhandler.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for busy thread count.
=item B<--critical>
Critical Threshold for busy thread count.
=back
=cut

View File

@ -0,0 +1,166 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::oraclejvmgc;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkgc_ps.jsp" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /MinorGCCount=\d+/mi ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find jvm gc status."
);
$self->{output}->option_exit();
}
my ($minorgccount, $minorgctime, $fullgccount, $fullgctime) = (0, 0, 0, 0);
($minorgccount, $minorgctime, $fullgccount, $fullgctime) = ($1, $2, $3, $4) if ($webcontent =~ /MinorGCCount=(\d+)\sMinorGCTime=(\d+)\sFullGCCount=(\d+)\sFullGCTime=(\d+)/mi);
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MinorGCCount: %d", $minorgccount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MinorGCTime: %dms", $minorgctime));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("FullGCCount: %d", $fullgccount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("FullGCTime: %dms", $fullgctime));
$self->{output}->perfdata_add(label => "c[MinorGCCount]", unit => '',
value => sprintf("%d", $minorgccount),
);
$self->{output}->perfdata_add(label => "c[MinorGCTime]", unit => 'ms',
value => sprintf("%d", $minorgctime),
);
$self->{output}->perfdata_add(label => "c[FullGCCount]", unit => '',
value => sprintf("%d", $fullgccount),
);
$self->{output}->perfdata_add(label => "c[FullGCTime]", unit => 'ms',
value => sprintf("%d", $fullgctime),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS application jvm gc status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkgc_ps.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for class loaded
=item B<--critical>
Critical Threshold for class unloaded
=back
=cut

View File

@ -0,0 +1,168 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::oracleksqltemptable;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkoraclevt.jsp" },
"datasource:s" => { name => 'datasource' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{datasource}) || $self->{option_results}->{datasource} eq "") {
$self->{output}->add_option_msg(short_msg => "Missing datasource name.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} .= "?ds=" . $self->{option_results}->{datasource};
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^COUNT.*?=\d+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find ksql temptable status."
);
$self->{output}->option_exit();
}
my $count = $1 if $webcontent =~ /^COUNT.*?=(\d+)/i;
my $exit = $self->{perfdata}->threshold_check(value => $count, threshold => [
{ label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("KSQLTempTableCount: %d", $count));
$self->{output}->perfdata_add(label => "KSQLTempTableCount", unit => '',
value => sprintf("%d", $count),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check ksql temp table count for specify datasource.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkoraclevt.jsp')
=item B<--datasource>
Specify the datasource name.
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold.
=item B<--critical>
Critical Threshold.
=back
=cut

View File

@ -0,0 +1,168 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::oraclerecyclebin;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkoraclerecyclebin.jsp" },
"datasource:s" => { name => 'datasource' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{datasource}) || $self->{option_results}->{datasource} eq "") {
$self->{output}->add_option_msg(short_msg => "Missing datasource name.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} .= "?ds=" . $self->{option_results}->{datasource};
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^COUNT.*?=\d+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle recyclebin status."
);
$self->{output}->option_exit();
}
my $count = $1 if $webcontent =~ /^COUNT.*?=(\d+)/i;
my $exit = $self->{perfdata}->threshold_check(value => $count, threshold => [
{ label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("RecyclebinTableCount: %d", $count));
$self->{output}->perfdata_add(label => "RecyclebinTableCount", unit => '',
value => sprintf("%d", $count),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check oracle recyclebin table count for specify datasource.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkoraclerecyclebin.jsp')
=item B<--datasource>
Specify the datasource name.
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold.
=item B<--critical>
Critical Threshold.
=back
=cut

View File

@ -0,0 +1,177 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::oracleredolog;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkoracleredolog.jsp" },
"datasource:s" => { name => 'datasource' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{datasource}) || $self->{option_results}->{datasource} eq "") {
$self->{output}->add_option_msg(short_msg => "Missing datasource name.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} .= "?ds=" . $self->{option_results}->{datasource};
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^STATUS=CURRENT/mi ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle redolog status."
);
$self->{output}->option_exit();
}
my ($activecount, $inactivecount, $currentcount) = (0, 0, 0);
$activecount = $1 if $webcontent =~ /^STATUS=ACTIVE\sCOUNT=(\d+)/mi ;
$inactivecount = $1 if $webcontent =~ /^STATUS=INACTIVE\sCOUNT=(\d+)/mi ;
$currentcount = $1 if $webcontent =~ /^STATUS=CURRENT\sCOUNT=(\d+)/mi ;
my $exit = $self->{perfdata}->threshold_check(value => $inactivecount, threshold => [
{ label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("InactiveCount: %d", $inactivecount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("ActiveCount: %d", $activecount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CurrentCount: %d", $currentcount));
$self->{output}->perfdata_add(label => "InactiveCount", unit => '',
value => sprintf("%d", $inactivecount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
$self->{output}->perfdata_add(label => "ActiveCount", unit => '',
value => sprintf("%d", $activecount));
$self->{output}->perfdata_add(label => "CurrentCount", unit => '',
value => sprintf("%d", $currentcount));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check oracle redolog status .
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkoracleredolog.jsp')
=item B<--datasource>
Specify the datasource name.
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for INACTIVE count.
=item B<--critical>
Critical Threshold for INACTIVE count.
=back
=cut

View File

@ -0,0 +1,254 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::oraclesession;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkoraclesession.jsp" },
"datasource:s" => { name => 'datasource' },
"warning:s" => { name => 'warning', default => "," },
"critical:s" => { name => 'critical', default => "," },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{datasource}) || $self->{option_results}->{datasource} eq "") {
$self->{output}->add_option_msg(short_msg => "Missing datasource name.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} .= "?ds=" . $self->{option_results}->{datasource};
($self->{warn_activecount}, $self->{warn_totalcount}) = split /,/, $self->{option_results}->{"warning"};
($self->{crit_activecount}, $self->{crit_totalcount}) = split /,/, $self->{option_results}->{"critical"};
# warning
if (($self->{perfdata}->threshold_validate(label => 'warn_activecount', value => $self->{warn_activecount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning activecount threshold '" . $self->{warn_activecount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_totalcount', value => $self->{warn_totalcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning totalcount threshold '" . $self->{warn_totalcount} . "'.");
$self->{output}->option_exit();
}
# critical
if (($self->{perfdata}->threshold_validate(label => 'crit_activecount', value => $self->{crit_activecount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical activecount threshold '" . $self->{crit_activecount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_totalcount', value => $self->{crit_totalcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical totalcount threshold '" . $self->{crit_totalcount} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $url_path = $self->{option_results}->{url_path};
$self->{option_results}->{url_path} = $url_path . "\&groupby=status";
$self->{http}->set_options(%{$self->{option_results}});
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^STATUS=ACTIVE/mi ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle session info."
);
$self->{output}->option_exit();
}
my ($activecount, $inactivecount, $totalcount) = (0, 0, 0);
$activecount = $1 if $webcontent =~ /^STATUS=ACTIVE\sCOUNT=(\d+)/mi ;
$inactivecount = $1 if $webcontent =~ /^STATUS=INACTIVE\sCOUNT=(\d+)/mi ;
$totalcount = $activecount + $inactivecount;
$self->{option_results}->{url_path} = $url_path . "\&groupby=wait_class\&status=ACTIVE";
$self->{http}->set_options(%{$self->{option_results}});
$webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^WAIT_CLASS=.*?COUNT=\d+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle session info."
);
$self->{output}->option_exit();
}
my ($other, $queueing, $network, $administrative, $configuation, $commit) = (0, 0, 0, 0, 0, 0);
my ($application, $concurrency, $systemio, $userio, $scheduler, $idle) = (0, 0, 0, 0, 0, 0);
$other = $1 if $webcontent =~ /^WAIT_CLASS=Other\sCOUNT=(\d+)/mi;
$queueing = $1 if $webcontent =~ /^WAIT_CLASS=Queueing\sCOUNT=(\d+)/mi;
$network = $1 if $webcontent =~ /^WAIT_CLASS=Network\sCOUNT=(\d+)/mi;
$administrative = $1 if $webcontent =~ /^WAIT_CLASS=Administrative\sCOUNT=(\d+)/mi;
$configuation = $1 if $webcontent =~ /^WAIT_CLASS=Configuration\sCOUNT=(\d+)/mi;
$commit = $1 if $webcontent =~ /^WAIT_CLASS=Commit\sCOUNT=(\d+)/mi;
$application = $1 if $webcontent =~ /^WAIT_CLASS=Application\sCOUNT=(\d+)/mi;
$concurrency = $1 if $webcontent =~ /^WAIT_CLASS=Concurrency\sCOUNT=(\d+)/mi;
$systemio = $1 if $webcontent =~ /^WAIT_CLASS=\'System\sI\/O\'\sCOUNT=(\d+)/mi;
$userio = $1 if $webcontent =~ /^WAIT_CLASS='User\sI\/O\'\sCOUNT=(\d+)/mi;
$scheduler = $1 if $webcontent =~ /^WAIT_CLASS=Scheduler\sCOUNT=(\d+)/mi;
$idle = $1 if $webcontent =~ /^WAIT_CLASS=Idle\sCOUNT=(\d+)/mi;
#cpu and cpuwait
my $cpuandwait = $idle + $network ;
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Other: %d", $other));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Queueing: %d", $queueing));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Administrative: %d", $administrative));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Configuration: %d", $configuation));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Commit: %d", $commit));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Application: %d", $application));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Concurrency: %d", $concurrency));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("System I/O: %d", $systemio));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("User I/O: %d", $userio));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("Scheduler: %d", $scheduler));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CPU + CPU Wait: %d", $cpuandwait));
my $exit = $self->{perfdata}->threshold_check(value => $activecount, threshold => [ { label => 'crit_activecount', exit_litteral => 'critical' },
{ label => 'warn_activecount', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("ActiveCount: %d", $activecount));
$exit = $self->{perfdata}->threshold_check(value => $totalcount, threshold => [ { label => 'crit_totalcount', exit_litteral => 'critical' },
{ label => 'warn_totalcount', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("TotalCount: %d", $totalcount));
$self->{output}->perfdata_add(label => "Other", unit => '', value => sprintf("%d", $other));
$self->{output}->perfdata_add(label => "Queueing", unit => '', value => sprintf("%d", $queueing));
$self->{output}->perfdata_add(label => "Administrative", unit => '', value => sprintf("%d", $administrative));
$self->{output}->perfdata_add(label => "Configuration", unit => '', value => sprintf("%d", $configuation));
$self->{output}->perfdata_add(label => "Commit", unit => '', value => sprintf("%d", $commit));
$self->{output}->perfdata_add(label => "Application", unit => '', value => sprintf("%d", $application));
$self->{output}->perfdata_add(label => "Concurrency", unit => '', value => sprintf("%d", $concurrency));
$self->{output}->perfdata_add(label => "System I/O", unit => '', value => sprintf("%d", $systemio));
$self->{output}->perfdata_add(label => "User I/O", unit => '', value => sprintf("%d", $userio));
$self->{output}->perfdata_add(label => "Scheduler", unit => '', value => sprintf("%d", $scheduler));
$self->{output}->perfdata_add(label => "CPU + CPU Wait", unit => '', value => sprintf("%d", $cpuandwait));
$self->{output}->perfdata_add(label => "ActiveCount", unit => '',
value => sprintf("%d", $activecount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_activecount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_activecount'),
);
$self->{output}->perfdata_add(label => "TotalCount", unit => '',
value => sprintf("%d", $totalcount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_totalcount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_totalcount'),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check oracle database session status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkoraclesession.jsp')
=item B<--datasource>
Specify the datasource name.
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold. (activecount,totalcount) for example: --warning=50,200
=item B<--critical>
Critical Threshold. (activecount,totalcount) for example: --critical=100,300
=back
=cut

View File

@ -0,0 +1,201 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::oracletable;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkoracletable.jsp" },
"datasource:s" => { name => 'datasource' },
"tablename:s" => { name => 'tablename' , default => "T_GL_VOUCHER"},
"actualrows:s" => { name => 'actualrows', default => "false" },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{datasource}) || $self->{option_results}->{datasource} eq "") {
$self->{output}->add_option_msg(short_msg => "Missing datasource name.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} .= "?ds=" . $self->{option_results}->{datasource}
. "\&tablename=" . $self->{option_results}->{tablename}
. "\&actual=" . $self->{option_results}->{actualrows};
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^TABLE_NAME=\w+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle table status. \n" . $webcontent
);
$self->{output}->option_exit();
}
my ($num_rows, $actual_num_rows) = (-1, -1);
$num_rows = $1 if $webcontent =~ /NUM_ROWS=(\d+)/i;
$actual_num_rows = $1 if $webcontent =~ /ACTUAL_NUM_ROWS=(\d+)/i;
my $exit;
if ($actual_num_rows == -1){
$exit = $self->{perfdata}->threshold_check(value => $num_rows, threshold => [
{ label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', exit_litteral => 'warning' } ]
);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("NUM_ROWS: %d", $num_rows));
$self->{output}->perfdata_add(label => "NUM_ROWS", unit => '',
value => sprintf("%d", $num_rows),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
}
else{
$self->{output}->perfdata_add(label => "NUM_ROWS", unit => '', value => sprintf("%d", $num_rows));
$exit = $self->{perfdata}->threshold_check(value => $actual_num_rows, threshold => [
{ label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', exit_litteral => 'warning' } ]
);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("ACTUAL_NUM_ROWS: %d", $actual_num_rows));
$self->{output}->perfdata_add(label => "ACTUAL_NUM_ROWS", unit => '',
value => sprintf("%d", $actual_num_rows),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
}
$self->{output}->output_add(severity => $exit, short_msg => $webcontent);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check oracle table info for specify datasource.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkoracletable.jsp')
=item B<--datasource>
Specify the datasource name.
=item B<--tablename>
Specify the table name , MUST BE uppercase.
=item B<--actualrows>
Specify whether check actual rows of table or not , true or false.
MAY have performance problem for large table if specify true.
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for num_rows , or actual_num_rows if actualrows is true.
=item B<--critical>
Critical Threshold for num_rows , or actual_num_rows if actualrows is true.
=back
=cut

View File

@ -0,0 +1,159 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::oracleversion;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkoracleversion.jsp" },
"datasource:s" => { name => 'datasource' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{datasource}) || $self->{option_results}->{datasource} eq "") {
$self->{output}->add_option_msg(short_msg => "Missing datasource name.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} .= "?ds=" . $self->{option_results}->{datasource};
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning threshold '" . $self->{option_results}->{warning} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'critical', value => $self->{option_results}->{critical})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /^BANNER=/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle version info."
);
$self->{output}->option_exit();
}
my $banner = $1 if $webcontent =~ /^BANNER=\'(.*?)\'/i;
$self->{output}->output_add(severity => "ok", short_msg => $banner);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check oracle database version.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkoracleversion.jsp')
=item B<--datasource>
Specify the datasource name.
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold.
=item B<--critical>
Critical Threshold.
=back
=cut

View File

@ -0,0 +1,315 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::ormrpc;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
my $self = $class->SUPER::new( package => __PACKAGE__, %options );
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(
arguments => {
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checkrpc.jsp" },
"warning:s" => { name => 'warning' , default => ",,,,,,"},
"critical:s" => { name => 'critical' , default => ",,,,,,"},
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
}
);
$self->{http} = centreon::plugins::http->new( output => $self->{output} );
return $self;
}
sub check_options {
my ( $self, %options ) = @_;
$self->SUPER::init(%options);
($self->{warn_activethreadcount}, $self->{warn_stubcount}, $self->{warn_proxycount}, $self->{warn_clientsessioncount} ,$self->{warn_serversessioncount} ,$self->{warn_invokecountpermin} ,$self->{warn_servicecountpermin})
= split /,/, $self->{option_results}->{"warning"};
($self->{crit_activethreadcount}, $self->{crit_stubcount}, $self->{crit_proxycount}, $self->{crit_clientsessioncount} ,$self->{crit_serversessioncount} ,$self->{crit_invokecountpermin} ,$self->{crit_servicecountpermin})
= split /,/, $self->{option_results}->{"critical"};
# warning
if (($self->{perfdata}->threshold_validate(label => 'warn_activethreadcount', value => $self->{warn_activethreadcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning activethreadcount threshold '" . $self->{warn_activethreadcount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_stubcount', value => $self->{warn_stubcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning stubcount threshold '" . $self->{warn_stubcount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_proxycount', value => $self->{warn_proxycount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning proxycount threshold '" . $self->{warn_proxycount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_clientsessioncount', value => $self->{warn_clientsessioncount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning clientsessioncount threshold '" . $self->{warn_clientsessioncount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_serversessioncount', value => $self->{warn_serversessioncount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning serversessioncount threshold '" . $self->{warn_serversessioncount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_invokecountpermin', value => $self->{warn_invokecountpermin})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning invokecountpermin threshold '" . $self->{warn_invokecountpermin} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_servicecountpermin', value => $self->{warn_servicecountpermin})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning servicecountpermin threshold '" . $self->{warn_servicecountpermin} . "'.");
$self->{output}->option_exit();
}
# critical
if (($self->{perfdata}->threshold_validate(label => 'crit_activethreadcount', value => $self->{crit_activethreadcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical activethreadcount threshold '" . $self->{crit_activethreadcount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_stubcount', value => $self->{crit_stubcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical stubcount threshold '" . $self->{crit_stubcount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_proxycount', value => $self->{crit_proxycount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical proxycount threshold '" . $self->{crit_proxycount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_clientsessioncount', value => $self->{crit_clientsessioncount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical clientsessioncount threshold '" . $self->{crit_clientsessioncount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_serversessioncount', value => $self->{crit_serversessioncount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical serversessioncount threshold '" . $self->{crit_serversessioncount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_invokecountpermin', value => $self->{crit_invokecountpermin})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical invokecountpermin threshold '" . $self->{crit_invokecountpermin} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_servicecountpermin', value => $self->{crit_servicecountpermin})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical servicecountpermin threshold '" . $self->{crit_servicecountpermin} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options( %{ $self->{option_results} } );
}
sub run {
my ( $self, %options ) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /ActiveThreadCount=\d+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find ormrpc status in response: \'" . $webcontent . "\'"
);
$self->{output}->option_exit();
}
my ($activethreadcount, $stubcount, $proxycount, $clientsessioncount, $serversessioncount, $invokecountpermin, $servicecountpermin, $invokecount, $servicecount) = (0, 0, 0, 0, 0, 0, 0, 0, 0);
$activethreadcount = $1 if $webcontent =~ /ActiveThreadCount=(\d+)/mi ;
$stubcount = $1 if $webcontent =~ /StubCount=(\d+)/mi ;
$proxycount = $1 if $webcontent =~ /ProxyCount=(\d+)/mi ;
$clientsessioncount = $1 if $webcontent =~ /ClientSessionCount=(\d+)/mi ;
$serversessioncount = $1 if $webcontent =~ /ServerSessionCount=(\d+)/mi ;
$invokecountpermin = $1 if $webcontent =~ /ClientInvokeCountPerMinute=(\d+)/mi ;
$servicecountpermin = $1 if $webcontent =~ /ProcessedServiceCountPerMinute=(\d+)/mi ;
$invokecount = $1 if $webcontent =~ /ClientInvokeCount=(\d+)/mi ;
$servicecount = $1 if $webcontent =~ /ProcessedServiceCount=(\d+)/mi ;
my $exit = $self->{perfdata}->threshold_check(value => $activethreadcount,
threshold => [ { label => 'crit_activethreadcount', 'exit_litteral' => 'critical' },
{ label => 'warn_activethreadcount', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("ActiveTrheadCount: %d", $activethreadcount)
);
$exit = $self->{perfdata}->threshold_check(value => $stubcount,
threshold => [ { label => 'crit_stubcount', 'exit_litteral' => 'critical' },
{ label => 'warn_stubcount', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("StubCount: %d", $stubcount)
);
$exit = $self->{perfdata}->threshold_check(value => $proxycount,
threshold => [ { label => 'crit_proxycount', 'exit_litteral' => 'critical' },
{ label => 'warn_proxycount', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("ProxyCount: %d", $proxycount)
);
$exit = $self->{perfdata}->threshold_check(value => $clientsessioncount,
threshold => [ { label => 'crit_clientsessioncount', 'exit_litteral' => 'critical' },
{ label => 'warn_clientsessioncount', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("ClientSessionCount: %d", $clientsessioncount)
);
$exit = $self->{perfdata}->threshold_check(value => $serversessioncount,
threshold => [ { label => 'crit_serversessioncount', 'exit_litteral' => 'critical' },
{ label => 'warn_serversessioncount', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("ServerSessionCount: %d", $serversessioncount)
);
$exit = $self->{perfdata}->threshold_check(value => $invokecountpermin,
threshold => [ { label => 'crit_invokecountpermin', 'exit_litteral' => 'critical' },
{ label => 'warn_invokecountpermin', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("InvokeCountPerMinute: %d", $invokecountpermin)
);
$exit = $self->{perfdata}->threshold_check(value => $servicecountpermin,
threshold => [ { label => 'crit_servicecountpermin', 'exit_litteral' => 'critical' },
{ label => 'warn_servicecountpermin', 'exit_litteral' => 'warning' } ]);
$self->{output}->output_add(
severity => $exit,
short_msg => sprintf("ServiceCountPerMinute: %d", $servicecountpermin)
);
$self->{output}->perfdata_add(
label => "ActiveTrheadCount",
value => $activethreadcount,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_activethreadcount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_activethreadcount'),
);
$self->{output}->perfdata_add(
label => "StubCount",
value => $stubcount,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_stubcount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_stubcount'),
);
$self->{output}->perfdata_add(
label => "ProxyCount",
value => $proxycount,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_proxycount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_proxycount'),
);
$self->{output}->perfdata_add(
label => "ClientSessionCount",
value => $clientsessioncount,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_clientsessioncount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_clientsessioncount'),
);
$self->{output}->perfdata_add(
label => "ServerSessionCount",
value => $serversessioncount,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_serversessioncount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_serversessioncount'),
);
$self->{output}->perfdata_add(
label => "InvokeCount /min",
value => $invokecountpermin,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_invokecountpermin'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_invokecountpermin'),
);
$self->{output}->perfdata_add(
label => "ServiceCount /min",
value => $servicecountpermin,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_servicecountpermin'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_servicecountpermin'),
);
$self->{output}->perfdata_add(
label => "c[InvokeCount]",
value => $invokecount,
);
$self->{output}->perfdata_add(
label => "c[ServiceCount]",
value => $servicecount,
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS instance orm rpc status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Protocol to use http or https, http is default
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checkrpc.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold (activethreadcount,stubcount,proxycount,clientsessioncount,serversessioncount,invokecountpermin,servicecountpermin).
=item B<--critical>
Critical Threshold (activethreadcount,stubcount,proxycount,clientsessioncount,serversessioncount,invokecountpermin,servicecountpermin).
=back
=cut

View File

@ -0,0 +1,215 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author : CHEN JUN , aladdin.china@gmail.com
package apps::kingdee::eas::mode::transaction;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/easportal/tools/nagios/checktransaction.jsp" },
"datasource:s" => { name => 'datasource' },
"warning:s" => { name => 'warning', default => "," },
"critical:s" => { name => 'critical', default => "," },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
($self->{warn_activecount}, $self->{warn_timeoutcount})
= split /,/, $self->{option_results}->{"warning"};
($self->{crit_activecount}, $self->{crit_timeoutcount})
= split /,/, $self->{option_results}->{"critical"};
# warning
if (($self->{perfdata}->threshold_validate(label => 'warn_activecount', value => $self->{warn_activecount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning activecount threshold '" . $self->{warn_activecount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn_timeoutcount', value => $self->{warn_timeoutcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning timeoutcount threshold '" . $self->{warn_timeoutcount} . "'.");
$self->{output}->option_exit();
}
# critical
if (($self->{perfdata}->threshold_validate(label => 'crit_activecount', value => $self->{crit_activecount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical activecount threshold '" . $self->{crit_activecount} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit_timeoutcount', value => $self->{crit_timeoutcount})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical timeoutcount threshold '" . $self->{crit_timeoutcount} . "'.");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /TransactionCount=\d+/i ) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find transaction status."
);
}
my ($transactioncount, $totaltransactiontime, $committedcount, $rolledbackcount, $activecount, $maxtransactiontime, $defaulttimeout, $timeoutcount) = (0, 0, 0, 0, 0, 0, 0, 0);
$transactioncount = $1 if $webcontent =~ /TransactionCount=(\d+)\s/i;
$totaltransactiontime = $1 if $webcontent =~ /TotalTransactionTime=(\d+)\s/i;
$committedcount = $1 if $webcontent =~ /CommittedCount=(\d+)\s/i;
$rolledbackcount = $1 if $webcontent =~ /RolledbackCount=(\d+)\s/i;
$activecount = $1 if $webcontent =~ /ActiveCount=(\d+)\s/i;
$maxtransactiontime = $1 if $webcontent =~ /MaxTransactionTime=(\d+)\s/i;
$defaulttimeout = $1 if $webcontent =~ /DefaultTimeout=(\d+)\s/i;
$timeoutcount = $1 if $webcontent =~ /TimedOutCount=(\d+)\s/i;
my $exit = $self->{perfdata}->threshold_check(value => $activecount, threshold => [ { label => 'crit_activecount', exit_litteral => 'critical' },
{ label => 'warn_activecount', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("ActiveCount: %d", $activecount));
$exit = $self->{perfdata}->threshold_check(value => $timeoutcount, threshold => [ { label => 'crit_timeoutcount', exit_litteral => 'critical' },
{ label => 'warn_timeoutcount', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit, short_msg => sprintf("TimedOutCount: %d", $timeoutcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("CommittedCount: %d", $committedcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("RolledbackCount: %d", $rolledbackcount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("TransactionCount: %d", $transactioncount));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("TotalTransactionTime: %dms", $totaltransactiontime));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("MaxTransactionTime: %dms", $maxtransactiontime));
$self->{output}->output_add(severity => "ok", short_msg => sprintf("DefaultTimeout: %ds", $defaulttimeout));
$self->{output}->perfdata_add(label => "ActiveCount", unit => '',
value => sprintf("%d", $activecount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_activecount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_activecount'),
);
$self->{output}->perfdata_add(label => "TimedOutCount", unit => '',
value => sprintf("%d", $timeoutcount),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn_timeoutcount'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit_timeoutcount'),
);
$self->{output}->perfdata_add(label => "c[CommittedCount]", unit => '',
value => sprintf("%d", $committedcount),
);
$self->{output}->perfdata_add(label => "c[RolledbackCount]", unit => '',
value => sprintf("%d", $rolledbackcount),
);
$self->{output}->perfdata_add(label => "c[TransactionCount]", unit => '',
value => sprintf("%d", $transactioncount),
);
$self->{output}->perfdata_add(label => "c[TotalTransactionTime]", unit => 'ms',
value => sprintf("%d", $totaltransactiontime),
);
$self->{output}->perfdata_add(label => "MaxTransactionTime", unit => 'ms',
value => sprintf("%d", $maxtransactiontime),
);
$self->{output}->perfdata_add(label => "DefaultTimeout", unit => 's',
value => sprintf("%d", $defaulttimeout),
);
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check EAS application EJB transaction status.
=over 8
=item B<--hostname>
IP Addr/FQDN of the EAS application server host
=item B<--port>
Port used by EAS instance.
=item B<--proxyurl>
Proxy URL if any
=item B<--proto>
Specify https if needed
=item B<--urlpath>
Set path to get status page. (Default: '/easportal/tools/nagios/checktransaction.jsp')
=item B<--credentials>
Specify this option if you access page over basic authentification
=item B<--username>
Specify username for basic authentification (Mandatory if --credentials is specidied)
=item B<--password>
Specify password for basic authentification (Mandatory if --credentials is specidied)
=item B<--timeout>
Threshold for HTTP timeout
=item B<--warning>
Warning Threshold for (activecount,timeoutcount). for example : --warning=100,1
=item B<--critical>
Critical Threshold for (activecount,timeoutcount). for example : --critical=100,1
=back
=cut

View File

@ -0,0 +1,66 @@
#
# Copyright 2016 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package apps::kingdee::eas::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_simple);
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
# $options->{options} = options object
$self->{version} = '1.0';
%{$self->{modes}} = (
'classloading' => 'apps::kingdee::eas::mode::classloading',
'memory' => 'apps::kingdee::eas::mode::memory',
'javaruntime' => 'apps::kingdee::eas::mode::javaruntime',
'datasource' => 'apps::kingdee::eas::mode::datasource',
'httphandler' => 'apps::kingdee::eas::mode::httphandler',
'muxhandler' => 'apps::kingdee::eas::mode::muxhandler',
'transaction' => 'apps::kingdee::eas::mode::transaction',
'oraclejvmgc' => 'apps::kingdee::eas::mode::oraclejvmgc',
'ibmjvmgc' => 'apps::kingdee::eas::mode::ibmjvmgc',
'ormrpc' => 'apps::kingdee::eas::mode::ormrpc',
'easlicense' => 'apps::kingdee::eas::mode::easlicense',
'activeusers' => 'apps::kingdee::eas::mode::activeusers',
'oracleversion' => 'apps::kingdee::eas::mode::oracleversion',
'oraclesession' => 'apps::kingdee::eas::mode::oraclesession',
'oracletable' => 'apps::kingdee::eas::mode::oracletable',
'oraclerecyclebin' => 'apps::kingdee::eas::mode::oraclerecyclebin',
'oracleksqltemptable' => 'apps::kingdee::eas::mode::oracleksqltemptable',
'oracleredolog' => 'apps::kingdee::eas::mode::oracleredolog',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Kingdee EAS Application & DB Server Status .
=cut