Plugin LSI RAID Monitoring
Plugin LSI RAID Monitoring umożliwia monitoring macierzy RAID na kontrolerach firmy LSI. Plugin jest napisany w języku skryptowym Perl i używa narzędzia wiersza poleceń storcli do interakcji z kontrolerem RAID.
Ten artykuł pokazuje konfigurację pod Linuksem. Więcej informacji na temat konfiguracji w systemie Windows można znaleźć w artykule Konfiguracja pluginu do monitoringu macierzy RAID LSI w Windows Server 2012.
Wersja
Aktualną wersję pluginu check_lsi_raid można znaleźć na stronie GitHub:
Funkcje
W README tego pluginu znajduje się szczegółowa lista komponentów, które mogą być monitorowane:
- README Pluginu w wersji 2.3 (github.com)
Wymagania
Wymagania wstępne są opisane szczegółowo w następnym rozdziale:
- Na monitorowanym serwerze
- Na serwerze Icingar
- definicja komendy
- definicja serwisu
- W przypadku korzystania z serwisu Call-Home
- Dostępne szablony (Serwis Call-Home z oprogramowaniem Icinga lub Nagios)
Instalacja
Manualna
Podczas manualnej instalacji plik pluginu jest kopiowany do katalogu /usr/lib/nagios/plugins
.
:~$ git clone https://github.com/thomas-krenn/check_lsi_raid.git Cloning into 'check_lsi_raid'... :~$ cd check_lsi_raid/ :~/check_lsi_raid$ ls changelog check_lsi_raid README :~/check_lsi_raid$ sudo cp check_lsi_raid /usr/lib/nagios/plugins/
Narzędzie LSI Storage Command Line Tool (StorCLI) można pobrać dla danego produktu i systemu operacyjnego ze strony internetowej LSI: http://www.lsi.com/Search/Pages/downloads.aspx?k=Latest%20StorCLI
Repozytorium TK Ubuntu
Po dodaniu repozytorium Thomas-Krenn (vide Repozytorium Ubuntu firmy Thomas Krenn) plugin check_lsi_plugin znajduje się w pakiecie nagios-plugins-thomas-krenn:
:~$ sudo apt-get install nagios-plugins-thomas-krenn [...] Suggested packages: arcconf storcli freeipmi-tools libipc-run-perl The following NEW packages will be installed: nagios-plugins-thomas-krenn 0 upgraded, 1 newly installed, 0 to remove and 79 not upgraded. Need to get 0 B/25.2 kB of archives. After this operation, 127 kB of additional disk space will be used. Selecting previously unselected package nagios-plugins-thomas-krenn. (Reading database ... 68398 files and directories currently installed.) Unpacking nagios-plugins-thomas-krenn (from .../nagios-plugins-thomas-krenn_0.3-1_all.deb) ... Setting up nagios-plugins-thomas-krenn (0.3-1) ...
Proponowane pakiety storcli, libfile-which-perl
należy również zainstalować:
:~$ sudo apt-get install storcli libfile-which-perl [...] The following NEW packages will be installed: storcli libfile-which-perl [...]
Konfiguracja
Plugin nadaje się do monitorowania zdalnego serwera poprzez NRPE, jak i również lokalnego hosta. W każdym przypadku plugin check_lsi_raid musi być zainstalowany na monitorowanym systemie.
Przez NRPE
Na serwerze Icinga
Podczas tworzenia definicji hosta jest definiowane polecenie, które jest wykonywane przez NRPE. Parametry same w sobie są określone na hoście, który ma być monitorowany.
define service { service_description lsi-raid-nrpe display_name LSI RAID use generic-service host_name test check_command check_nrpe_1arg!check_lsi_raid }
Uwaga: Jeżeli ma być wykorzystywany serwis Call-Home to należy utworzyć szablony (templates) w oparciu o artykuł Serwis Call-Home z oprogramowaniem Icinga lub Nagios. Następnie przy Service należy wprowadzić use thomas-krenn-service
, zamiast use generic-service
.
Na serwerze Icinga 2
Konfiguracja pluginu LSI RAID przez NRPE na hoście Icinga 2 odbywa się w następujący sposób.
Definicja komendy Utwórz nowy plik o nazwie lsi-nrpe.conf z następującą zawartością w podkatalogu commands katalogu konfiguracyjnego Icinga 2, dla Ubuntu /etc/icinga2/conf.d.
object CheckCommand "nrpe-lsi" { import "plugin-check-command" command = [PluginContribDir + "/check_nrpe" ] arguments = { "-H" = "$address$" "-c" = "$nrpe_lsi$" } }
Definicja reguły Apply Service
Tak zwane Apply Rule jest teraz tworzone w katalogu konfiguracyjnym Icinga 2, w ten sposób na hoście z odpowiednio skonfigurowanym parametrem jest ten check automatycznie wykonywany. W katalogu konfiguracyjnym Icinga 2 należy utworzyć folder services i następnie nowy plik o nazwie "lsi-raid.conf".
Ten nowy plik konfiguracyjny zawiera następujące polecenia:
apply Service "check-nrpe-lsi" { import "generic-service" check_command = "nrpe-lsi" assign where host.vars.nrpe_lsi }
assign where host.vars.nrpe_lsi oznacza, że w przypadku, gdy monitowany host posiada parametr vars.nrpe_lsi z parametrem NRPE to service check "check-nrpe-lsi" jest automatycznie wykonywany przez NRPE na tym serwerze.
Definicja hosta W konfiguracji hosta należy dodać wiersz vars.nrpe_lsi.
object Host "Testserver" { import "generic-host" address = "<IP-Adresse>" vars.nrpe_lsi = "check_lsi_raid" }
TKmon
Plugin LSI-Raid-Plugin jest już zintegrowany w katalogu usług kontrolnych TKmon. Podczas dodawania nowej usługi wystarczy wybrać check "LSI RAID via NRPE":
Na monitorowanym serwerze
Poniższa konfiguracja sudoers musi zostać zdefiniowana, żeby użytkownik "nagios" mógł korzystać z narzędzia wiersza poleceń z sudo bez wprowadzania hasła:
Uwaga: W CentOS deamon NRPE funkcjonuje pod użytkownikiem nrpe! Dlatego w CentOS, w konfiguracji sudo zamiast nagios musi być wprowadzone nrpe.
:~$ sudo vi /etc/sudoers.d/check_lsi_raid nagios ALL=(root)NOPASSWD:/usr/sbin/storcli :~$ sudo chmod 440 /etc/sudoers.d/check_lsi_raid
W następującym teście nie powinno być wymagane podanie hasła:
:~$ sudo su nagios --shell /bin/bash :~$ sudo /usr/sbin/storcli -V Storage Command Line Tool Ver 1.03.11 Jan 30, 2013 (c)Copyright 2012, LSI Corporation, All Rights Reserved. Exit Code: 0x00
Plik konfiguracyjny NRPE określa, który check jest wykonywany, po wywołaniu polecenia "check_lsi_raid". Polecenie to musi być takie samo jak parametr po stronie serwera Icinga w definicji hosta.
Uwaga: W CentOS pomocne może być podanie interpretera dla wtyczki, np. perl /usr/lib/nagios/plugins/check_lsi_raid -C 0 -p /usr/sbin/storcli
.
:~$ sudo vi /etc/nagios/nrpe.d/raid.cfg command[check_lsi_raid]=/usr/lib/nagios/plugins/check_lsi_raid -C 0 -p /usr/sbin/storcli
:~$ sudo service nagios-nrpe-server restart
Po stronie serwera Icinga może zostać przetestowane, czy check funkcjonuje:
:~$ /usr/lib/nagios/plugins/check_nrpe -H 10.0.0.2 -c check_lsi_raid OK (CTR, LD, PD, CV)|CV_Temperature=27;70;85 ROC_Temperature=62;80;90
Lokalnie
Konfiguracja lokalna jest przydatna, jeśli serwer Icinga lub Icinga 2 ma zainstalowany kontroler RAID LSI i dlatego musi być monitorowany. Opisane powyżej kroki, mające na celu zainstalowanie wtyczki storcli i konfiguracji sudo dla użytkownika nagios, są warunkami wstępnymi dla instalacji lokalnej.
Icinga
Lokalna konfiguracja wtyczki LSI RAID Monitoring Plugin w Icinga odbywa się w przedstawiony poniżej sposób.
Pierwszym krokiem jest stworzenie definicji polecenia Icinga:
:~$ sudo vi /etc/nagios-plugins/config/check_lsi_raid.cfg define command { command_name check_lsi_raid command_line /usr/lib/nagios/plugins/check_lsi_raid -C '$ARG1$' -p '$ARG2$' }
Definicja usługi może następnie użyć tego polecenia:
define service{ use generic-service host_name tkmon service_description lsi-raid check_command check_lsi_raid!0!/usr/sbin/storcli }
Icinga 2
Lokalna konfiguracja w Icinga 2 przebiega w poniżej przedstawiony sposób.
Definicja komendy Np. w podkatalogu commands folderu konfiguracyjnego Icinga 2, w Ubuntu /etc/icinga2/conf.d, należy zapisać plik o nazwie lsi-raid.conf z następującą zawartością.
object CheckCommand "lsi-raid" { import "plugin-check-command" command = [ PluginDir + "/check_lsi_raid" ] arguments = { "-C" = { required = true value = "$lsi_controller_number$" description = "The controller number to be checked." } "-p" = "/usr/sbin/storcli" } }
Definicja reguły Apply Service
Tak zwane Apply Rule jest teraz tworzone w katalogu konfiguracyjnym Icinga 2, w ten sposób na hoście z odpowiednio skonfigurowanym parametrem jest ten check automatycznie wykonywany. W katalogu konfiguracyjnym Icinga 2 należy utworzyć folder services i następnie nowy plik o nazwie "lsi-raid.conf".
Ten nowy plik konfiguracyjny zawiera następujące polecenia:
apply Service "check-lsi-raid" { import "generic-service" check_command = "lsi-raid" assign where host.vars.lsi_controller_number }
assign where host.vars.lsi_controller_number oznacza, że w przypadku, gdy monitowany host posiada parametr vars.lsi_controller_number z obowiązującym identyfikatorem "'LSI Controller ID to check "check-lsi-raid" jest automatycznie wykonywane lokalnie na serwerze.
Definicja hosta W pliku konfiguracyjnym hosta hosts.conf lokalnego serwera Icinga 2 należy dodać wiersz vars.lsi_controller_number.
object Host NodeName { [...] vars.lsi_controller_number = "LSI Controller ID" }
Przykładowe dane wyjściowe z pluginu
$ sudo ./check_lsi_raid -p /opt/MegaRAID/storcli/storcli64 -vvv Critical (CTR Warn, LD Crit, PD Warn) [c0/v0_State = Critical (Dgrd)][c0/e252/s2_State = Critical (Rbld)][CTR_Degraded_drives = Warning (1)] [c0/e252/s2_Rebuild = Warning (4)]|CV_Temperature=24;70;85 ROC_Temperature=58;80;90 Used storcli commands: - /usr/bin/sudo /opt/MegaRAID/storcli/storcli64 /c0 /cv show status - /usr/bin/sudo /opt/MegaRAID/storcli/storcli64 adpallinfo a0 - /usr/bin/sudo /opt/MegaRAID/storcli/storcli64 /c0/vall show all - /usr/bin/sudo /opt/MegaRAID/storcli/storcli64 /c0/vall show init - /usr/bin/sudo /opt/MegaRAID/storcli/storcli64 /c0/eall/sall show all - /usr/bin/sudo /opt/MegaRAID/storcli/storcli64 /c0/eall/sall show initialization - /usr/bin/sudo /opt/MegaRAID/storcli/storcli64 /c0/eall/sall show rebuild Critical sensors: - c0/v0_State (Dgrd) - c0/e252/s2_State (Rbld) Warning sensors: - CTR_Degraded_drives (1) - c0/e252/s2_Rebuild (4) CTR information: - LSI MegaRAID SAS 9271-4i: - Serial No=SV30900638 - FW Package Build=23.28.0-0010 - Mfg. Date=02/23/13 - Revision No=07B - BIOS Version=5.46.02.0_4.16.08.00_0x06060900 - FW Version=3.400.05-3175 - ROC temperature=58 degree Celcius LD information: - c0/v0: - Access=RW - Cache=RWBD - Consist=Yes - DG/VD=0/0 - Size=74.0 - State=Dgrd - TYPE=RAID1 - ld=c0/v0 - sCC=- PD information: - c0/e252/s1: - BBM Error Count=0 - DG=- - DID=6 - Drive Temperature=N/A - EID:Slt=252:1 - Intf=SATA - Med=SSD - Media Error Count=0 - Model=INTEL SSDSC2BB080G4 - Other Error Count=0 - PI=N - Predictive Failure Count=0 - S.M.A.R.T alert flagged by drive=No - SED=N - SeSz=512B - Shield Counter=0 - Size=74.0GB - Sp=U - State=UGood - pd=c0/e252/s1 - c0/e252/s2: - BBM Error Count=0 - DG=0 - DID=5 - Drive Temperature=0C (32.00 F) - EID:Slt=252:2 - Intf=SATA - Med=SSD - Media Error Count=0 - Model=INTEL SSDSC2BB080G4 - Other Error Count=0 - PI=N - Predictive Failure Count=0 - S.M.A.R.T alert flagged by drive=No - SED=N - SeSz=512B - Shield Counter=0 - Size=74.0GB - Sp=U - State=Rbld - pd=c0/e252/s2 - rebuild=4 - c0/e252/s3: - BBM Error Count=0 - DG=0 - DID=4 - Drive Temperature=N/A - EID:Slt=252:3 - Intf=SATA - Med=SSD - Media Error Count=0 - Model=INTEL SSDSC2BB080G4 - Other Error Count=0 - PI=N - Predictive Failure Count=0 - S.M.A.R.T alert flagged by drive=No - SED=N - SeSz=512B - Shield Counter=0 - Size=74.0GB - Sp=U - State=Onln - pd=c0/e252/s3 CV information: - CV_Replacement_required=No - CV_Status=OK - CV_Temperature=24
Tekst pomocy
$ ./check_lsi_raid --help check_lsi_raid: Nagios/Icinga plugin to check LSI Raid Controller status Pulgin version: 2.3 Copyright (C) 2013-2015 Thomas-Krenn.AG Current updates available at https://github.com/thomas-krenn/check_lsi_raid.git This Nagios/Icinga Plugin checks LSI RAID controllers for controller, physical device, logical device, BBU and CV warnings and errors. In order for this plugin to work properly you need to add the nagios user to your sudoers file (or create a new one in /etc/sudoers.d/). Usage: [ -h | --help ] Display this help page [ -v | -vv | -vvv | --verbose ] Sets the verbosity level. No -v is the normal single line output for Nagios/Icinga, -v is a more detailed version but still usable in Nagios. -vv is a multiline output for debugging configuration errors or more detailed information. -vvv is for plugin problem diagnosis. For further information please visit: http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN39 [ -V --version ] Displays the plugin and, if available, the version of StorCLI. [ -C <num> | --controller <num> ] Specifies a controller number, defaults to 0. [ -EID <ids> | --enclosure <ids> ] Specifies one or more enclosure numbers, per default all enclosures. Takes either an integer as additional argument or a commaseperated list, e.g. '0,1,2'. With --noenclosures enclosures can be disabled. [ -LD <ids> | --logicaldevice <ids>] Specifies one or more logical devices, defaults to all. Takes either an integer as additional argument or a comma seperated list e.g. '0,1,2'. [ -PD <ids> | --physicaldevice <ids> ] Specifies one or more physical devices, defaults to all. Takes either an integer as additional argument or a comma seperated list e.g. '0,1,2'. [ -Tw <temp> | --temperature-warn <temp> ] Specifies the RAID controller temperature warning threshold, the default threshold is 80C. [ -Tc <temp> | --temperature-critical <temp> ] Specifies the RAID controller temperature critical threshold, the default threshold is 90C. [ -PDTw <temp> | --physicaldevicetemperature-warn <temp> ] Specifies the disk temperature warning threshold, the default threshold is 40C. [ -PDTc <temp> | --physicaldevicetemperature-critical <temp> ] Specifies the disk temperature critical threshold, the default threshold is 45C. [ -BBUTw <temp> | --bbutemperature-warning <temp> ] Specifies the BBU temperature warning threshold, default threshold is 50C. [ -BBUTc <temp> | --bbutemperature-critical <temp> ] Specifies the BBU temperature critical threshold, default threshold is 60C. [ -CVTw <temp> | --cvtemperature-warning <temp> ] Specifies the CV temperature warning threshold, default threshold is 70C. [ -CVTc <temp> | --cvtemperature-critical <temp> ] Specifies the CV temperature critical threshold, default threshold is 85C. [ -Im <count> | --ignore-media-errors <count> ] Specifies the warning threshold for media errors per disk, the default threshold is 0. [ -Io <count> | --ignore-other-errors <count> ] Specifies the warning threshold for media errors per disk, the default threshold is 0. [ -Ip <count> | --ignore-predictive-fail-count <count> ] Specifies the warning threshold for media errors per disk, the default threshold is 0. [ -Is <count> | --ignore-shield-counter <count> ] Specifies the warning threshold for media errors per disk, the default threshold is 0. [ -Ib <count> | --ignore-bbm-counter <count> ] Specifies the warning threshold for bbm errors per disk, the default threshold is 0. [ -p <path> | --path <path>] Specifies the path to StorCLI, per default uses the tool 'which' to get the StorCLI path. [ -b <0/1> | --BBU <0/1> ] Check if a BBU or a CacheVault module is present. One must be present unless '-b 0' is defined. This ensures that for a given controller a BBU/CV must be present per default. [ --noenclosures <0/1> ] Specifies if enclosures are present or not. 0 means enclosures are present (default), 1 states no enclosures are used (no 'eall' in storcli commands). [ --nosudo ] Turn off using sudo. [ --nocleanlogs ] Do not clean storcli logs after running storcli commands. Further information about this plugin can be found at: http://www.thomas-krenn.com/de/wiki/LSI_RAID_Monitoring_Plugin and http://www.thomas-krenn.com/de/wiki/LSI_RAID_Monitoring_Plugin if you have questions regarding use of this software, to submit patches, or suggest improvements. Example usage: * check_lsi_raid -p /opt/MegaRAID/storcli/storcli64 * check_lsi_raid -p /opt/MegaRAID/storcli/storcli64 -C 1
Autor: Georg Schönberger