Подсистема контроля UPS

Ключ
Эта строка удалена.
Это слово было удалено. Это слово было добавлено.
Эта строка добавлена.

Изменения (23)

просмотр истории страницы
{toc}

h2. Подсистема контроля UPS

{code}
Где 10.0.0.1 - ip адрес, по которому доступен ups.
По совместимости Вашего ИБП с драйвером можете обратиться к документации драйвера [http://networkupstools.org/docs/man/snmp-ups.html]

В некоторых случаях при настройке подключения через COM порт достаточно параметров.
driver = serial
desc = "Back-UPS ES 700"
port = /dev/ttyS0
{code}
3. Устанавливаем IP и порт, на котором демон, будет принимать данные о состоянии UPS;
LISTEN 127.0.0.1 3493{code}
4. Добавляем пользователя, от имени которого будет производится мониторинг и отправка команд в систему;
{code}useradd <имя_пользователя> upsuser
passwd <имя пользователя>
запоминаем/записываем и вводм password{code}
passwd password{code}
5. Добавляем созданного пользователя в настройки;
{warning}Если в пароле используются спецсимволы, например \!#%^& - в о всех конфигурационных файлах пароль следует заключать в кавычки:
{code}password = 'my!#%password'{code}{warning}

{code}vim /etc/ups/upsd.users
— добавляем строки
[<имя_пользователя>] [upsuser]
password = <ваш_пароль> password
actions = SET
instcmds = ALL
{code:lang=actionscript}vim /etc/ups/upsmon.conf
— добавляем строки
MONITOR <имя_UPS>@localhost 1 <имя_пользователя> <ваш_пароль> master
MONITOR apces700@localhost 1 upsuser password master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
8. Проверяем возможности UPS;

{code}upscmd -l <имя_UPS>@localhost{code} apces700@localhost{code}


powerout)
logger "UPS on battery. Shutdown in 90 seconds...."
upscmd -u <имя_пользователя> upsuser -p <ваш_пароль> <имя_UPS>@localhost password apces700@localhost shutdown.return
;;
shutdownnow)
powerup)
logger "UPS on line. Shutdown aborted."
upscmd -u <имя пользователя> -p <ваш пароль> <имя_UPS>@localhost shutdown.stop
upscmd -u upsuser -p password apces700@localhost shutdown.stop
;;
*)
{code}chkconfig --level 35 ups on{code}
12. Проверяем состояние UPS.
{code}upsc <имя_UPS>@localhost{code} apces700@localhost{code}

*13. Запускаем скрипт проверки UPS*
check_ups_status.sh
{code}

h3. Заметки


h2. Проверка подсистемы

