===== Установка Centreon Plugins на Debian Linux ===== {{:icinga:pasted:20200310-153527.png }} Плагины **Centreon Plugins** не имеют собственной пакетной базы для **Debian**, поэтому получить содержимое интересующих нас скриптов мониторинга можно с помощью клонирования из репозитория **github** \\ ==== Установка ==== Создадим на сервере мониторинга, например на сервере **Icinga**, отдельный каталог и с помощью утилиты git склонируем в этот каталог плагины **centreon-plugins**:
# apt-get install git -y
# mkdir /usr/lib/nagios/plugins/centreon-plugins
# cd /usr/lib/nagios/plugins/centreon-plugins/
# git clone --depth=1 https://github.com/centreon/centreon-plugins.git
Установим библиотеки Perl, необходимые для работы плагинов:
# apt-get install perl \
libsnmp-perl libxml-libxml-perl libjson-perl libwww-perl \ 
libxml-xpath-perl libnet-telnet-perl libnet-ntp-perl libnet-dns-perl \ 
libdbi-perl libdbd-mysql-perl libdbd-pg-perl -y
\\ ==== Получение встроенной справки ==== Получим полный список плагинов, входящих в комплект **Centreon Plugins**:
# ./centreon_plugins.pl --list-plugin
Получим список плагинов, например, относящихся только к оборудованию **APC**:
# ./centreon_plugins.pl --list-plugin | grep -i apc | grep 'PLUGIN'

PLUGIN: apps::apcupsd::local::plugin PLUGIN: apps::backup::netapp::snapcenter::restapi::plugin PLUGIN: apps::php::apc::web::plugin PLUGIN: hardware::ats::apc::snmp::plugin PLUGIN: hardware::pdu::apc::snmp::plugin PLUGIN: hardware::ups::apc::snmp::plugin
Получим справку по конкретному плагину, например **hardware::ats::apc::snmp::plugin**:
# ./centreon_plugins.pl --plugin=hardware::ats::apc::snmp::plugin --help

Plugin Description: Check APC ATS in SNMP. Global Options: --mode Choose a mode. --dyn-mode Specify a mode with the path (separated by '::'). --list-mode List available modes. --mode-version Check minimal version of mode. If not, unknown error. --version Display plugin version. --pass-manager Use a password manager.
Получим перечень режимов работы конкретного плагина
# ./centreon_plugins.pl --plugin=hardware::ats::apc::snmp::plugin --list-mode


... Modes Meta: multi Modes Available: device-status input-lines output-lines
Получим справку по конкретному режиму плагина, например **device-status**:
# ./centreon_plugins.pl --plugin=hardware::ats::apc::snmp::plugin --mode=device-status --help



Plugin Description: Check APC ATS in SNMP. Global Options: --mode Choose a mode. ... Output Options: --verbose Display long output. ... Snmp Options: --hostname Hostname to query (required). ... Mode: Check device status. --component Which component to check (Default: '.*'). Can be: 'entity'. --filter Exclude some parts (comma seperated list) (Example: --filter=entity) Can also exclude specific instance: --filter=entity,CommStatus --no-component Return an error if no compenents are checked. If total (with skipped) is 0. (Default: 'critical' returns). --threshold-overload Set to overload default threshold values (syntax: section,[instance,]status,regexp) It used before default thresholds (order stays). Example: --threshold-overload='entity,SourceBStatus,WARNING,fail'
\\ ==== Пример использования ==== Рассмотрим пример использования конкретного плагина **hardware::ats::apc::snmp::plugin** с режимом работы **device-status**.
# ./centreon_plugins.pl --plugin=hardware::ats::apc::snmp::plugin \ 
--mode=device-status --no-component \ 
--hostname='ATS01' --snmp-version='1' --snmp-community='public' --verbose

CRITICAL: Entity 'PhaseSyncStatus' status is 'outOfSync' | 'count_entity'=14;;;; Checking entities entity '24VPowerSupply' status is 'atsPowerSupplyOK' [instance = 24VPowerSupply] entity '24VSourceBPowerSupply' status is 'atsPowerSupplyOK' [instance = 24VSourceB...] entity '5VPowerSupply' status is 'n/a' [instance = 5VPowerSupply] entity 'CommStatus' status is 'atsCommEstablished' [instance = CommStatus] entity 'HardwareStatus' status is 'ok' [instance = HardwareStatus] entity 'Minus12VPowerSupply' status is 'n/a' [instance = Minus12VPowerSupply] entity 'OverCurrentState' status is 'atsCurrentOK' [instance = OverCurrentState] entity 'PhaseSyncStatus' status is 'outOfSync' [instance = PhaseSyncStatus] entity 'Plus12VPowerSupply' status is 'n/a' [instance = Plus12VPowerSupply] entity 'RedundancyState' status is 'atsFullyRedundant' [instance = RedundancyState] entity 'SourceAStatus' status is 'ok' [instance = SourceAStatus] entity 'SourceBStatus' status is 'ok' [instance = SourceBStatus] entity 'SwitchStatus' status is 'ok' [instance = SwitchStatus] entity 'VoltageOutStatus' status is 'ok' [instance = VoltageOutStatus]
В выводе плагина можно отфильтровать (указать конкретные счётчики) или вовсе отключить (указать фейковый несуществующий счётчик) perfdata:
# ./centreon_plugins.pl --plugin=hardware::ats::apc::snmp::plugin --mode=device-status \
--hostname='ATS01' --snmp-version='1' --snmp-community='public' \
--no-component --filter-perfdata='dummy'

CRITICAL: Entity 'PhaseSyncStatus' status is 'outOfSync' - Entity 'RedundancyState' status is 'atsRedundancyLost' - Entity 'SourceAStatus' status is 'fail' - Entity 'SwitchStatus' status is 'fail' |
\\ ==== Обновление ==== Обновление плагина выполняем так же как и установку, с помощью **git**:
# cd /usr/lib/nagios/plugins/centreon-plugins/
# git fetch
# git checkout origin/master
---- Проверено на следующих конфигурациях: ^ Версия ОС ^ Версия Centreon Plugins ^ | Debian 9 | 20191016 | | Debian 10 | 20201008 | ---- {{:user:blogroot.png?50&nolink |}} Автор первичной редакции:\\ [[user:blogroot|Алексей Максимов]] \\ Время публикации: 08.01.2020 14:59 {{tag>Monitoring "Centreon Plugins" Icinga Nagios Plugin Debian}} ~~DISCUSSION~~