One plugin to rule them all (or not)

This post is also available in: French

This post is out-of-date, please visit the documentation website: http://documentation.centreon.com/docs/centreon-plugins/en/latest/

This post follows the previous post : https://blog.centreon.com/new-centreon-plugin-system/

“centreon-plugins” is made up of library and monitoring plugins. After 6 months of development, this new system is ready to be used in production. Nevertheless some plugins can be in WIP (“Work In Progress).
Please notice that “centreon-plugins” is open source and free (licence GPLv2).
A forge is available for open bugs and feature requests: https://forge.centreon.com/projects/centreon-plugins

Installation

The lastest version is available via the “git” client. The adress is
http://git.centreon.com/centreon-plugins.git
If you are using Windows, please use the “Checkout as-is” (“core.autocrlf input”) mode to not get returned Windows carriage return (“CRLF”). Otherwise, ‘help’ messages won’t be displayed.

For its use, Perl is required.
The code is architected as follows:

  • ‘centreon/': directory with libraries;
  • ‘example/': directory with some examples ;
  • ‘*/': directories with plugins (distributed by types to find its)
  • ‘centreon_plugins.pl': THE central script.

Why Perl?

Trolling time has come :)
“centreon-plugins” uses only Perl (To be accurate, there are some Perl bindings above C/C++ :) Moreover, commands/powershell are used by some plugins)
Perl reasons are:

  • Installed by default on many systems (Solaris, AIX, Linux, BSD,…). With Windows, ‘perl-strawberry’ and ‘activePerl’ can be used (plugins are also “compilables” into a single executable);
  • Very efficient for reading flow (the integration of regular expressions in the language is very powerful);
  • Large ecosystem of modules (‘SNMP’, ‘OpenIPMI’, ‘DBI’ (‘DBD’ pour Oracle, MySQL, Postgres, Informix,…), ‘Openswan’, ‘LWP’, ‘Net::Telnet’, …) ;
  • Stable : plugins are tested on Perl 5.8, 5.11 and 5.16 (This may be a cons :).

Procedure

As explained in the previous post, the user has to specify the “plugin” (option ‘- plugin’) and the supervision required for this plugin (option ‘–user). The plugin list is changing with time.
You can save the list by running the following command:

$ perl centreon_plugins.pl --list-plugin

Currently, there are 63 plugins like:
Cisco 3750, Switch Brocade, Linux, Matériel Sun, Imprimantes, Onduleurs, MySQL, ActiveDirectory, Apache,…

There are several plugin categories:

  • SNMP: network equipment, HP Hardware, … These plugins require Perl “SNMP” module;
  • DBI: database. These plugins need Perl “DBI” and “DBD” module;
  • WSMAN: This system is still experimental and requires Perl “Openwsman”> = 2.4;
  • WEB: Apache, Nginx, Tomcat,… These plugins need Perl “LWP” module;
  • LOCAL: Linux, AIX,… These plugins can be run locally on the system or remotely via ssh options (command ‘ssh’ or ‘plink’) without using ‘check_by_ssh':
  • OTHERS: Sun Hardware, EMC Clariion,… These plugins require miscellaneous dependencies (module Net :: Telnet or Navisphere client for example).

This is an example to run the Linux plugin locally or remotely:
$ perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=cpu --verbose
OK: CPUs usages are ok. | 'cpu0_user'=1.32%;;;0;100 'cpu0_nice'=0.04%;;;0;100 'cpu0_system'=0.25%;;;0;100 'cpu0_idle'=98.27%;;;0;100 'cpu0_wait'=0.00%;;;0;100 'cpu0_interrupt'=0.04%;;;0;100 'cpu0_softirq'=0.08%;;;0;100 'cpu0_steal'=0.00%;;;0;100
CPU '0' Usage: User 1.32 %, Nice 0.04 %, System 0.25 %, Idle 98.27 %, Wait 0.00 %, Interrupt 0.04 %, Soft Irq 0.08 %, Steal 0.00 %

$ perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=cpu --verbose --hostname=[xxx.xxx.xxx.xxx] --remote --ssh-command='plink' --ssh-option='-l=[user]' --ssh-option='-pw=[password]' --ssh-option='-batch'
OK: CPUs usages are ok. | 'cpu0_user'=0.16%;;;0;100 'cpu0_nice'=0.00%;;;0;100 'cpu0_system'=0.07%;;;0;100 'cpu0_idle'=99.72%;;;0;100 'cpu0_wait'=0.02%;;;0;100 'cpu0_interrupt'=0.01%;;;0;100 'cpu0_softirq'=0.01%;;;0;100 'cpu0_steal'=0.00%;;;0;100
CPU '0' Usage: User 0.16 %, Nice 0.00 %, System 0.07 %, Idle 99.72 %, Wait 0.02 %, Interrupt 0.01 %, Soft Irq 0.01 %, Steal 0.00 %

This is another example to run the SNMP plugin:
$ perl centreon_plugins.pl --plugin=os::linux::snmp::plugin --mode=tcpcon --hostname=[xxx.xxx.xxx.xxx] --snmp-community=public --snmp-version=2c
OK: Total connections: 2 | 'total'=2;;;0; 'con_closed'=0;;;0; 'con_closeWait'=0;;;0; 'con_synSent'=0;;;0; 'con_established'=2;;;0; 'con_timeWait'=0;;;0; 'con_lastAck'=0;;;0; 'con_listen'=6;;;0; 'con_synReceived'=0;;;0; 'con_finWait1'=0;;;0; 'con_finWait2'=0;;;0; 'con_closing'=0;;;0;

Evolutions

First, I thank the contributors / users (Florian Asche, Eric Coquard, Dominique Ritouret, Eric Baumont Simon Bomm, Duret Family, …) of the new plugin system.
All contributions are appreciated. For plugins contributions, a code review is done by myself.
The following changes are planned (soon):

  • New plugins: IBM HMC, Exchange 2010, Varnish, UPS MGE,…
  • Added options to use SSH Connector: use an API between SSH plugins and SSH connector (https://forge.centreon.com/issues/5487) ;
  • Added options to use VMWare VIX API connector: plugins “LOCAL” can use the API VIX to run commands on the target system.

These plugins are made ​​for the project “Plugins Pack” of Merethis.
Plugins Packs aim to industrialize the deployment and easy maintenance plugins of your monitoring platform Centreon Enterprise Server.
These plugins in the packaged version in RPM for Red Hat and CentOS includes documentation, host and service models and are supported by our teams.
These plugins are now used in 90% of new plugin-packs (CES 2.2/3.0 packages for the industrialization of deployment).
You want to try these pluginpacks or give us your feedbacks, contact us!

== updated 12/19/2014==

Leave a Reply