Пр окончанию настройки требуется выполнить итоговую проверку работоспособности схемы:
# Выполните остановку биллинга во избежание потери данных
[http://www.ignix.ru/book/freebsd/daemon/network_ups_tools]


[http://redhat-club.org/2011/настройка-nut-2.4.3-с-ups-eaton-env-в-rhel-centos-6|http://redhat-club.org/2011/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-nut-2.4.3-%D1%81-ups-eaton-env-%D0%B2-rhel-centos-6]


[http://andy.od.ua/news_46.html]


[http://sysadminblog.sagrer.ru/stati-i-gajdy/linux/18-nastrojka-besperebojnika-na-primere-ippon-smart-powerpro-1000-v-linux.html]


h2. Дополнительная информация

/usr/share/doc/nut-2.6.5/docs/cables
/usr/share/doc/nut-2.6.5/docs/images/cables

h3. Подбор параметров для драйвера

Чтобы подобрать правильные параметры, можно попробовать запустить драйвер без запуска NUT.
# Укажите параметры запуска драйвера в файле */etc/ups/ups.conf* по статье выше
# Посмотрите возможные дополнительные опции в справке драйвера. например:
{code}/sbin/blazer_usb -h{code}
Вывод:
{code}Network UPS Tools - Megatec/Q1 protocol USB driver 0.09 (2.6.5)

usage: blazer_usb -a <id> [OPTIONS]
-a <id> - autoconfig using ups.conf section <id>
- note: -x after -a overrides ups.conf settings

-V - print version, then exit
-L - print parseable list of driver variables
-D - raise debugging level
-q - raise log level threshold
-h - display this help
-k - force shutdown
-i <int> - poll interval
-r <dir> - chroot to <dir>
-u <user> - switch to <user> (if started as root)
-x <var>=<val> - set driver variable <var> to <val>
- example: -x cable=940-0095B

Acceptable values for -x or ups.conf in this driver:

Serial-over-USB subdriver selection : -x subdriver=<value>
Regular expression to match UPS Manufacturer numerical ID (4 digits hexadecimal) : -x vendorid=<value>
Regular expression to match UPS Product numerical ID (4 digits hexadecimal) : -x productid=<value>
Regular expression to match UPS Manufacturer string : -x vendor=<value>
Regular expression to match UPS Product string : -x product=<value>
Regular expression to match UPS Serial number : -x serial=<value>
Regular expression to match USB bus name : -x bus=<value>
Apply the language ID workaround to the krauler subdriver (0x409 or 0x4095) : -x langid_fix=<value>
Delay before UPS startup (minutes) : -x ondelay=<value>
Delay before UPS shutdown (seconds) : -x offdelay=<value>
Parameters used for runtime calculation : -x runtimecal=<value>
Nominal charge time for UPS battery : -x chargetime=<value>
Minimum load to be used for runtime calculation : -x idleload=<value>
Skip reading rating information from UPS : -x norating
Skip reading vendor information from UPS : -x novendor
Preselect communication protocol (skip autodetection) : -x protocol
Read The Fine Manual ('man 8 blazer'){code}
# Запустите драйвер указав название UPS из */etc/ups/ups.conf* и включив повышенное логирование:
{code}/sbin/blazer_usb -a myups -DDDDDDDDDD -q{code}
Ниже представлен вывод в котором видно что UPS определился, драйвер отправил у нему команду, но в получил некорректный ответ по возможным протоколам:
{code}Network UPS Tools - Megatec/Q1 protocol USB driver 0.09 (2.6.5)
0.000000 debug level is '10'
0.000531 Checking device (03F0/7029) (006/002)
0.000559 - VendorID: 03f0
0.000564 - ProductID: 7029
0.000567 - Manufacturer: unknown
0.000571 - Product: unknown
0.000574 - Serial Number: unknown
0.000578 - Bus: 006
0.000581 Trying to match device
0.000604 Device does not match - skipping
0.000611 Checking device (1D6B/0001) (006/001)
0.000623 - VendorID: 1d6b
0.000627 - ProductID: 0001
0.000631 - Manufacturer: unknown
0.000634 - Product: unknown
0.000638 - Serial Number: unknown
0.000641 - Bus: 006
0.000645 Trying to match device
0.000649 Device does not match - skipping
0.000654 Checking device (06DA/FFFF) (005/094)
0.013669 - VendorID: 06da
0.013687 - ProductID: ffff
0.013694 - Manufacturer: PPC
0.013701 - Product: HID UPS
0.013711 - Serial Number: BKX2BBH00482
0.013719 - Bus: 005
0.013725 Trying to match device
0.013783 Device matches
0.013806 failed to claim USB device: could not claim interface 0: Device or resource busy
0.014461 detached kernel driver from USB device...
0.014672 send_to_all: SETINFO ups.vendorid "06da"
0.014685 send_to_all: SETINFO ups.productid "ffff"
0.014699 send_to_all: SETINFO device.type "ups"
0.014710 send_to_all: SETINFO driver.version "2.6.5"
0.014719 send_to_all: SETINFO driver.version.internal "0.09"
0.014731 send_to_all: SETINFO driver.name "blazer_usb"
0.014739 Trying megatec protocol...
0.015812 send: Q1
1.017703 read: Connection timed out
1.017729 blazer_status: short reply
1.017736 Status read 1 failed
1.019690 send: Q1
2.021680 read: Connection timed out
2.021711 blazer_status: short reply
2.021720 Status read 2 failed
2.023667 send: Q1
3.025677 read: Connection timed out
3.025706 blazer_status: short reply
3.025715 Status read 3 failed
3.025722 Trying mustek protocol...
3.027667 send: QS
4.029707 read: Connection timed out
4.029727 blazer_status: short reply
4.029733 Status read 1 failed
4.031687 send: QS
5.033673 read: Connection timed out
5.033700 blazer_status: short reply
5.033706 Status read 2 failed
5.035721 send: QS
6.037674 read: Connection timed out
6.037697 blazer_status: short reply
6.037703 Status read 3 failed
6.037708 Trying megatec/old protocol...
6.039662 send: D
7.041704 read: Connection timed out
7.041734 blazer_status: short reply
7.041743 Status read 1 failed
7.043672 send: D
8.045670 read: Connection timed out
8.045693 blazer_status: short reply
8.045700 Status read 2 failed
8.047666 send: D
9.049676 read: Connection timed out
9.049703 blazer_status: short reply
9.049709 Status read 3 failed
9.049714 Trying zinto protocol...
9.051703 send: Q1
10.053674 read: Connection timed out
10.053699 blazer_status: short reply
10.053705 Status read 1 failed
10.055728 send: Q1
11.057670 read: Connection timed out
11.057692 blazer_status: short reply
11.057698 Status read 2 failed
11.059667 send: Q1
12.061677 read: Connection timed out
12.061701 blazer_status: short reply
12.061707 Status read 3 failed
12.061712 No supported UPS detected
{code}
# Попробуйте изменить данные в конфигурационном файле и повторить операцию. Если Вам удастся найти подходящий драйвер и параметры, UPS настроить возможно.

h3. UPS INELT

Устройства INELT ранее интегрировались с драйвером megatec, в текущей версии NUT - с драйвером blazer_ser:
{code}cat /usr/share/driver.list \| grep \-i inelt
"INELT"&nbsp;&nbsp; &nbsp;"ups"&nbsp;&nbsp; &nbsp;"2"&nbsp;&nbsp; &nbsp;"Monolith 1000LT"&nbsp;&nbsp; &nbsp;""&nbsp;&nbsp; &nbsp;"blazer_ser"
"INELT"&nbsp;&nbsp; &nbsp;"ups"&nbsp;&nbsp; &nbsp;"2"&nbsp;&nbsp; &nbsp;"Monolith 3000RT"&nbsp;&nbsp; &nbsp;""&nbsp;&nbsp; &nbsp;"blazer_ser"{code}