Tag Archives: Nagios

Dell PowerEdge 2650 Perc 3/Di RAID monitoring Nagios

Проверяем какой RAID установлен на сервере

# lspci -v | grep RAID
04:08.1 RAID bus controller: Dell PowerEdge Expandable RAID Controller 3/Di (rev 01)

Мониторить Perc 3/Di будем с помощью afacli

A configuration utility for PERC2, PERC2/Si, PERC3/Si, and PERC3/Di controllers. 
This application allows you to perform storage management tasks on the above listed controllers,
attached disks, and containers by providing many commands.

Скачиваем aacraid-util-rh8.0-i386.tar.gz с сайта Dell
Распаковываем и устанавливаем

# tar xvf aacraid-util-rh8.0-i386.tar.gz
# rpm -ivh afaapps-2.7-2.i386.rpm

Информация о пакете

# rpm -qi afaapps
Name        : afaapps                       Relocations: (not relocatable)
Version     : 2.7                           Vendor: Adaptec, Inc.
Release     : 2                             Build Date: Wed Oct 23 16:55:16 2002
Install Date: Wed Sep 26 14:22:55 2012      Build Host: localhost.localdomain
Group       : Utilities/System              Source RPM: afaapps-2.7-2.src.rpm
Size        : 1246034                       License: 2000, Adaptec Inc.
Signature   : (none)
Packager    : DELL Linux Solutions Group
Summary     : DELL PowerEdge Raid Controller 2 (apps)
Description :
The afacli application consists of a command line interface (CLI)
that lets you perform storage management tasks related to
managing controllers, disks, containers, and enclosure devices
by providing a variety of commands.

Файлы которые входят в пакет

# rpm -ql afaapps
/dev/MAKEDEV.afa
/usr/sbin/afacli
/usr/sbin/afacli.bin
/usr/sbin/getcfg.afa

Работа с утилитой afacli

# afacli
--------------------------------------------------------------------------------------------------
DELL PowerEdge Expandable RAID Controller 2 Command Line Interface
Copyright 1998-2002 Adaptec, Inc. All rights reserved
--------------------------------------------------------------------------------------------------
FASTCMD>
FASTCMD> open afa0
Executing: open "afa0"

Посмотреть информации о контроллере

AFA0> controller details
Executing: controller details
Controller Information
----------------------
         Remote Computer: .
             Device Name: AFA0
         Controller Type: PERC 3/Di
             Access Mode: READ-WRITE
Controller Serial Number: Last Six Digits = C861D3
         Number of Buses: 2
         Devices per Bus: 15
          Controller CPU: i960 R series
    Controller CPU Speed: 100 Mhz
       Controller Memory: 128 Mbytes
           Battery State: Ok

Component Revisions
-------------------
                CLI: 2.7-1 (Build #4944)
                API: 2.7-1 (Build #4944)
    Miniport Driver: 1.1-5 (Build #24702)
Controller Software: 2.8-1 (Build #7692)
    Controller BIOS: 2.8-1 (Build #7692)
Controller Firmware: (Build #7692)

Изучаем состояние дисков

AFA0>  enclosure show slot
Executing: enclosure show slot

Enclosure
ID (B:ID:L) Slot scsiId Insert  Status
----------- ---- ------ ------- ------------------------------------------
 0  0:06:0   0   0:00:0     1   OK ACTIVATE
 0  0:06:0   1   0:01:0     1   OK ACTIVATE
 0  0:06:0   2   0:02:0     1   OK ACTIVATE
 0  0:06:0   3   0:03:0     1   OK ACTIVATE
 0  0:06:0   4   0:04:0     1   OK ACTIVATE

Посмотреть интересующую нас информацию

 enclosure show - Shows enclosure configuration information.
        enclosure show fan         - Displays the enclosure fan status.
        enclosure show power       - Displays the enclosure power supply status.
        enclosure show slot        - Displays the enclosure device slot status.
        enclosure show status      - Displays the enclosure general status.
        enclosure show temperature - Displays the enclosure temperature sensor status.

Закрываем консоль и выходим

AFA0> close
Executing: close
FASTCMD> exit

Добавим в Nagios проверку RAID при помощи nrpe и вот этого скрипта check_afacli

В этом скрипте обращаем внимание на следующие параметры

use lib "/usr/lib/nagios/plugins"; # если у вас 32 битная система;
# use lib "/usr/lib64/nagios/plugins"; # если у вас 64 битная система;
my $SUDO = '/usr/bin/sudo'; # путь к sudo
my $AFACLI = '/usr/sbin/afacli'; # путь к afacli
my $AFASCRIPT = '/etc/nagios/afascript';
my $AFALOG = '/tmp/afacli.log';

Что из себя представляет /etc/nagios/afascript. Это набор команд которое необходимо проделать скрипту

# vi /etc/nagios/afascript
logfile start '/tmp/afacli.log'
open afa0
controller details
container list /all /full
enclosure show slot
close
logfile end
exit

Сделаем файл исполняемым и перенесем в папку

/usr/lib/nagios/plugins для 32-битных систем
/usr/lib64/nagios/plugins"для 64-битных систем
# chmod +x check_afacli
# mv check_afacli /usr/lib/nagios/plugins

Проверим скрипт

# /usr/lib/nagios/plugins/check_afacli
OK: Battery:Ok 0:RAID-5:546GB:OK

Добавим на хост машине в /etc/nagios/nrpe.cfg

command[check_afacli]=/usr/lib/nagios/plugins/check_afacli

Перестартуем nrpe

# service nrpe restart
Shutting down Nagios NRPE daemon (nrpe):                   [  OK  ]
Starting Nagios NRPE daemon (nrpe):                        [  OK  ]

На сервере Nagios в /etc/nagios/hosts/TEST.cfg пропишем проверку сервиса

define service{
               use                           generic-service
               host_name                     TEST
               service_description           RAID
               is_volatile                   0
               check_period                  24x7
               max_check_attempts            3
               normal_check_interval         1
               retry_check_interval          1
               contact_groups                admins
               notification_interval         120
               notification_period           24x7
               notification_options          c,r
               check_command                 check_nrpe!check_afacli
}

Перестартуем Nagios

# service nagios reload
nagios (pid 26186 7947 7937) is running...
Reloading nagios:                                          [  OK  ]

Результат