Merge branch 'master' into issue92

This commit is contained in:
Shini31 2015-08-10 12:23:46 +02:00
commit 1730917cf6
1039 changed files with 24851 additions and 37680 deletions

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View File

@ -3,7 +3,7 @@
You can monitor many systems:
* application: Apache, Asterisk, Elasticsearch, Github, Jenkins, Nginx, Pfsense, Tomcat, Varnish,...
* database: Informix, MySQL, Postgres, Oracle, MS SQL
* database: Firebird, Informix, MySQL, Postgres, Oracle, MS SQL
* hardware: printers (rfc3805), UPS (Powerware, Mge, Standard), Sun Hardware, Cisco UCS, SensorIP, HP Proliant, HP Bladechassis, Dell Openmanage, Dell CMC,
* network: Aruba, Brocade, Bluecoat, Brocade, Checkpoint, Cisco AP/IronPort/ASA/Standard, Extreme, Fortigate, H3C, Hirschmann, HP Procurve, F5 BIG-IP, Juniper, PaloAlto, Redback, Riverbed, Ruggedcom, Stonesoft,...
* os: Linux (SNMP, NRPE), Freebsd (SNMP), AIX (SNMP), Solaris (SNMP)...

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::activedirectory::local::mode::dcdiag;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::activedirectory::local::mode::netdom;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::activedirectory::local::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::activedirectory::wsman::mode::dcdiag;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::activedirectory::wsman::plugin;

View File

