This commit is contained in:
qgarnier 2017-12-06 17:14:35 +01:00
parent 683b95e770
commit 757ac8a861
20 changed files with 274 additions and 893 deletions

View File

@ -0,0 +1,184 @@
#
# Copyright 2017 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::custom::api;
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
my $self = {};
bless $self, $class;
if (!defined($options{output})) {
print "Class Custom: Need to specify 'output' argument.\n";
exit 3;
}
if (!defined($options{options})) {
$options{output}->add_option_msg(short_msg => "Class Custom: Need to specify 'options' argument.");
$options{output}->option_exit();
}
if (!defined($options{noptions})) {
$options{options}->add_options(arguments =>
{
"hostname:s@" => { name => 'hostname', },
"proto:s@" => { name => 'proto' },
"port:s@" => { name => 'port', },
"username:s@" => { name => 'username', },
"password:s@" => { name => 'password', },
"proxyurl:s@" => { name => 'proxyurl', },
"timeout:s@" => { name => 'timeout', },
});
}
$options{options}->add_help(package => __PACKAGE__, sections => 'REST API OPTIONS', once => 1);
$self->{output} = $options{output};
$self->{mode} = $options{mode};
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub set_options {
my ($self, %options) = @_;
$self->{option_results} = $options{option_results};
}
sub set_defaults {
my ($self, %options) = @_;
foreach (keys %{$options{default}}) {
if ($_ eq $self->{mode}) {
for (my $i = 0; $i < scalar(@{$options{default}->{$_}}); $i++) {
foreach my $opt (keys %{$options{default}->{$_}[$i]}) {
if (!defined($self->{option_results}->{$opt}[$i])) {
$self->{option_results}->{$opt}[$i] = $options{default}->{$_}[$i]->{$opt};
}
}
}
}
}
}
sub check_options {
my ($self, %options) = @_;
$self->{hostname} = (defined($self->{option_results}->{hostname})) ? shift(@{$self->{option_results}->{hostname}}) : undef;
$self->{username} = (defined($self->{option_results}->{username})) ? shift(@{$self->{option_results}->{username}}) : '';
$self->{password} = (defined($self->{option_results}->{password})) ? shift(@{$self->{option_results}->{password}}) : '';
$self->{proto} = (defined($self->{option_results}->{proto})) ? shift(@{$self->{option_results}->{proto}}) : 'http';
$self->{port} = (defined($self->{option_results}->{port})) ? shift(@{$self->{option_results}->{port}}) : 80;
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? shift(@{$self->{option_results}->{timeout}}) : 10;
$self->{proxyurl} = (defined($self->{option_results}->{proxyurl})) ? shift(@{$self->{option_results}->{proxyurl}}) : undef;
if (!defined($self->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Need to specify hostname option.");
$self->{output}->option_exit();
}
if (!defined($self->{hostname}) ||
scalar(@{$self->{option_results}->{hostname}}) == 0) {
return 0;
}
return 1;
}
sub build_options_for_httplib {
my ($self, %options) = @_;
$self->{option_results}->{hostname} = $self->{hostname};
$self->{option_results}->{timeout} = $self->{timeout};
$self->{option_results}->{port} = $self->{port};
$self->{option_results}->{proto} = $self->{proto};
$self->{option_results}->{proxyurl} = $self->{proxyurl};
$self->{option_results}->{credentials} = 1;
$self->{option_results}->{username} = $self->{username};
$self->{option_results}->{password} = $self->{password};
}
sub settings {
my ($self, %options) = @_;
$self->build_options_for_httplib();
$self->{http}->set_options(%{$self->{option_results}});
}
sub request {
my ($self, %options) = @_;
$self->settings();
my $content = $self->{http}->request(url_path => $options{path});
$content =~ s/^\s|\s+$//g;
return $content;
}
1;
__END__
=head1 NAME
KINGDEE REST API
=head1 SYNOPSIS
KINGDEE Rest API custom mode
=head1 REST API OPTIONS
=over 8
=item B<--hostname>
Kingdee hostname.
=item B<--proto>
Specify https if needed.
=item B<--username>
Kingdee username.
=item B<--password>
Kingdee password.
=item B<--proxyurl>
Proxy URL if any.
=item B<--timeout>
Set HTTP timeout in seconds (Default: '10').
=back
=head1 DESCRIPTION
B<custom>.
=cut

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,19 +34,11 @@ sub new {
$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;
}
@ -63,16 +54,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /.*ActiveUsers_1m=.*/i ) {
if ($webcontent !~ /.*ActiveUsers_1m=.*/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find eas actvie users info."
@ -84,8 +73,8 @@ sub run {
my $info;
foreach $info (@activeusers) {
if ( $info =~ /(.*)=(.*)/ ) {
my ($counttype ,$num) = ($1 , $2);
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);
}
@ -105,42 +94,10 @@ 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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,19 +34,11 @@ sub new {
$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;
}
@ -63,16 +54,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /(LoadedClassCount|UnloadedClassCount)/i ) {
if ($webcontent !~ /(LoadedClassCount|UnloadedClassCount)/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find classloading status."
@ -120,42 +109,10 @@ 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

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,20 +34,12 @@ sub new {
$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;
}
@ -70,17 +61,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /^Name=/i ) {
if ($webcontent !~ /^Name=/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find datasource \'" . $self->{option_results}->{datasource} . "\' status."
@ -165,22 +153,6 @@ 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')
@ -189,22 +161,6 @@ Specify path to get status page. (Default: '/easportal/tools/nagios/checkdatasou
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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,19 +34,11 @@ sub new {
$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;
}
@ -63,20 +54,15 @@ sub check_options {
$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."
);
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ($webcontent !~ /.*BOS=.*/i) {
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => "Cannot find eas license usage info.");
$self->{output}->option_exit();
}
@ -84,8 +70,8 @@ sub run {
my $info;
foreach $info (@licenseinfo) {
if ( $info =~ /(.*)=(.*)/ ) {
my ($modname ,$num) = ($1 , $2);
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);
}
@ -105,42 +91,10 @@ 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.

View File

@ -25,36 +25,26 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
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 ) = @_;
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
@ -66,16 +56,14 @@ sub check_options {
$self->{output}->option_exit();
}
$self->{http}->set_options( %{ $self->{option_results} } );
}
sub run {
my ( $self, %options ) = @_;
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /MaxThreads=\d+/i ) {
if ($webcontent !~ /MaxThreads=\d+/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find httphandler status in response: '" . $webcontent . "'"
@ -181,42 +169,10 @@ 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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,19 +34,11 @@ sub new {
$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;
}
@ -63,16 +54,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /CollectionCount=\d+/mi ) {
if ($webcontent !~ /CollectionCount=\d+/mi) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find ibm jdk j9 gc status."
@ -109,42 +98,10 @@ 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

View File

@ -26,7 +26,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use POSIX;
use centreon::plugins::http;
use centreon::plugins::misc;
sub new {
@ -37,19 +36,11 @@ sub new {
$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;
}
@ -65,16 +56,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /VmName=/mi ) {
if ($webcontent !~ /VmName=/mi) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find java runtime status."
@ -123,42 +112,10 @@ 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)

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
@ -35,23 +34,14 @@ sub new {
$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;
}
@ -139,17 +129,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /(^Type=HeapMemoryUsage|^Type=NonHeapMemoryUsage)/mi ) {
if ($webcontent !~ /(^Type=HeapMemoryUsage|^Type=NonHeapMemoryUsage)/mi) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find heap or nonheap memory usage status."
@ -318,42 +305,10 @@ 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'.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
@ -35,21 +34,12 @@ sub new {
$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;
}
@ -65,17 +55,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /MaxThreads=\d+/i ) {
if ($webcontent !~ /MaxThreads=\d+/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find httphandler status in response: '" . $webcontent . "'"
@ -181,42 +168,10 @@ 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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,19 +34,11 @@ sub new {
$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;
}
@ -63,14 +54,12 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /MinorGCCount=\d+/mi ) {
$self->{output}->output_add(
@ -117,42 +106,10 @@ 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

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,20 +34,12 @@ sub new {
$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;
}
@ -70,16 +61,14 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /^COUNT.*?=\d+/i ) {
if ($webcontent !~ /^COUNT.*?=\d+/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find ksql temptable status."
@ -115,22 +104,6 @@ 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')
@ -139,22 +112,6 @@ Set path to get status page. (Default: '/easportal/tools/nagios/checkoraclevt.js
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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,20 +34,12 @@ sub new {
$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;
}
@ -70,14 +61,12 @@ sub check_options {
$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
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ( $webcontent !~ /^COUNT.*?=\d+/i ) {
$self->{output}->output_add(
@ -115,22 +104,6 @@ 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')
@ -139,22 +112,6 @@ Set path to get status page. (Default: '/easportal/tools/nagios/checkoraclerecyc
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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,20 +34,12 @@ sub new {
$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;
}
@ -70,16 +61,13 @@ sub check_options {
$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 ) {
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ($webcontent !~ /^STATUS=CURRENT/mi) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle redolog status."
@ -124,22 +112,6 @@ 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')
@ -148,22 +120,6 @@ Set path to get status page. (Default: '/easportal/tools/nagios/checkoracleredol
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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,20 +34,12 @@ sub new {
$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;
}
@ -82,22 +73,14 @@ sub check_options {
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 ) {
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path} . '&groupby=status');
if ($webcontent !~ /^STATUS=ACTIVE/mi) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle session info."
@ -110,13 +93,8 @@ sub run {
$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 ) {
$webcontent = $options{custom}->request(path => $self->{option_results}->{url_path} . '&groupby=wait_class&status=ACTIVE');
if ($webcontent !~ /^WAIT_CLASS=.*?COUNT=\d+/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle session info."
@ -201,22 +179,6 @@ 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')
@ -225,22 +187,6 @@ Set path to get status page. (Default: '/easportal/tools/nagios/checkoraclesessi
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

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,22 +34,14 @@ sub new {
$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;
}
@ -74,16 +65,13 @@ sub check_options {
$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 ) {
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ($webcontent !~ /^TABLE_NAME=\w+/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle table status. \n" . $webcontent
@ -96,7 +84,7 @@ sub run {
$actual_num_rows = $1 if $webcontent =~ /ACTUAL_NUM_ROWS=(\d+)/i;
my $exit;
if ($actual_num_rows == -1){
if ($actual_num_rows == -1) {
$exit = $self->{perfdata}->threshold_check(value => $num_rows, threshold => [
{ label => 'critical', 'exit_litteral' => 'critical' },
{ label => 'warning', exit_litteral => 'warning' } ]
@ -108,8 +96,7 @@ sub run {
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
);
}
else{
} 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' },
@ -139,22 +126,6 @@ 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')
@ -172,22 +143,6 @@ Specify the table name , MUST BE uppercase.
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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,20 +34,12 @@ sub new {
$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;
}
@ -70,16 +61,13 @@ sub check_options {
$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 ) {
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ($webcontent !~ /^BANNER=/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find oracle version info."
@ -106,22 +94,6 @@ 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')
@ -130,22 +102,6 @@ Set path to get status page. (Default: '/easportal/tools/nagios/checkoracleversi
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.

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ( $class, %options ) = @_;
@ -35,21 +34,12 @@ sub new {
$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;
}
@ -121,17 +111,13 @@ sub check_options {
$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 ) {
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ($webcontent !~ /ActiveThreadCount=\d+/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find ormrpc status in response: \'" . $webcontent . "\'"
@ -266,42 +252,10 @@ 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).

View File

@ -25,7 +25,6 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -35,20 +34,12 @@ sub new {
$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;
}
@ -63,33 +54,29 @@ sub check_options {
# 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();
$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();
$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();
$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}});
$self->{output}->add_option_msg(short_msg => "Wrong critical timeoutcount threshold '" . $self->{crit_timeoutcount} . "'.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
$webcontent =~ s/^\s|\s+$//g; #trim
if ( $webcontent !~ /TransactionCount=\d+/i ) {
my $webcontent = $options{custom}->request(path => $self->{option_results}->{url_path});
if ($webcontent !~ /TransactionCount=\d+/i) {
$self->{output}->output_add(
severity => 'UNKNOWN',
short_msg => "Cannot find transaction status."
@ -166,42 +153,10 @@ 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

View File

@ -22,36 +22,36 @@ package apps::kingdee::eas::plugin;
use strict;
use warnings;
use base qw(centreon::plugins::script_simple);
use base qw(centreon::plugins::script_custom);
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',
'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',
'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',
);
$self->{custom_modes}{api} = 'apps::kingdee::eas::custom::api';
return $self;
}