среда, 31 июля 2013 г.

xenserver 6.1 + smartmontools + mailx

Загружаем mailx

wget http://vault.centos.org/5.4/os/i386/CentOS/mailx-8.1.1-44.2.2.i386.rpm

HS4->/home/it3/distr# rpm -ihv mailx-8.1.1-44.2.2.i386.rpmPreparing...
########################################### [100%] 1:mailx ########################################### [100%]

У меня smartmontools установлен по умолчанию:
HS4->/home/it3/distr# rpm -qa | grep smartmontools
smartmontools-5.41-2.el5.xs1033#


Проверяем статус дисков:

smartctl -d ata -a /dev/sda

HS4->/home/it3/distr# smartctl -d ata -a /dev/sda
smartctl 5.41 2011-06-09 r3365 [i686-linux-2.6.32.43-0.4.1.xs1.6.10.734.170748xen] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Device Model:     ST2000DM001-1CH164
...
...


Правим конфиг файл

mcedit /etc/smartd.conf
# DEVICESCAN may be followed by any desired Directives.

/dev/sda -d ata -a -I 194 -W 4,35,45 -R 5 -s (S/../.././02|L/../../6/03) -t -m admins@tb22.ru -o on -S on
/dev/sdb -d ata -a -I 194 -W 4,35,45 -R 5 -s (S/../.././02|L/../../6/03) -t -m admins@tb22.ru -o on -S on

Проверяем и включаем автостарт smartd

HS4->/home/it3/distr# chkconfig --list | grep smartd
smartd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
HS4->/home/it3/distr# chkconfig smartd on
HS4->/home/it3/distr# chkconfig --list | grep smartd
smartd          0:off   1:off   2:on    3:on    4:on    5:on    6:off

Запускаем smartd и смотрим лог:


HS4->/home/it3/distr# service smartd start
Starting smartd:                                           [  OK  ]
HS4->/home/it3/distr# grep smartd /var/log/messages
Aug  1 13:26:49 HS4 smartd[12646]: smartd 5.41 2011-06-09 r3365 [i686-linux-2.6.32.43-0.4.1.xs1.6.10.734.170748xen] (local build)
...
...
...
has fork()ed into background mode. New PID=12648.


Правим конфиг ssmtp
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
root=postmaster
mailhub=mail.pixsoftware.de
rewriteDomain=pixsoftware.de
hostname=server32.pixsoftware.de



В том случае, если используется RAID-контроллер (в моем случае на двух серверах установлен Adaptec RAID 6405T), статус дисков проверяем следующей командой:

smartctl -d sat --all /dev/sgX

соответственно строки в /etc/smartd.conf будут следующие:
/dev/sg1 -d sat -a -I 194 -W 4,35,45 -R 5 -s (S/../.././02|L/../../6/03) -t -m admins@tb22.ru -o on -S on
/dev/sg2 -d sat -a -I 194 -W 4,35,45 -R 5 -s (S/../.././02|L/../../6/03) -t -m admins@tb22.ru -o on -S on


После этого идем в серверную и вырубаем кондиционер.
Через некоторое время в логах появляются следующие строки:

Aug  1 16:25:27 HS1 smartd[3154]: Monitoring 2 ATA and 0 SCSI devices
Aug  1 16:25:27 HS1 smartd[3154]: Device: /dev/sg1 [SAT], initial Temperature is 21 Celsius (Min/Max ??/21)
Aug  1 16:25:27 HS1 smartd[3154]: Device: /dev/sg2 [SAT], initial Temperature is 22 Celsius (Min/Max ??/22)
Aug  1 16:25:27 HS1 smartd[3156]: smartd has fork()ed into background mode. New PID=3156.
Aug  1 16:55:28 HS1 smartd[3156]: Device: /dev/sg1 [SAT], Temperature changed +5 Celsius to 26 Celsius (Min/Max 26!/26!)
Aug  1 16:55:28 HS1 smartd[3156]: Device: /dev/sg1 [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 79 to 74
Aug  1 16:55:28 HS1 smartd[3156]: Device: /dev/sg1 [SAT], SMART Usage Attribute: 195 Hardware_ECC_Recovered changed from 47 to 46
Aug  1 16:55:28 HS1 smartd[3156]: Device: /dev/sg2 [SAT], Temperature changed +4 Celsius to 26 Celsius (Min/Max 26!/26!)
Aug  1 16:55:28 HS1 smartd[3156]: Device: /dev/sg2 [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 78 to 74


Для проверки статуса дисков, подключенных к Adaptec RAID контроллеру можно также использовать следующие команты:
# /usr/StorMan/arcconf getconfig 1 | grep State
# /usr/StorMan/arcconf getconfig 1 | grep -B 3 State

Комментариев нет:

Отправить комментарий