@ -1,38 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Simon BOMM <sbomm@merethis.com>
#
# Based on De Bodt Lieven plugin
####################################################################################
package apps::apache::serverstatus::mode::cpuload;
@ -40,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -52,7 +36,7 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
@ -60,8 +44,9 @@ sub new {
"proxyurl:s" => { name => 'proxyurl' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -77,20 +62,13 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = centreon::plugins::httplib::connect($self);
my $webcontent = $self->{http}->request();
# If not present: cpuload is 0
my ($cpuload) = 0;

View File

@ -1,38 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Simon BOMM <sbomm@merethis.com>
#
# Based on De Bodt Lieven plugin
####################################################################################
package apps::apache::serverstatus::mode::requests;
@ -40,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use centreon::plugins::statefile;
sub new {
@ -53,7 +37,7 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
@ -65,8 +49,9 @@ sub new {
"critical-bytes:s" => { name => 'critical_bytes' },
"warning-access:s" => { name => 'warning_access' },
"critical-access:s" => { name => 'critical_access' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
return $self;
}
@ -99,22 +84,15 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical-access threshold '" . $self->{option_results}->{critical_access} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
$self->{statefile_value}->check_options(%options);
}
sub run {
my ($self, %options) = @_;
my $webcontent = centreon::plugins::httplib::connect($self);
my $webcontent = $self->{http}->request();
my ($rPerSec, $bPerReq, $total_access, $total_bytes, $avg_bPerSec);
$total_access = $1 if ($webcontent =~ /^Total Accesses:\s+([^\s]+)/mi);
@ -137,7 +115,7 @@ sub run {
$avg_bPerSec = '0' . $avg_bPerSec if ($avg_bPerSec =~ /^\./);
$bPerReq = '0' . $bPerReq if ($bPerReq =~ /^\./);
$self->{statefile_value}->read(statefile => 'apache_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode});
$self->{statefile_value}->read(statefile => 'apache_' . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode});
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
my $old_total_access = $self->{statefile_value}->get(name => 'total_access');
my $old_total_bytes = $self->{statefile_value}->get(name => 'total_bytes');

View File

@ -1,38 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Simon BOMM <sbomm@merethis.com>
#
# Based on De Bodt Lieven plugin
####################################################################################
package apps::apache::serverstatus::mode::responsetime;
@ -41,7 +25,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use Time::HiRes qw(gettimeofday tv_interval);
use centreon::plugins::httplib;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -53,7 +37,7 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
@ -61,8 +45,12 @@ sub new {
"proxyurl:s" => { name => 'proxyurl' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
"unknown-status:s" => { name => 'unknown_status', default => '' },
"warning-status:s" => { name => 'warning_status' },
"critical-status:s" => { name => 'critical_status', default => '%{http_code} < 200 or %{http_code} >= 300' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -79,19 +67,7 @@ sub check_options {
$self->{output}->option_exit();
}
if (($self->{option_results}->{proto} ne 'http') && ($self->{option_results}->{proto} ne 'https')) {
$self->{output}->add_option_msg(short_msg => "Unsupported protocol specified '" . $self->{option_results}->{proto} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
@ -99,18 +75,19 @@ sub run {
my $timing0 = [gettimeofday];
my $webcontent = centreon::plugins::httplib::connect($self, connection_exit => 'critical');
my $webcontent = $self->{http}->request();
my $timeelapsed = tv_interval ($timing0, [gettimeofday]);
my $exit = $self->{perfdata}->threshold_check(value => $timeelapsed,
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Response time %fs ", $timeelapsed));
$self->{output}->perfdata_add(label => "time",
value => $timeelapsed,
short_msg => sprintf("Response time %.3fs", $timeelapsed));
$self->{output}->perfdata_add(label => "time", unit => 's',
value => sprintf('%.3f', $timeelapsed),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'));
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0);
$self->{output}->display();
$self->{output}->exit();
@ -162,6 +139,18 @@ Proxy URL if any
Threshold for HTTP timeout
=item B<--unknown-status>
Threshold warning for http response code
=item B<--warning-status>
Threshold warning for http response code
=item B<--critical-status>
Threshold critical for http response code (Default: '%{http_code} < 200 or %{http_code} >= 300')
=item B<--warning>
Threshold warning in seconds (server-status page response time)

View File

@ -1,38 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Simon BOMM <sbomm@merethis.com>
#
# Based on De Bodt Lieven plugin
####################################################################################
package apps::apache::serverstatus::mode::slotstates;
@ -40,7 +24,169 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use centreon::plugins::values;
my $instance_mode;
my $maps_counters = {
global => {
'000_busy' => { set => {
key_values => [ { name => 'busy' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'busy' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'001_free' => { set => {
key_values => [ { name => 'free' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'free' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'002_waiting' => { set => {
key_values => [ { name => 'waiting' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'waiting' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'003_starting' => { set => {
key_values => [ { name => 'starting' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'starting' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'004_reading' => { set => {
key_values => [ { name => 'reading' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'reading' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'005_sending' => { set => {
key_values => [ { name => 'sending' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'sending' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'006_keepalive' => { set => {
key_values => [ { name => 'keepalive' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'keepalive' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'007_dns-lookup' => { set => {
key_values => [ { name => 'dns_lookup' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'dns_lookup' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'008_closing' => { set => {
key_values => [ { name => 'closing' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'closing' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'009_logging' => { set => {
key_values => [ { name => 'logging' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'logging' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'007_gracefuly-finished' => { set => {
key_values => [ { name => 'gracefuly_finished' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'gracefuly_finished' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
'007_idle-cleanup-worker' => { set => {
key_values => [ { name => 'idle_cleanup_worker' }, { name => 'total' } ],
closure_custom_calc => \&custom_value_calc, closure_custom_calc_extra_options => { label_ref => 'idle_cleanup_worker' },
closure_custom_output => \&custom_value_output,
closure_custom_threshold_check => \&custom_value_threshold,
closure_custom_perfdata => \&custom_value_perfdata,
}
},
},
};
sub custom_value_threshold {
my ($self, %options) = @_;
my $exit = 'ok';
if ($instance_mode->{option_results}->{units} eq '%') {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{prct}, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
} else {
$exit = $self->{perfdata}->threshold_check(value => $self->{result_values}->{used}, threshold => [ { label => 'critical-' . $self->{label}, exit_litteral => 'critical' }, { label => 'warning-' . $self->{label}, exit_litteral => 'warning' } ]);
}
return $exit;
}
sub custom_value_perfdata {
my ($self, %options) = @_;
my ($warning, $critical);
if ($instance_mode->{option_results}->{units} eq '%') {
$warning = $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label}, total => $self->{result_values}->{total}, cast_int => 1);
$critical = $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label}, total => $self->{result_values}->{total}, cast_int => 1);
} else {
$warning = $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{label});
$critical = $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{label});
}
$self->{output}->perfdata_add(label => $self->{result_values}->{label},
value => $self->{result_values}->{used},
warning => $warning,
critical => $critical,
min => 0, max => $self->{result_values}->{total});
}
sub custom_value_output {
my ($self, %options) = @_;
my $label = $self->{result_values}->{label};
$label =~ s/_/ /g;
$label =~ s/(\w+)/\u$1/g;
my $msg = sprintf("%s : %s (%.2f %%)",
ucfirst($label),
$self->{result_values}->{used}, $self->{result_values}->{prct});
return $msg;
}
sub custom_value_calc {
my ($self, %options) = @_;
$self->{result_values}->{total} = $options{new_datas}->{$self->{instance} . '_total'};
if ($self->{result_values}->{total} == 0) {
$self->{error_msg} = "skipped";
return -2;
}
$self->{result_values}->{used} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{label_ref}};
$self->{result_values}->{prct} = $self->{result_values}->{used} * 100 / $self->{result_values}->{total};
$self->{result_values}->{label} = $options{extra_options}->{label_ref};
return 0;
}
sub new {
my ($class, %options) = @_;
@ -49,19 +195,37 @@ sub new {
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' },
});
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"proxyurl:s" => { name => 'proxyurl' },
"timeout:s" => { name => 'timeout' },
"units:s" => { name => 'units', default => '%' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
foreach my $key (('global')) {
foreach (keys %{$maps_counters->{$key}}) {
my ($id, $name) = split /_/;
if (!defined($maps_counters->{$key}->{$_}->{threshold}) || $maps_counters->{$key}->{$_}->{threshold} != 0) {
$options{options}->add_options(arguments => {
'warning-' . $name . ':s' => { name => 'warning-' . $name },
'critical-' . $name . ':s' => { name => 'critical-' . $name },
});
}
$maps_counters->{$key}->{$_}->{obj} = centreon::plugins::values->new(output => $self->{output},
perfdata => $self->{perfdata},
label => $name);
$maps_counters->{$key}->{$_}->{obj}->set(%{$maps_counters->{$key}->{$_}->{set}});
}
}
return $self;
}
@ -69,76 +233,81 @@ 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();
}
if (($self->{option_results}->{proto} ne 'http') && ($self->{option_results}->{proto} ne 'https')) {
$self->{output}->add_option_msg(short_msg => "Unsupported protocol specified '" . $self->{option_results}->{proto} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
foreach my $key (('global')) {
foreach (keys %{$maps_counters->{$key}}) {
$maps_counters->{$key}->{$_}->{obj}->init(option_results => $self->{option_results});
}
}
$instance_mode = $self;
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = centreon::plugins::httplib::connect($self);
$self->manage_selection();
my ($short_msg, $short_msg_append, $long_msg, $long_msg_append) = ('', '', '', '');
my @exits;
foreach (sort keys %{$maps_counters->{global}}) {
my $obj = $maps_counters->{global}->{$_}->{obj};
$obj->set(instance => 'global');
my ($value_check) = $obj->execute(values => $self->{global});
if ($value_check != 0) {
$long_msg .= $long_msg_append . $obj->output_error();
$long_msg_append = ', ';
next;
}
my $exit2 = $obj->threshold_check();
push @exits, $exit2;
my $output = $obj->output();
$long_msg .= $long_msg_append . $output;
$long_msg_append = ', ';
if (!$self->{output}->is_status(litteral => 1, value => $exit2, compare => 'ok')) {
$short_msg .= $short_msg_append . $output;
$short_msg_append = ', ';
}
$obj->perfdata();
}
my $exit = $self->{output}->get_most_critical(status => [ @exits ]);
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
$self->{output}->output_add(severity => $exit,
short_msg => "Slots $short_msg"
);
} else {
$self->{output}->output_add(short_msg => "Slots $long_msg");
}
$self->{output}->display();
$self->{output}->exit();
}
sub manage_selection {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
my $ScoreBoard = "";
if ($webcontent =~ /^Scoreboard:\s+([^\s]+)/mi) {
$ScoreBoard = $1;
}
my $srvLimit = length($ScoreBoard);
my $CountOpenSlots = ($ScoreBoard =~ tr/\.//);
my $exit = $self->{perfdata}->threshold_check(value => $CountOpenSlots,
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Free slots: %d", $CountOpenSlots));
$self->{output}->perfdata_add(label => "freeSlots",
value => $CountOpenSlots,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0,
max => $srvLimit);
$self->{output}->perfdata_add(label => "waiting",
value => ($ScoreBoard =~ tr/\_//));
$self->{output}->perfdata_add(label => "starting",
value => ($ScoreBoard =~ tr/S//));
$self->{output}->perfdata_add(label => "reading",
value => ($ScoreBoard =~ tr/R//));
$self->{output}->perfdata_add(label => "sending",
value => ($ScoreBoard =~ tr/W//));
$self->{output}->perfdata_add(label => "keepalive",
value => ($ScoreBoard =~ tr/K//));
$self->{output}->perfdata_add(label => "dns_lookup",
value => ($ScoreBoard =~ tr/D//));
$self->{output}->perfdata_add(label => "closing",
value => ($ScoreBoard =~ tr/C//));
$self->{output}->perfdata_add(label => "logging",
value => ($ScoreBoard =~ tr/L//));
$self->{output}->perfdata_add(label => "gracefuly_finished",
value => ($ScoreBoard =~ tr/G//));
$self->{output}->perfdata_add(label => "idle_cleanup_worker",
value => ($ScoreBoard =~ tr/I//));
$self->{output}->display();
$self->{output}->exit();
$self->{global} = { total => length($ScoreBoard),
free => ($ScoreBoard =~ tr/\.//),
busy => length($ScoreBoard) - ($ScoreBoard =~ tr/\.//),
waiting => ($ScoreBoard =~ tr/\_//), starting => ($ScoreBoard =~ tr/S//),
reading => ($ScoreBoard =~ tr/R//), sending => ($ScoreBoard =~ tr/W//),
keepalive => ($ScoreBoard =~ tr/K//), dns_lookup => ($ScoreBoard =~ tr/D//),
closing => ($ScoreBoard =~ tr/C//), logging => ($ScoreBoard =~ tr/L//),
gracefuly_finished => ($ScoreBoard =~ tr/G//), idle_cleanup_worker => ($ScoreBoard =~ tr/I//)};
}
1;
@ -187,13 +356,25 @@ Specify password for basic authentification (Mandatory if --credentials is speci
Threshold for HTTP timeout
=item B<--units>
Threshold unit (Default: '%'. Can be: '%' or 'absolute')
=item B<--warning>
Warning Threshold on remaining free slot
Warning threshold.
Can be: 'busy', 'free', 'waiting', 'starting', 'reading',
'sending', 'keepalive', 'dns-lookup', 'closing',
'logging', 'gracefuly-finished', 'idle-cleanup-worker'.
=item B<--critical>
Critical Threshold on remaining free slot
Critical threshold.
Can be: 'busy', 'free', 'waiting', 'starting', 'reading',
'sending', 'keepalive', 'dns-lookup', 'closing',
'logging', 'gracefuly-finished', 'idle-cleanup-worker'.
=over 8)
=back

View File

@ -1,38 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Simon BOMM <sbomm@merethis.com>
#
# Based on De Bodt Lieven plugin
####################################################################################
package apps::apache::serverstatus::mode::workers;
@ -40,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
sub new {
my ($class, %options) = @_;
@ -52,7 +36,7 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', },
"proto:s" => { name => 'proto', default => "http" },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/server-status/?auto" },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
@ -60,8 +44,9 @@ sub new {
"proxyurl:s" => { name => 'proxyurl' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -77,25 +62,13 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
if (($self->{option_results}->{proto} ne 'http') && ($self->{option_results}->{proto} ne 'https')) {
$self->{output}->add_option_msg(short_msg => "Unsupported protocol specified '" . $self->{option_results}->{proto} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = centreon::plugins::httplib::connect($self);
my $webcontent = $self->{http}->request();
my ($BusyWorkers, $IdleWorkers, $ScoreBoard);
if ($webcontent =~ /^BusyWorkers:\s+([^\s]+)/mi) {
$BusyWorkers = $1;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::apache::serverstatus::plugin;

View File

@ -1,65 +0,0 @@
###############################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Author : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::apc::web::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} = '0.1';
%{$self->{modes}} = (
'file-cache' => 'apps::apc::web::mode::filecache',
'memory' => 'apps::apc::web::mode::memory',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check apc php module through the webpage
=cut

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::batterycharge;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::batteryvoltage;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::libgetdata;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::linefrequency;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::linevoltage;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::loadpercentage;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::outputvoltage;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::temperature;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::apcupsd::local::mode::timeleft;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
#
# see http://manned.org/apcaccess

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2014 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::bluemind::mode::incoming;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON;
@ -53,18 +38,18 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '8086'},
"proto:s" => { name => 'proto', default => 'http' },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => "/db" },
"database:s" => { name => 'database' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -80,10 +65,6 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{database})) {
$self->{output}->add_option_msg(short_msg => "Please set the database option");
$self->{output}->option_exit();
@ -93,13 +74,19 @@ sub check_options {
$self->{output}->option_exit();
}
my $query = 'select sum("success") as "success_sum", sum("failure") as "failure_sum" from lmtpd.deliveries where time > '.$old_timestamp.'s and time < now()';
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."/".$self->{option_results}->{database}."/series";
$self->{option_results}->{get_param} = [];
push @{$self->{option_results}->{get_param}}, "q=" . $query, "p=" . $self->{option_results}->{password}, "u=" . $self->{option_results}->{username};
$self->{http}->set_options(%{$self->{option_results}});
$self->{statefile_value}->check_options(%options);
}
sub run {
my ($self, %options) = @_;
$self->{statefile_value}->read(statefile => 'bluemind_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode});
$self->{statefile_value}->read(statefile => 'bluemind_' . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode});
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
my $new_datas = {};
@ -113,14 +100,9 @@ sub run {
$self->{output}->exit();
}
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."/".$self->{option_results}->{database}."/series";
$self->{option_results}->{query} = 'select sum("success") as "success_sum", sum("failure") as "failure_sum" from lmtpd.deliveries where time > '.$old_timestamp.'s and time < now()';
my $query_form_get = { q => $self->{option_results}->{query}, p => $self->{option_results}->{password}, u => $self->{option_results}->{username} };
my $jsoncontent = centreon::plugins::httplib::connect($self, query_form_get => $query_form_get);
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@merethis.com>
#
####################################################################################
package apps::bluemind::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::centreon::local::mode::metaservice;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon BOMM <sbomm@centreon.com>
#
####################################################################################
package apps::centreon::local::mode::retentionbroker;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::centreon::local::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@centreon.com>
#
####################################################################################
package apps::centreon::mysql::mode::countnotifications;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@centreon.com>
#
####################################################################################
package apps::centreon::mysql::mode::countproblems;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2015 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon Bomm <sbomm@merethis.com>
#
####################################################################################
package apps::centreon::mysql::mode::partitioning;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Kevin Duret <kduret@merethis.com>
#
####################################################################################
package apps::centreon::mysql::mode::pollerdelay;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::checkmyws::mode::status;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use JSON;
my $thresholds = {
@ -65,10 +50,11 @@ sub new {
"urlpath:s" => { name => 'url_path', default => "/api/status" },
"proxyurl:s" => { name => 'proxyurl' },
"uid:s" => { name => 'uid' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
"threshold-overload:s@" => { name => 'threshold_overload' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -103,19 +89,19 @@ sub check_options {
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
}
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."/".$self->{option_results}->{uid};
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."/".$self->{option_results}->{uid};
my $jsoncontent = centreon::plugins::httplib::connect($self);
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {
$webcontent = $json->decode($jsoncontent);
};
@ -229,7 +215,7 @@ ID for checkmyws API
=item B<--timeout>
Threshold for HTTP timeout (Default: '3')
Threshold for HTTP timeout (Default: 5)
=item B<--threshold-overload>

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::checkmyws::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::citrix::local::mode::folder;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::citrix::local::mode::license;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::citrix::local::mode::session;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::citrix::local::mode::zone;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::citrix::local::plugin;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::elasticsearch::mode::cluster;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use JSON;
my $thresholds = {
@ -60,15 +45,16 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '9200'},
"proto:s" => { name => 'proto', default => 'http' },
"urlpath:s" => { name => 'url_path', default => '/' },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
"threshold-overload:s@" => { name => 'threshold_overload' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -76,15 +62,6 @@ sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{overload_th} = {};
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
if ($val !~ /^(.*?),(.*?),(.*)$/) {
@ -99,6 +76,9 @@ sub check_options {
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
}
$self->{option_results}->{url_path} = $self->{option_results}->{url_path} . "_cluster/health/";
$self->{http}->set_options(%{$self->{option_results}});
}
sub get_severity {
@ -126,9 +106,7 @@ sub get_severity {
sub run {
my ($self, %options) = @_;
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."_cluster/health/";
my $jsoncontent = centreon::plugins::httplib::connect($self, connection_exit => 'critical');
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
@ -214,7 +192,7 @@ Specify password for API authentification
=item B<--timeout>
Threshold for HTTP timeout (Default: 3)
Threshold for HTTP timeout (Default: 5)
=item B<--threshold-overload>

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::elasticsearch::mode::indices;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use JSON;
use Data::Dumper;
@ -62,20 +47,21 @@ sub new {
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$self->{version} = '1.1';
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '9200'},
"proto:s" => { name => 'proto', default => 'http' },
"urlpath:s" => { name => 'url_path', default => '/' },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
"threshold-overload:s@" => { name => 'threshold_overload' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -83,15 +69,6 @@ sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{overload_th} = {};
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
if ($val !~ /^(.*?),(.*?),(.*)$/) {
@ -107,6 +84,9 @@ sub check_options {
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
}
$self->{option_results}->{url_path} = $self->{option_results}->{url_path} . "_cluster/health";
$self->{option_results}->{get_param} = ['level=indices'];
$self->{http}->set_options(%{$self->{option_results}});
}
sub get_severity {
@ -134,19 +114,14 @@ sub get_severity {
sub run {
my ($self, %options) = @_;
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."_cluster/health";
my $query_form_get = { level => 'indices' };
my $jsoncontent = centreon::plugins::httplib::connect($self, query_form_get => $query_form_get, connection_exit => 'critical');
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {
$webcontent = $json->decode($jsoncontent);
};
if ($@) {
$self->{output}->add_option_msg(short_msg => "Cannot decode json response");
$self->{output}->option_exit();
@ -154,11 +129,9 @@ sub run {
$self->{output}->output_add(severity => 'OK',
short_msg => sprintf("All indices are in green state."));
my $exit = 'OK';
foreach my $indicename (sort (keys %{$webcontent->{indices}})) {
my $tmp_exit = $self->get_severity(section => 'indices', value => $webcontent->{indices}->{$indicename}->{status});
my $tmp_exit = $self->get_severity(section => 'indices', value => $webcontent->{indices}->{$indicename}->{status});
$exit = $self->{output}->get_most_critical(status => [ $tmp_exit, $exit ]);
if (!$self->{output}->is_status(value => $tmp_exit, compare => 'OK', litteral => 1)) {
$self->{output}->output_add(long_msg => sprintf("Indice %s status is in %s state",
@ -166,10 +139,12 @@ sub run {
}
}
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("One or some indices are in %s state", $map_states_indices{$exit}));
if (!$self->{output}->is_status(value => $exit, compare => 'OK', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Some indices are in wrong state"));
}
$self->{output}->display(force_long_output => 1);
$self->{output}->display();
$self->{output}->exit();
}

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::elasticsearch::mode::nodescount;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use JSON;
sub new {
@ -52,16 +37,17 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '9200'},
"proto:s" => { name => 'proto', default => 'http' },
"urlpath:s" => { name => 'url_path', default => '/' },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -69,15 +55,6 @@ sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
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();
@ -86,17 +63,17 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} = $self->{option_results}->{url_path} . "_cluster/stats/";
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."_cluster/stats/";
my $jsoncontent = centreon::plugins::httplib::connect($self, connection_exit => 'critical');
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {
@ -121,26 +98,18 @@ sub run {
);
$self->{output}->perfdata_add(label => "nodemasteronly",
value => $webcontent->{nodes}->{count}->{master_only},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0,
);
$self->{output}->perfdata_add(label => "nodedataonly",
value => $webcontent->{nodes}->{count}->{data_only},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0,
);
$self->{output}->perfdata_add(label => "nodemasterdata",
value => $webcontent->{nodes}->{count}->{master_data},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0,
);
$self->{output}->perfdata_add(label => "nodeclient",
value => $webcontent->{nodes}->{count}->{client},
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0,
);
$self->{output}->display();
@ -196,7 +165,7 @@ Threshold critical.
=item B<--timeout>
Threshold for HTTP timeout (Default: 3)
Threshold for HTTP timeout (Default: 5)
=back

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::elasticsearch::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::exchange::2010::local::mode::activesyncmailbox;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::exchange::2010::local::mode::databases;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::exchange::2010::local::mode::imapmailbox;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::exchange::2010::local::mode::mapimailbox;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::exchange::2010::local::plugin;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::github::mode::commits;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON;
use DateTime;
@ -60,9 +45,10 @@ sub new {
"password:s" => { name => 'password' },
"owner:s" => { name => 'owner' },
"repository:s" => { name => 'repository' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
return $self;
@ -72,14 +58,6 @@ sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{repository})) {
$self->{output}->add_option_msg(short_msg => "Please set the repository option");
$self->{output}->option_exit();
@ -89,13 +67,15 @@ sub check_options {
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} = "/repos/" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository}."/commits";
$self->{http}->set_options(%{$self->{option_results}});
$self->{statefile_value}->check_options(%options);
}
sub run {
my ($self, %options) = @_;
$self->{statefile_value}->read(statefile => 'github_' . $self->{option_results}->{repository} . '_' . $self->{option_results}->{owner} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode});
$self->{statefile_value}->read(statefile => 'github_' . $self->{option_results}->{repository} . '_' . $self->{option_results}->{owner} . '_' . $self->{http}->get_port() . '_' . $self->{mode});
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
my $new_datas = {};
@ -112,15 +92,10 @@ sub run {
# Change date format from epoch to iso8601
my $old_iso8601 = DateTime->from_epoch(epoch => $old_timestamp)."Z";
$self->{option_results}->{url_path} = "/repos/".$self->{option_results}->{owner}."/".$self->{option_results}->{repository}."/commits";
my $query_form_get = { per_page => '1000', since => $old_iso8601 };
my $jsoncontent = centreon::plugins::httplib::connect($self, query_form_get => $query_form_get , connection_exit => 'critical');
my $jsoncontent = $self->{http}->request(get_param => ['per_page=1000', 'since=' . $old_iso8601]);
my $json = JSON->new;
my $webcontent;
eval {
$webcontent = $json->decode($jsoncontent);
};
@ -142,7 +117,6 @@ sub run {
$self->{output}->display();
$self->{output}->exit();
}
1;
@ -189,7 +163,7 @@ Specify GitHub's repository
=item B<--timeout>
Threshold for HTTP timeout (Default: 3)
Threshold for HTTP timeout (Default: 5)
=back

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::github::mode::issues;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use JSON;
sub new {
@ -61,9 +46,10 @@ sub new {
"owner:s" => { name => 'owner' },
"repository:s" => { name => 'repository' },
"label:s" => { name => 'label', default => '' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -71,14 +57,6 @@ sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{repository})) {
$self->{output}->add_option_msg(short_msg => "Please set the repository option");
$self->{output}->option_exit();
@ -88,33 +66,30 @@ sub check_options {
$self->{output}->option_exit();
}
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();
$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->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} = "/repos/" . $self->{option_results}->{owner} . "/" . $self->{option_results}->{repository} . "/issues";
if (defined($self->{option_results}->{label}) && $self->{option_results}->{label} ne '') {
$self->{option_results}->{get_param} = ['state=open', 'labels=' . $self->{option_results}->{label}, 'per_page=1000'];
} else {
$self->{option_results}->{get_param} = ['state=open', 'per_page=1000'];
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
$self->{option_results}->{url_path} = "/repos/".$self->{option_results}->{owner}."/".$self->{option_results}->{repository} . "/issues";
my $query_form_get;
if (defined($self->{option_results}->{label}) && $self->{option_results}->{label} ne '') {
$query_form_get = { state => 'open', labels => $self->{option_results}->{label}, per_page => '1000' };
} else {
$query_form_get = { state => 'open', per_page => '1000' };
}
my $jsoncontent = centreon::plugins::httplib::connect($self, query_form_get => $query_form_get , connection_exit => 'critical');
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {
$webcontent = $json->decode($jsoncontent);
};
@ -151,7 +126,6 @@ sub run {
$self->{output}->display();
$self->{output}->exit();
}
1;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::github::mode::pullrequests;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use JSON;
sub new {
@ -51,7 +36,7 @@ sub new {
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname', default => 'api.github.com' },
"port:s" => { name => 'port', default => '443'},
"port:s" => { name => 'port', default => '443' },
"proto:s" => { name => 'proto', default => 'https' },
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
@ -60,9 +45,10 @@ sub new {
"critical:s" => { name => 'critical' },
"owner:s" => { name => 'owner' },
"repository:s" => { name => 'repository' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -70,14 +56,6 @@ sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{repository})) {
$self->{output}->add_option_msg(short_msg => "Please set the repository option");
$self->{output}->option_exit();
@ -94,21 +72,19 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} = "/repos/".$self->{option_results}->{owner}."/".$self->{option_results}->{repository}."/pulls";
$self->{option_results}->{get_param} = ['state=open', 'per_page=1000'];
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
$self->{option_results}->{url_path} = "/repos/".$self->{option_results}->{owner}."/".$self->{option_results}->{repository}."/pulls";
my $query_form_get = { state => 'open', per_page => '1000' };
my $jsoncontent = centreon::plugins::httplib::connect($self, query_form_get => $query_form_get , connection_exit => 'critical');
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {
$webcontent = $json->decode($jsoncontent);
};
@ -133,7 +109,6 @@ sub run {
);
$self->{output}->display();
$self->{output}->exit();
}
1;
@ -188,7 +163,7 @@ Specify GitHub's repository
=item B<--timeout>
Threshold for HTTP timeout (Default: 3)
Threshold for HTTP timeout (Default: 5)
=back

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::github::mode::status;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use JSON;
my $thresholds = {
@ -65,10 +50,11 @@ sub new {
"credentials" => { name => 'credentials' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
"threshold-overload:s@" => { name => 'threshold_overload' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -76,15 +62,6 @@ sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{overload_th} = {};
foreach my $val (@{$self->{option_results}->{threshold_overload}}) {
if ($val !~ /^(.*?),(.*)$/) {
@ -99,6 +76,8 @@ sub check_options {
$self->{overload_th}->{$section} = [] if (!defined($self->{overload_th}->{$section}));
push @{$self->{overload_th}->{$section}}, {filter => $filter, status => $status};
}
$self->{http}->set_options(%{$self->{option_results}});
}
sub get_severity {
@ -125,12 +104,10 @@ sub get_severity {
sub run {
my ($self, %options) = @_;
my $jsoncontent = centreon::plugins::httplib::connect($self, connection_exit => 'critical');
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {
$webcontent = $json->decode($jsoncontent);
};
@ -147,7 +124,6 @@ sub run {
$self->{output}->display();
$self->{output}->exit();
}
1;
@ -190,7 +166,7 @@ Specify password
=item B<--timeout>
Threshold for HTTP timeout (Default: 3)
Threshold for HTTP timeout (Default: 5
=item B<--threshold-overload>

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::github::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : David Sabatie <dsabatie@centreon.com>
#
####################################################################################
package apps::hddtemp::local::mode::temperature;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::hddtemp::local::plugin;

View File

@ -1,39 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Florian Asche <info@florian-asche.de>
#
# Based on De Bodt Lieven plugin
# Based on Apache Mode by Simon BOMM
####################################################################################
package apps::hddtemp::remote::mode::listdrives;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::hddtemp::remote::mode::temperature;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::hddtemp::remote::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::local::mode::applicationpoolstate;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::local::mode::listapplicationpools;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::local::mode::listsites;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::local::mode::webservicestatistics;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::local::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::wsman::mode::applicationpoolstate;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::wsman::mode::listapplicationpools;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::iis::wsman::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
# Simon Bomm <sbomm@centreon.com>
####################################################################################
package apps::java::peoplesoft::jmx::mode::queuelength;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
# Simon Bomm <sbomm@centreon.com>
####################################################################################
package apps::java::peoplesoft::jmx::mode::sessions;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon Bomm <sbomm@centreon.com>
#
####################################################################################
package apps::java::peoplesoft::jmx::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Quentin Garnier <qgarnier@merethis.com>
#
####################################################################################
package apps::java::weblogic::jmx::mode::workmanager;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2014 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon Bomm <sbomm@centreon.com>
#
####################################################################################
package apps::java::weblogic::jmx::plugin;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::jenkins::mode::jobstate;
@ -39,7 +24,7 @@ use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use centreon::plugins::http;
use centreon::plugins::statefile;
use JSON;
@ -52,8 +37,8 @@ sub new {
$options{options}->add_options(arguments =>
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port', default => '80'},
"proto:s" => { name => 'proto', default => 'http' },
"port:s" => { name => 'port' },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path' },
"jobname:s" => { name => 'jobname' },
"credentials" => { name => 'credentials' },
@ -62,9 +47,10 @@ sub new {
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"checkstyle" => { name => 'checkstyle' },
"timeout:s" => { name => 'timeout', default => '3' },
"timeout:s" => { name => 'timeout' },
});
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
@ -80,32 +66,23 @@ sub check_options {
$self->{output}->add_option_msg(short_msg => "Wrong critical threshold '" . $self->{option_results}->{critical} . "'.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{hostname})) {
$self->{output}->add_option_msg(short_msg => "Please set the hostname option");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{jobname})) {
$self->{output}->add_option_msg(short_msg => "Please set the jobname option");
$self->{output}->option_exit();
}
if ((defined($self->{option_results}->{credentials})) && (!defined($self->{option_results}->{username}) || !defined($self->{option_results}->{password}))) {
$self->{output}->add_option_msg(short_msg => "You need to set --username= and --password= options when --credentials is used");
$self->{output}->option_exit();
}
$self->{option_results}->{url_path} = $self->{option_results}->{url_path} . "/job/" . $self->{option_results}->{jobname} . "/api/json";
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
$self->{option_results}->{url_path} = $self->{option_results}->{url_path}."/job/".$self->{option_results}->{jobname}."/api/json";
my $jsoncontent = centreon::plugins::httplib::connect($self);
my $jsoncontent = $self->{http}->request();
my $json = JSON->new;
my $webcontent;
eval {
$webcontent = $json->decode($jsoncontent);
};
@ -202,7 +179,7 @@ Add checkstyle's violation output and perfdata
=item B<--timeout>
Threshold for HTTP timeout (Default: 3)
Threshold for HTTP timeout (Default: 5)
=back

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2015 CENTREON
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Mathieu Cinquin <mcinquin@centreon.com>
#
####################################################################################
package apps::jenkins::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Kevin Duret <kduret@merethis.com>
#
####################################################################################
package apps::jive::sql::mode::etljobstatus;

View File

@ -0,0 +1,133 @@
#
# Copyright 2015 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::kayako::api::mode::listdepartment;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
my %handlers = (ALRM => {} );
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 => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$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}->{kayako_api_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{kayako_secret_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
my $salt = '';
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64($salt, $self->{option_results}->{kayako_secret_key});
$self->{option_results}->{url_path} .= "/Base/Department&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=";
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->set_options(%{$self->{option_results}});
my $xp = XML::XPath->new($webcontent);
my $nodes = $xp->find('departments/department');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./title', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List department:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departments of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -0,0 +1,133 @@
#
# Copyright 2015 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::kayako::api::mode::listpriority;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
my %handlers = (ALRM => {} );
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 => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$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}->{kayako_api_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{kayako_secret_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
my $salt;
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{kayako_secret_key});
$self->{option_results}->{url_path} .= "/Tickets/TicketPriority&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=";
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
my $xp = XML::XPath->new( $webcontent );
my $nodes = $xp->find('ticketpriorities/ticketpriority');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./title', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List priority:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departmentf of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -0,0 +1,132 @@
#
# Copyright 2015 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::kayako::api::mode::liststaff;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
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 => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$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}->{kayako_api_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{kayako_secret_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
my $salt;
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$self->{option_results}->{url_path} .= "/Base/Staff&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=";
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
my $xp = XML::XPath->new( $webcontent );
my $nodes = $xp->find('staffusers/staff');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./username', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List staff:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departmentf of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -0,0 +1,132 @@
#
# Copyright 2015 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::kayako::api::mode::liststatus;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::http;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
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 => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$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}->{kayako_api_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{kayako_secret_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
my $salt;
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$self->{option_results}->{'url_path'} .= "/Tickets/TicketStatus&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=";
$self->{http}->set_options(%{$self->{option_results}});
}
sub run {
my ($self, %options) = @_;
my $webcontent = $self->{http}->request();
my $xp = XML::XPath->new($webcontent);
my $nodes = $xp->find('ticketstatuses/ticketstatus');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./title', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List status:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departmentf of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -1,46 +1,31 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Author : Stéphane DURET <sduret@merethis.com>
#
####################################################################################
package apps::kayako::mode::ticketcount;
package apps::kayako::api::mode::ticketcount;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::statefile;
use centreon::plugins::httplib;
use centreon::plugins::http;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
use Time::Local;
@ -53,7 +38,6 @@ my @priority_filters;
my $ticket_total = 0;
my %tickets;
my $label;
my %handlers = (ALRM => {} );
sub new {
my ($class, %options) = @_;
@ -65,7 +49,7 @@ sub new {
{
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port' },
"proto:s" => { name => 'proto', default => "http" },
"proto:s" => { name => 'proto' },
"urlpath:s" => { name => 'url_path', default => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
@ -79,82 +63,56 @@ sub new {
"start-date:s" => { name => 'start_date' },
"end-date:s" => { name => 'end_date' },
});
$self->set_signal_handlers;
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
$self->{statefile_value} = centreon::plugins::statefile->new(%options);
$self->{http} = centreon::plugins::http->new(output => $self->{output});
return $self;
}
sub set_signal_handlers {
my $self = shift;
$SIG{ALRM} = \&class_handle_ALRM;
$handlers{ALRM}->{$self} = sub { $self->handle_ALRM() };
}
sub class_handle_ALRM {
foreach (keys %{$handlers{ALRM}}) {
&{$handlers{ALRM}->{$_}}();
}
}
sub handle_ALRM {
my $self = shift;
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => sprintf("Cannot finished API execution (timeout received)"));
$self->{output}->display();
$self->{output}->exit();
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{timeout}) && $self->{option_results}->{timeout} =~ /^\d+$/ &&
$self->{option_results}->{timeout} > 0) {
alarm($self->{option_results}->{timeout});
}
if (!defined($self->{option_results}->{'kayako_api_key'})) {
if (!defined($self->{option_results}->{kayako_api_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{'kayako_secret_key'})) {
if (!defined($self->{option_results}->{kayako_secret_key})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{'department_id'})) {
if (!defined($self->{option_results}->{department_id})) {
$self->{output}->add_option_msg(short_msg => "Please specify at least one department ID.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{'staff_id'})) {
$self->{option_results}->{'staff_id'} = "-1";
if (!defined($self->{option_results}->{staff_id})) {
$self->{option_results}->{staff_id} = "-1";
}
if (!defined($self->{option_results}->{'status_id'})) {
$self->{option_results}->{'status_id'} = "-1";
if (!defined($self->{option_results}->{status_id})) {
$self->{option_results}->{status_id} = "-1";
}
if (defined($self->{option_results}->{'priority_id'})) {
@priority_filters = split(/,/, $self->{option_results}->{'priority_id'});
if (defined($self->{option_results}->{priority_id})) {
@priority_filters = split(/,/, $self->{option_results}->{priority_id});
}
if (defined($self->{option_results}->{'start_date'})) {
if ($self->{option_results}->{'start_date'} !~ m/^\d{1,2}-\d{1,2}-\d{4}$/){
if (defined($self->{option_results}->{start_date})) {
if ($self->{option_results}->{start_date} !~ m/^\d{1,2}-\d{1,2}-\d{4}$/){
$self->{output}->add_option_msg(short_msg => "Please specify a valid date (DD-MM-YYYY).");
$self->{output}->option_exit();
} else {
my ($mday,$mon,$year) = split(/-/, $self->{option_results}->{'start_date'});
$start = $self->{option_results}->{'start_date'};
$self->{option_results}->{'start_date'} = timelocal(0,0,0,$mday,$mon-1,$year);
my ($mday,$mon,$year) = split(/-/, $self->{option_results}->{start_date});
$start = $self->{option_results}->{start_date};
$self->{option_results}->{start_date} = timelocal(0,0,0,$mday,$mon-1,$year);
}
}
if (defined($self->{option_results}->{'end_date'})) {
if ($self->{option_results}->{'end_date'} !~ m/^\d{1,2}-\d{1,2}-\d{4}$/){
if (defined($self->{option_results}->{end_date})) {
if ($self->{option_results}->{end_date} !~ m/^\d{1,2}-\d{1,2}-\d{4}$/){
$self->{output}->add_option_msg(short_msg => "Please specify a valid date (DD-MM-YYYY).");
$self->{output}->option_exit();
} else {
my ($mday,$mon,$year) = split(/-/, $self->{option_results}->{'end_date'});
$end = $self->{option_results}->{'end_date'};
$self->{option_results}->{'end_date'} = timelocal(59,59,23,$mday,$mon-1,$year);
my ($mday,$mon,$year) = split(/-/, $self->{option_results}->{end_date});
$end = $self->{option_results}->{end_date};
$self->{option_results}->{end_date} = timelocal(59,59,23,$mday,$mon-1,$year);
}
}
if (($self->{perfdata}->threshold_validate(label => 'warning', value => $self->{option_results}->{warning})) == 0) {
@ -168,6 +126,9 @@ sub check_options {
$self->{statefile_cache}->check_options(%options);
$self->{statefile_value}->check_options(%options);
$self->{http}->set_options(%{$self->{option_results}});
}
sub reload_cache {
@ -176,12 +137,12 @@ sub reload_cache {
$datas->{last_timestamp} = time();
my $salt;
my $salt = '';
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$self->{option_results}->{'url_path'} = $url_original_path . "/Base/Department&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
my $webcontent = centreon::plugins::httplib::connect($self);
my $xp = XML::XPath->new( $webcontent );
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{kayako_secret_key});
my $webcontent = $self->{http}->request(url_path => $url_original_path . "/Base/Department&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=";);
my $xp = XML::XPath->new($webcontent);
my $nodes = $xp->find('departments/department');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
@ -191,8 +152,7 @@ sub reload_cache {
$datas->{"department_".$trim_id} = $self->{output}->to_utf8($trim_title);
}
$self->{option_results}->{'url_path'} = $url_original_path . "/Tickets/TicketPriority&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
$webcontent = centreon::plugins::httplib::connect($self);
$webcontent = $self->{http}->request(url_path => $url_original_path . "/Tickets/TicketPriority&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=");
$xp = XML::XPath->new( $webcontent );
$nodes = $xp->find('ticketpriorities/ticketpriority');
foreach my $actionNode ($nodes->get_nodelist) {
@ -203,8 +163,7 @@ sub reload_cache {
$datas->{"priority_".$trim_id} = $self->{output}->to_utf8($trim_title);
}
$self->{option_results}->{'url_path'} = $url_original_path . "/Base/Staff&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
$webcontent = centreon::plugins::httplib::connect($self);
$webcontent = $self->{http}->request(url_path => $url_original_path . "/Base/Staff&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=");
$xp = XML::XPath->new( $webcontent );
$nodes = $xp->find('staffusers/staff');
foreach my $actionNode ($nodes->get_nodelist) {
@ -215,8 +174,7 @@ sub reload_cache {
$datas->{"staff_".$trim_id} = $self->{output}->to_utf8($trim_title);
}
$self->{option_results}->{'url_path'} = $url_original_path . "/Tickets/TicketStatus&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
$webcontent = centreon::plugins::httplib::connect($self);
$webcontent = $self->{http}->request(url_path => $url_original_path . "/Tickets/TicketStatus&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=");
$xp = XML::XPath->new( $webcontent );
$nodes = $xp->find('ticketstatuses/ticketstatus');
foreach my $actionNode ($nodes->get_nodelist) {
@ -232,10 +190,10 @@ sub reload_cache {
sub run {
my ($self, %options) = @_;
my $salt;
my $salt = '';
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$url_original_path = $self->{option_results}->{'url_path'};
my $digest = hmac_sha256_base64($salt, $self->{option_results}->{kayako_secret_key});
$url_original_path = $self->{option_results}->{url_path};
my $has_cache_file = $self->{statefile_cache}->read(statefile => 'cache_api_' . ($self->{option_results}->{hostname}) . '_kayako');
my $timestamp_cache = $self->{statefile_cache}->get(name => 'last_timestamp');
@ -245,8 +203,7 @@ sub run {
$self->{statefile_cache}->read();
}
$self->{option_results}->{'url_path'} = $url_original_path . "/Tickets/Ticket/ListAll/" . $self->{option_results}->{'department_id'} . "/" . $self->{option_results}->{'status_id'} . "/" . $self->{option_results}->{'staff_id'} . "/-1/-1/1420120620/-1/-1&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
my $webcontent = centreon::plugins::httplib::connect($self);
my $webcontent = $self->{http}->request(url_path => $url_original_path . "/Tickets/Ticket/ListAll/" . $self->{option_results}->{department_id} . "/" . $self->{option_results}->{status_id} . "/" . $self->{option_results}->{staff_id} . "/-1/-1/1420120620/-1/-1&apikey=" . $self->{option_results}->{kayako_api_key} . "&salt=" . $salt . "&signature=" . $digest . "=");
my $xp = XML::XPath->new( $webcontent );
my $nodes = $xp->find('tickets/ticket');
@ -258,9 +215,9 @@ sub run {
my $trim_priorityid = centreon::plugins::misc::trim($priorityid->string_value);
my ($date) = $xp->find('./lastactivity', $actionNode)->get_nodelist;
my $trim_date = centreon::plugins::misc::trim($date->string_value);
if (defined($self->{option_results}->{'start_date'}) and (defined($self->{option_results}->{'end_date'}))) {
if ($trim_date > $self->{option_results}->{'start_date'} and $trim_date < $self->{option_results}->{'end_date'}) {
if (defined($self->{option_results}->{'priority_id'})){
if (defined($self->{option_results}->{start_date}) and (defined($self->{option_results}->{end_date}))) {
if ($trim_date > $self->{option_results}->{start_date} and $trim_date < $self->{option_results}->{end_date}) {
if (defined($self->{option_results}->{priority_id})){
foreach $priority_filter (@priority_filters) {
if ($priority_filter == $trim_priorityid){
$tickets{$priority_filter}++;
@ -271,9 +228,9 @@ sub run {
$ticket_total++;
}
}
} elsif (defined($self->{option_results}->{'start_date'}) and (!defined($self->{option_results}->{'end_date'}))) {
if ($trim_date > $self->{option_results}->{'start_date'}) {
if (defined($self->{option_results}->{'priority_id'})){
} elsif (defined($self->{option_results}->{start_date}) and (!defined($self->{option_results}->{end_date}))) {
if ($trim_date > $self->{option_results}->{start_date}) {
if (defined($self->{option_results}->{priority_id})){
foreach $priority_filter (@priority_filters) {
if ($priority_filter == $trim_priorityid){
$tickets{$priority_filter}++;
@ -284,9 +241,9 @@ sub run {
$ticket_total++;
}
}
} elsif (!defined($self->{option_results}->{'start_date'}) and (defined($self->{option_results}->{'end_date'}))) {
if ($trim_date < $self->{option_results}->{'end_date'}) {
if (defined($self->{option_results}->{'priority_id'})){
} elsif (!defined($self->{option_results}->{start_date}) and (defined($self->{option_results}->{end_date}))) {
if ($trim_date < $self->{option_results}->{end_date}) {
if (defined($self->{option_results}->{priority_id})){
foreach $priority_filter (@priority_filters) {
if ($priority_filter == $trim_priorityid){
$tickets{$priority_filter}++;
@ -298,7 +255,7 @@ sub run {
}
}
} else {
if (defined($self->{option_results}->{'priority_id'})){
if (defined($self->{option_results}->{priority_id})){
foreach $priority_filter (@priority_filters) {
if ($priority_filter == $trim_priorityid){
$tickets{$priority_filter}++;
@ -314,32 +271,32 @@ sub run {
###########
# Manage Output
###########
my $exit = $self->{perfdata}->threshold_check(value => $ticket_total, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit = $self->{perfdata}->threshold_check(value => $ticket_total, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $staff = "";
my $ticket_status = "";
my $period = "";
if (defined($self->{option_results}->{'staff_id'}) && ($self->{option_results}->{'staff_id'} =~ m/^\d*$/)) {
$staff = " for staff '" . $self->{statefile_cache}->get(name => 'staff_'.$self->{option_results}->{'staff_id'}) ."'";
if (defined($self->{option_results}->{staff_id}) && ($self->{option_results}->{staff_id} =~ m/^\d*$/)) {
$staff = " for staff '" . $self->{statefile_cache}->get(name => 'staff_'.$self->{option_results}->{staff_id}) ."'";
}
if (defined($self->{option_results}->{'status_id'}) && ($self->{option_results}->{'status_id'} =~ m/^\d*$/)) {
$ticket_status = " in status '" . $self->{statefile_cache}->get(name => 'status_'.$self->{option_results}->{'status_id'}) ."'";
if (defined($self->{option_results}->{status_id}) && ($self->{option_results}->{status_id} =~ m/^\d*$/)) {
$ticket_status = " in status '" . $self->{statefile_cache}->get(name => 'status_'.$self->{option_results}->{status_id}) ."'";
}
if (defined($self->{option_results}->{'start_date'}) || defined($self->{option_results}->{'end_date'})){
if (defined($self->{option_results}->{start_date}) || defined($self->{option_results}->{end_date})){
$period = " -";
}
if (defined($self->{option_results}->{'start_date'})){
if (defined($self->{option_results}->{start_date})){
$start = " Start: " . $start;
}
if (defined($self->{option_results}->{'end_date'})){
if (defined($self->{option_results}->{end_date})){
$end = " End: " . $end;
}
if (defined($self->{option_results}->{'priority_id'})){
if (defined($self->{option_results}->{priority_id})){
foreach $priority_filter (@priority_filters) {
$label = $self->{statefile_cache}->get(name => 'priority_'.$priority_filter);
$self->{output}->perfdata_add(label => $label, value => $tickets{$priority_filter},

View File

@ -0,0 +1,53 @@
#
# Copyright 2015 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::kayako::api::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} = '0.1';
%{$self->{modes}} = (
'list-department' => 'apps::kayako::api::mode::listdepartment',
'list-priority' => 'apps::kayako::api::mode::listpriority',
'list-staff' => 'apps::kayako::api::mode::liststaff',
'list-status' => 'apps::kayako::api::mode::liststatus',
'ticket-count' => 'apps::kayako::api::mode::ticketcount',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Kayako with REST API.
=cut

View File

@ -1,173 +0,0 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Author : Stéphane DURET <sduret@merethis.com>
#
####################################################################################
package apps::kayako::mode::listdepartment;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
my %handlers = (ALRM => {} );
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', default => "http" },
"urlpath:s" => { name => 'url_path', default => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$self->set_signal_handlers;
return $self;
}
sub set_signal_handlers {
my $self = shift;
$SIG{ALRM} = \&class_handle_ALRM;
$handlers{ALRM}->{$self} = sub { $self->handle_ALRM() };
}
sub class_handle_ALRM {
foreach (keys %{$handlers{ALRM}}) {
&{$handlers{ALRM}->{$_}}();
}
}
sub handle_ALRM {
my $self = shift;
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => sprintf("Cannot finished API execution (timeout received)"));
$self->{output}->display();
$self->{output}->exit();
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{timeout}) && $self->{option_results}->{timeout} =~ /^\d+$/ &&
$self->{option_results}->{timeout} > 0) {
alarm($self->{option_results}->{timeout});
}
if (!defined($self->{option_results}->{'kayako_api_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{'kayako_secret_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my $salt;
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$self->{option_results}->{'url_path'} .= "/Base/Department&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
my $webcontent = centreon::plugins::httplib::connect($self);
my $xp = XML::XPath->new( $webcontent );
my $nodes = $xp->find('departments/department');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./title', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
# print $trim_id." : ". $trim_title."\n";
# }
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List department:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departmentf of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -1,171 +0,0 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Author : Stéphane DURET <sduret@merethis.com>
#
####################################################################################
package apps::kayako::mode::listpriority;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
my %handlers = (ALRM => {} );
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', default => "http" },
"urlpath:s" => { name => 'url_path', default => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$self->set_signal_handlers;
return $self;
}
sub set_signal_handlers {
my $self = shift;
$SIG{ALRM} = \&class_handle_ALRM;
$handlers{ALRM}->{$self} = sub { $self->handle_ALRM() };
}
sub class_handle_ALRM {
foreach (keys %{$handlers{ALRM}}) {
&{$handlers{ALRM}->{$_}}();
}
}
sub handle_ALRM {
my $self = shift;
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => sprintf("Cannot finished API execution (timeout received)"));
$self->{output}->display();
$self->{output}->exit();
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{timeout}) && $self->{option_results}->{timeout} =~ /^\d+$/ &&
$self->{option_results}->{timeout} > 0) {
alarm($self->{option_results}->{timeout});
}
if (!defined($self->{option_results}->{'kayako_api_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{'kayako_secret_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my $salt;
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$self->{option_results}->{'url_path'} .= "/Tickets/TicketPriority&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
my $webcontent = centreon::plugins::httplib::connect($self);
my $xp = XML::XPath->new( $webcontent );
my $nodes = $xp->find('ticketpriorities/ticketpriority');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./title', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List priority:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departmentf of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -1,171 +0,0 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Author : Stéphane DURET <sduret@merethis.com>
#
####################################################################################
package apps::kayako::mode::liststaff;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
my %handlers = (ALRM => {} );
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', default => "http" },
"urlpath:s" => { name => 'url_path', default => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$self->set_signal_handlers;
return $self;
}
sub set_signal_handlers {
my $self = shift;
$SIG{ALRM} = \&class_handle_ALRM;
$handlers{ALRM}->{$self} = sub { $self->handle_ALRM() };
}
sub class_handle_ALRM {
foreach (keys %{$handlers{ALRM}}) {
&{$handlers{ALRM}->{$_}}();
}
}
sub handle_ALRM {
my $self = shift;
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => sprintf("Cannot finished API execution (timeout received)"));
$self->{output}->display();
$self->{output}->exit();
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{timeout}) && $self->{option_results}->{timeout} =~ /^\d+$/ &&
$self->{option_results}->{timeout} > 0) {
alarm($self->{option_results}->{timeout});
}
if (!defined($self->{option_results}->{'kayako_api_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{'kayako_secret_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my $salt;
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$self->{option_results}->{'url_path'} .= "/Base/Staff&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
my $webcontent = centreon::plugins::httplib::connect($self);
my $xp = XML::XPath->new( $webcontent );
my $nodes = $xp->find('staffusers/staff');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./username', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List staff:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departmentf of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -1,171 +0,0 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an timeelapsedutable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting timeelapsedutable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Author : Stéphane DURET <sduret@merethis.com>
#
####################################################################################
package apps::kayako::mode::liststatus;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::httplib;
use XML::XPath;
use Digest::SHA qw(hmac_sha256_base64);
my %handlers = (ALRM => {} );
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', default => "http" },
"urlpath:s" => { name => 'url_path', default => '/api/index.php?' },
"kayako-api-key:s" => { name => 'kayako_api_key' },
"kayako-secret-key:s" => { name => 'kayako_secret_key' },
});
$self->set_signal_handlers;
return $self;
}
sub set_signal_handlers {
my $self = shift;
$SIG{ALRM} = \&class_handle_ALRM;
$handlers{ALRM}->{$self} = sub { $self->handle_ALRM() };
}
sub class_handle_ALRM {
foreach (keys %{$handlers{ALRM}}) {
&{$handlers{ALRM}->{$_}}();
}
}
sub handle_ALRM {
my $self = shift;
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => sprintf("Cannot finished scenario execution (timeout received)"));
$self->{output}->display();
$self->{output}->exit();
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{timeout}) && $self->{option_results}->{timeout} =~ /^\d+$/ &&
$self->{option_results}->{timeout} > 0) {
alarm($self->{option_results}->{timeout});
}
if (!defined($self->{option_results}->{'kayako_api_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify an API key for Kayako.");
$self->{output}->option_exit();
}
if (!defined($self->{option_results}->{'kayako_secret_key'})) {
$self->{output}->add_option_msg(short_msg => "Please specify a secret key for Kayako.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
my $salt;
$salt .= int(rand(10)) for 1..10;
my $digest = hmac_sha256_base64 ($salt, $self->{option_results}->{'kayako_secret_key'});
$self->{option_results}->{'url_path'} .= "/Tickets/TicketStatus&apikey=" . $self->{option_results}->{'kayako_api_key'} . "&salt=" . $salt . "&signature=" . $digest . "=";
my $webcontent = centreon::plugins::httplib::connect($self);
my $xp = XML::XPath->new( $webcontent );
my $nodes = $xp->find('ticketstatuses/ticketstatus');
foreach my $actionNode ($nodes->get_nodelist) {
my ($id) = $xp->find('./id', $actionNode)->get_nodelist;
my $trim_id = centreon::plugins::misc::trim($id->string_value);
my ($title) = $xp->find('./title', $actionNode)->get_nodelist;
my $trim_title = centreon::plugins::misc::trim($title->string_value);
$self->{output}->output_add(long_msg => "'" . $trim_title . "' [id = " . $trim_id . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List status:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departmentf of kayako
=over 8
=item B<--hostname>
IP Addr/FQDN of the webserver host (required)
=item B<--port>
Port used by Apache
=item B<--proto>
Specify https if needed
=item B<--proxyurl>
Proxy URL if any
=item B<--kayako-api-url>
This is the URL you should dispatch all GET, POST, PUT & DELETE requests to.
=item B<--kayako-api-key>
This is your unique API key.
=item B<--kayako-secret-key>
The secret key is used to sign all the requests dispatched to Kayako.
=back
=cut

View File

@ -1,68 +0,0 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
# For more information : contact@centreon.com
# Authors : Stéphane Duret <sduret@merethis.com>
#
####################################################################################
package apps::kayako::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} = '0.1';
%{$self->{modes}} = (
'list-department' => 'apps::kayako::mode::listdepartment',
'list-priority' => 'apps::kayako::mode::listpriority',
'list-staff' => 'apps::kayako::mode::liststaff',
'list-status' => 'apps::kayako::mode::liststatus',
'ticket-count' => 'apps::kayako::mode::ticketcount',
);
return $self;
}
1;
__END__
=head1 PLUGIN DESCRIPTION
Check Selenium server.
=cut

View File

@ -0,0 +1,69 @@
#
# Copyright 2015 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::kayako::sql::mode::listdepartment;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
$self->{sql} = $options{sql};
$self->{sql}->connect();
$self->{sql}->query(query => "SELECT departmentid, title FROM swdepartments");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$self->{output}->output_add(long_msg => "'" . $row->{title} . "' [id = " . $row->{departmentid} . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List departments:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List departments of kayako
=back
=cut

View File

@ -0,0 +1,69 @@
#
# Copyright 2015 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::kayako::sql::mode::listpriority;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
$self->{sql} = $options{sql};
$self->{sql}->connect();
$self->{sql}->query(query => "SELECT priorityid, title FROM swticketpriorities");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$self->{output}->output_add(long_msg => "'" . $row->{title} . "' [id = " . $row->{priorityid} . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List priorities:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List priorities of kayako
=back
=cut

View File

@ -0,0 +1,69 @@
#
# Copyright 2015 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::kayako::sql::mode::liststaff;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
$self->{sql} = $options{sql};
$self->{sql}->connect();
$self->{sql}->query(query => "SELECT staffid, username FROM swstaff");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$self->{output}->output_add(long_msg => "'" . $row->{username} . "' [id = " . $row->{staffid} . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List staff:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List staff of kayako
=back
=cut

View File

@ -0,0 +1,69 @@
#
# Copyright 2015 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::kayako::sql::mode::liststatus;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
}
sub run {
my ($self, %options) = @_;
$self->{sql} = $options{sql};
$self->{sql}->connect();
$self->{sql}->query(query => "SELECT ticketstatusid, title FROM swticketstatus");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$self->{output}->output_add(long_msg => "'" . $row->{title} . "' [id = " . $row->{ticketstatusid} . "]");
}
$self->{output}->output_add(severity => 'OK',
short_msg => 'List status:');
$self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);
$self->{output}->exit();
}
1;
__END__
=head1 MODE
List status of kayako
=back
=cut

View File

@ -0,0 +1,273 @@
#
# Copyright 2015 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::kayako::sql::mode::ticketcount;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
use centreon::plugins::statefile;
use Time::Local;
my $ticket_total = 0;
my %tickets;
my $label;
my $start = "";
my $end = "";
my $priority_filter;
my @priority_filters;
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 =>
{
"reload-cache-time:s" => { name => 'reload_cache_time', default => 180 },
"department-id:s" => { name => 'department_id' },
"staff-id:s" => { name => 'staff_id' },
"status-id:s" => { name => 'status_id' },
"priority-id:s" => { name => 'priority_id' },
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"start-date:s" => { name => 'start_date' },
"end-date:s" => { name => 'end_date' },
});
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
if (defined($self->{option_results}->{start_date})) {
if ($self->{option_results}->{start_date} !~ m/^\d{1,2}-\d{1,2}-\d{4}$/){
$self->{output}->add_option_msg(short_msg => "Please specify a valid date (DD-MM-YYYY).");
$self->{output}->option_exit();
} else {
my ($mday,$mon,$year) = split(/-/, $self->{option_results}->{'start_date'});
$start = $self->{option_results}->{start_date};
$self->{option_results}->{start_date} = timelocal(0,0,0,$mday,$mon-1,$year);
}
}
if (defined($self->{option_results}->{end_date})) {
if ($self->{option_results}->{end_date} !~ m/^\d{1,2}-\d{1,2}-\d{4}$/){
$self->{output}->add_option_msg(short_msg => "Please specify a valid date (DD-MM-YYYY).");
$self->{output}->option_exit();
} else {
my ($mday,$mon,$year) = split(/-/, $self->{option_results}->{end_date});
$end = $self->{option_results}->{end_date};
$self->{option_results}->{end_date} = timelocal(59,59,23,$mday,$mon-1,$year);
}
}
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();
}
if (defined($self->{option_results}->{priority_id})) {
@priority_filters = split(/,/, $self->{option_results}->{priority_id});
}
$self->{statefile_cache}->check_options(%options);
}
sub reload_cache {
my ($self) = @_;
my $datas = {};
$datas->{last_timestamp} = time();
$self->{sql}->query(query => "SELECT departmentid, title FROM swdepartments");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$datas->{"department_" . $row->{departmentid}} = $self->{output}->to_utf8($row->{title});
}
$self->{sql}->query(query => "SELECT priorityid, title FROM swticketpriorities");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$datas->{"priority_" . $row->{priorityid}} = $self->{output}->to_utf8($row->{title});
}
$self->{sql}->query(query => "SELECT staffid, username FROM swstaff");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$datas->{"staff_" . $row->{staffid}} = $self->{output}->to_utf8($row->{username});
}
$self->{sql}->query(query => "SELECT ticketstatusid, title FROM swticketstatus");
while ((my $row = $self->{sql}->fetchrow_hashref())) {
$datas->{"status_" . $row->{ticketstatusid}} = $self->{output}->to_utf8($row->{title});
}
$self->{statefile_cache}->write(data => $datas);
}
sub run {
my ($self, %options) = @_;
$self->{sql} = $options{sql};
$self->{sql}->connect();
my $has_cache_file = $self->{statefile_cache}->read(statefile => 'cache_sql_' . $self->{sql}->get_unique_id4save() . '_kayako');
my $timestamp_cache = $self->{statefile_cache}->get(name => 'last_timestamp');
if ($has_cache_file == 0 ||
!defined($timestamp_cache) || ((time() - $timestamp_cache) > (($self->{option_results}->{reload_cache_time}) * 60))) {
$self->reload_cache();
$self->{statefile_cache}->read();
}
my $query = "SELECT priorityid FROM swtickets WHERE ticketid IS NOT NULL";
if (defined($self->{option_results}->{'department_id'})) {
$query .= " AND departmentid IN (" . $self->{option_results}->{'department_id'} . ")";
}
if (defined($self->{option_results}->{'priority_id'})) {
$query .= " AND priorityid IN (" . $self->{option_results}->{'priority_id'} . ")";
}
if (defined($self->{option_results}->{'staff_id'})) {
$query .= " AND ownerstaffid IN (" . $self->{option_results}->{'staff_id'} . ")";
}
if (defined($self->{option_results}->{'status_id'})) {
$query .= " AND ticketstatusid IN (" . $self->{option_results}->{'status_id'} . ")";
}
if (defined($self->{option_results}->{'start_date'})) {
$query .= " AND lastactivity > " . $self->{option_results}->{'start_date'};
}
if (defined($self->{option_results}->{'end_date'})) {
$query .= " AND lastactivity < " . $self->{option_results}->{'end_date'};
}
$self->{sql}->query(query => $query);
while ((my $row = $self->{sql}->fetchrow_hashref())) {
if (defined($self->{option_results}->{priority_id})) {
foreach $priority_filter (@priority_filters) {
if ($priority_filter == $row->{priorityid}) {
$tickets{$priority_filter}++;
$ticket_total++;
}
}
} else {
$ticket_total++;
}
}
###########
# Manage Output
###########
my $exit = $self->{perfdata}->threshold_check(value => $ticket_total, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $staff = "";
my $ticket_status = "";
my $period = "";
if (defined($self->{option_results}->{staff_id}) && ($self->{option_results}->{staff_id} =~ m/^\d*$/)) {
$staff = " for staff '" . $self->{statefile_cache}->get(name => 'staff_'.$self->{option_results}->{'staff_id'}) ."'";
}
if (defined($self->{option_results}->{status_id}) && ($self->{option_results}->{status_id} =~ m/^\d*$/)) {
$ticket_status = " in status '" . $self->{statefile_cache}->get(name => 'status_'.$self->{option_results}->{'status_id'}) ."'";
}
if (defined($self->{option_results}->{start_date}) || defined($self->{option_results}->{end_date})){
$period = " -";
}
if (defined($self->{option_results}->{start_date})){
$start = " Start: " . $start;
}
if (defined($self->{option_results}->{end_date})){
$end = " End: " . $end;
}
if (defined($self->{option_results}->{priority_id})) {
foreach $priority_filter (@priority_filters) {
$label = $self->{statefile_cache}->get(name => 'priority_' . $priority_filter);
$self->{output}->perfdata_add(label => $label, value => $tickets{$priority_filter},
min => 0, max => $ticket_total);
}
}
$self->{output}->perfdata_add(label => 'Total', value => $ticket_total,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("%s tickets%s%s%s%s%s", $ticket_total, $staff, $ticket_status, $period, $start, $end));
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Count tickets of kayako
=over 8
=item B<--department-id>
Filter the tickets by the specified department id, you can specify multiple id's by separating the values using a comma. Example: 1,2,3 .
You must define at least one id. (required)
=item B<--priority-id>
Filter the tickets by the specified ticket priority id, you can specify multiple id's by separating the values using a comma. Example: 1,2,3 .
By default, all ticket priority are included.
=item B<--staff-id>
Filter the tickets by the specified owner staff id, you can specify multiple id's by separating the values using a comma. Example: 1,2,3 .
By default, all staff users are included.
=item B<--status-id>
Filter the tickets by the specified ticket status id, you can specify multiple id's by separating the values using a comma. Example: 1,2,3 .
By default, the filter is on unresolved ticket statuses.
=item B<--warning>
Threshold warning.
=item B<--critical>
Threshold critical.
=item B<--start-date>
Filter on last activity. For example: 21-03-2014
=item B<--end-date>
Filter on last activity. For example: 21-03-2014
=back
=cut

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::lmsensors::mode::fan;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::lmsensors::mode::misc;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::lmsensors::mode::temperature;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::lmsensors::mode::voltage;

View File

@ -1,37 +1,22 @@
###############################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Florian Asche <info@florian-asche.de>
#
####################################################################################
package apps::lmsensors::plugin;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon Bomm <sbomm@merethis.com>
#
####################################################################################
package apps::lotus::snmp::mode::mailstate;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon Bomm <sbomm@merethis.com>
#
####################################################################################
package apps::lotus::snmp::mode::mailtime;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon Bomm <sbomm@merethis.com>
#
####################################################################################
package apps::lotus::snmp::mode::serveravailability;

View File

@ -1,37 +1,22 @@
################################################################################
# Copyright 2005-2013 MERETHIS
# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
# 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
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
# http://www.apache.org/licenses/LICENSE-2.0
#
# As a special exception, the copyright holders of this program give MERETHIS
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of MERETHIS choice, provided that
# MERETHIS also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
# 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.
#
# For more information : contact@centreon.com
# Authors : Simon Bomm <sbomm@merethis.com>
#
####################################################################################
package apps::lotus::snmp::mode::servertransactions;

Some files were not shown because too many files have changed in this diff Show More