Обновление Zabbix 1.8 -> Zabbix 2

Аватар пользователя Raven2000

Zabbix 2

Пришло время обновлять Zabbix и перепрыгивать на его мажорную версию 2.0.Х. В виду куцести информации по плавному переезду я опубликую свою версию данного обновления.

Предварительно начитавшись Заметки по обновлению для 2.0.0 приступайте к действию.

Содержание:

Подготовка

Обновляем порты (предварительно настроив файл ports-supfile)

# /usr/bin/csup -h cvsup.freebsd.org -g -L 2 /usr/share/examples/cvsup/ports-supfile &&  cd /usr/ports/ && make fetchindex

Остановка сервисов

Останавливаем агентов и сервер:

# /usr/local/etc/rc.d/zabbix_agentd stop
Stopping zabbix_agentd.
Waiting for PIDS: 18754 18755 18756 18757 18758 18759, 18754.
# /usr/local/etc/rc.d/zabbix_server stop
Stopping zabbix_server.
Waiting for PIDS: 18716 18721 18722 18723 18724 18725 18726.

Бекап DB

* Делаем бекап старой базы:

# mysqldump -uUSER_ZABBIX -h127.0.0.1 -pPASSWORD_USER_ZABBIX DB_ZABBIX> db_zabbix.sql

Удаление ПО

Удаляем старые версии Zabbix (если что то пойдет не так, то база данных сохранена и конфигурационный файлы не удаляться и вам потребуется только установить старое ПО и запустить демон)

# pkg_info | grep zabbix
zabbix-agent-1.8.13,2 Enterprise-class open source distributed monitoring (agent)
zabbix-frontend-1.8.13,2 Enterprise-class open source distributed monitoring (fronte)
zabbix-server-1.8.13,2 Enterprise-class open source distributed monitoring (server)
 
# pkg_deinstall zabbix-agent-1.8.13,2
# pkg_deinstall zabbix-frontend-1.8.13,2
# pkg_deinstall zabbix-server-1.8.13,2

Установка Zabbix 2.0

Смотрим в портах новый Zabbix и устанавливаем необходимые компоненты:

# cd /usr/ports/ && make search name=zabbix2
Port:   zabbix2-agent-2.0.2_1
Path:   /usr/ports/net-mgmt/zabbix2-agent
Info:   Enterprise-class open source distributed monitoring (agent)
Maint:  pakhom706@gmail.com
B-deps: libiconv-1.14 pkgconf-0.8.9
R-deps: libiconv-1.14
WWW:    _http://www.zabbix.com/
 
Port:   zabbix2-frontend-2.0.2_1
Path:   /usr/ports/net-mgmt/zabbix2-frontend
Info:   Enterprise-class open source distributed monitoring (frontend)
Maint:  pakhom706@gmail.com
B-deps:
R-deps: freetype2-2.4.9_1 jpeg-8_3 kbproto-1.0.5 libICE-1.0.7,1...
WWW:    _http://www.zabbix.com/
 
Port:   zabbix2-proxy-2.0.2_1
Path:   /usr/ports/net-mgmt/zabbix2-proxy
Info:   Enterprise-class open source distributed monitoring (proxy)
Maint:  pakhom706@gmail.com
B-deps: ca_root_nss-3.13.6 curl-7.24.0_1 gettext-0.18.1.1...
R-deps: ca_root_nss-3.13.6 curl-7.24.0_1 fping-3.4...
WWW:    _http://www.zabbix.com/
 
Port:   zabbix2-server-2.0.2_1
Path:   /usr/ports/net-mgmt/zabbix2-server
Info:   Enterprise-class open source distributed monitoring (server)
Maint:  pakhom706@gmail.com
B-deps: ca_root_nss-3.13.6 curl-7.24.0_1 gettext-0.18.1.1...
R-deps: ca_root_nss-3.13.6 curl-7.24.0_1 fping-3.4 gettext-0.18.1.1...
WWW:    _http://www.zabbix.com/

Устанавливим сервер и агента:

# cd /usr/ports/net-mgmt/zabbix2-agent && make install clean
[ ] IPV6 IPv6 protocol
~~
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/zabbix_agent
/usr/local/bin/zabbix_sender
/usr/local/sbin/zabbix_agentd
/usr/local/bin/zabbix_get
 
      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/zabbix_agentd
 
      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.
 
      For more information, and contact details about the security
      status of this software, see the following webpage:
_http://www.zabbix.com/

# cd /usr/ports/net-mgmt/zabbix2-frontend && make install clean
[*] MYSQL MySQL database
[*] MYSQLI MySQLI database
===>   Registering installation for zabbix2-frontend-2.0.3_1
===>  Cleaning for zabbix2-frontend-2.0.3_1

# cd /usr/ports/net-mgmt/zabbix2-server && make install clean
[*] CURL   Support for web monitoring
[*] FPING  Build/install fping for ping checks
[*] IPMI   Support for IPMI checks
[*] JABBER Support for Jabber media type
[*] LDAP   Support for LDAP server checks
[*] NMAP   Build/install nmap for o/s detection
[*] ODBC   Support for database checks via ODBC
[*] SSH    Support for SSH-based checks
[*] MYSQL  S(DB): MySQL database
[*] UNIXODBC S(ODBC): USE UnixODBC for ODBC support
~~
For Zabbix server and proxy daemons, as well as Zabbix frontend, a database is required. It is not needed to run Zabbix agent.
% cd /usr/local/share/zabbix2/server/database
 
PostgreSQL:
shell> psql -U <username>
psql> create database zabbix;
psql> \q
shell> cd database/postgresql
shell> psql -U <username> zabbix < schema.sql
shell> psql -U <username> zabbix < images.sql
shell> psql -U <username> zabbix < data.sql
 
MySQL:
shell> mysql -u<username> -p<password>
mysql> create database zabbix character set utf8;
mysql> quit;
shell> mysql -u<username> -p<password> zabbix < database/mysql/schema.sql
shell> mysql -u<username> -p<password> zabbix < database/mysql/images.sql
shell> mysql -u<username> -p<password> zabbix < database/mysql/data.sql
 
SQLite:
shell> cd database/sqlite3
shell> sqlite3 /var/lib/sqlite/zabbix.db < schema.sql
shell> sqlite3 /var/lib/sqlite/zabbix.db < images.sql
shell> sqlite3 /var/lib/sqlite/zabbix.db < data.sql
 
 
IBM DB2:
shell> db2 "create database zabbix using codeset utf-8 territory us pagesize 32768"
shell> cd database/ibm_db2
shell> db2batch -d zabbix -f schema.sql
shell> db2batch -d zabbix -f images.sql
shell> db2batch -d zabbix -f data.sql
 
 
To upgrade an existing database, see the scripts in
/usr/local/share/zabbix2/server/upgrades.
 
Please see _http://www.zabbix.com/documentation/2.0/manual/installation/install for installation instructions.
 
For use NMAP please edit sudoers
======================================================================
===> Correct pkg-plist sequence to create group(s) and user(s)
===>   Compressing manual pages for zabbix2-server-2.0.3
===>   Registering installation for zabbix2-server-2.0.3
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/zabbix_server
 
      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/zabbix_server
 
      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.
 
      For more information, and contact details about the security
      status of this software, see the following webpage:
 
_http://www.zabbix.com/
===>  Cleaning for zabbix2-server-2.0.3

Обновление DB

Обновим старую DB. Это может занимать продолжительное время (1-2-5 часов) в зависимости от размеров базы.

# cd /usr/local/share/zabbix2/server/upgrades/dbpatches/2.0/mysql/
# ll
total 136
-r--r--r--  1 root  wheel   120k 26 окт 11:25 patch.sql
-r--r--r--  1 root  wheel   857B  3 окт 18:58 rc4_rc5.sql
-r--r--r--  1 root  wheel   5,9k  3 окт 18:58 upgrade
# mysql -u oao-rtu_zabbix -p oao-rtu_zabbix < patch.sql
Enter password:
#

Настройка

Создаем конфигруционные файлы:

# cd /usr/local/etc/zabbix2/
# cp zabbix_agentd.conf.sample zabbix_agentd.conf
# cp zabbix_server.conf.sample  zabbix_server.conf

Сравниваем старые версии конфигурационных файлов с новыми и добавляем необходимое (к примеру данные для подключению к DB)
Конфигурационный файлы предыдущей версии так и лежат в
# ll /usr/local/etc/zabbix
total 52
-rw-r--r--  1 root  wheel     6k 28 май 11:56 zabbix_agentd.conf
-rw-r--r--  1 root  wheel   8,9k 25 окт 11:01 zabbix_server.conf

Запуск

Запускаем демонов:

# /usr/local/etc/rc.d/zabbix_agentd start
Starting zabbix_agentd.
# /usr/local/etc/rc.d/zabbix_server start
Starting zabbix_server.

Проверяем логи и работу:

# tail -50 /tmp/zabbix_server.log
 18716:20121026:104125.492 syncing history data...
 18716:20121026:104125.492 syncing history data done
 18716:20121026:104125.492 syncing trends data...
 18716:20121026:104129.292 syncing trends data done
 18716:20121026:104129.293 Zabbix Server stopped. Zabbix 1.8.13 (revision 27486).
 79846:20121026:132438.143 Starting Zabbix Server. Zabbix 2.0.3 (revision 30485).
 79846:20121026:132438.143 ****** Enabled features ******
 79846:20121026:132438.143 SNMP monitoring:           YES
 79846:20121026:132438.143 IPMI monitoring:           YES
 79846:20121026:132438.143 WEB monitoring:            YES
 79846:20121026:132438.143 Jabber notifications:      YES
 79846:20121026:132438.143 Ez Texting notifications:  YES
 79846:20121026:132438.143 ODBC:                      YES
 79846:20121026:132438.143 SSH2 support:              YES
 79846:20121026:132438.143 IPv6 support:               NO
 79846:20121026:132438.143 ******************************
 79847:20121026:132438.938 server #1 started [configuration syncer #1]
 79848:20121026:132438.942 server #2 started [db watchdog #1]
 79855:20121026:132438.973 server #9 started [trapper #1]
 79857:20121026:132438.983 server #11 started [trapper #3]
 79859:20121026:132438.985 server #13 started [trapper #5]
 79861:20121026:132438.990 server #15 started [alerter #1]
 79864:20121026:132438.993 server #18 started [http poller #1]
 79856:20121026:132439.119 server #10 started [trapper #2]
 79858:20121026:132439.120 server #12 started [trapper #4]
 79869:20121026:132439.120 server #23 started [history syncer #4]
 79860:20121026:132439.123 server #14 started [icmp pinger #1]
 79862:20121026:132439.125 server #16 started [housekeeper #1]
 79862:20121026:132439.125 executing housekeeper
 79868:20121026:132439.126 server #22 started [history syncer #3]
 79866:20121026:132439.126 server #20 started [history syncer #1]
 79863:20121026:132439.128 server #17 started [timer #1]
 79871:20121026:132439.128 server #25 started [proxy poller #1]
 79870:20121026:132439.130 server #24 started [escalator #1]
 79846:20121026:132439.130 server #0 started [main process]
 79872:20121026:132439.213 server #26 started [self-monitoring #1]
 79867:20121026:132439.229 server #21 started [history syncer #2]
 79849:20121026:132440.437 server #3 started [poller #1]
 79865:20121026:132440.437 server #19 started [discoverer #1]
 79852:20121026:132440.438 server #6 started [poller #4]
 79853:20121026:132440.438 server #7 started [poller #5]
 79854:20121026:132440.439 server #8 started [unreachable poller #1]
 79851:20121026:132440.440 server #5 started [poller #3]
 79850:20121026:132440.442 server #4 started [poller #2]
 79854:20121026:132440.466 resuming Zabbix agent checks on host [ZABBIX server]: connection restored
 79869:20121026:132451.874 item [ZABBIX server:status] became not supported: Not supported by Zabbix Agent
 79869:20121026:132458.877 item [MAIN.domain.ru:status] became not supported: Not supported by 

va# tail /tmp/zabbix_agentd.log
 18754:20121026:104116.520 Zabbix Agent stopped. Zabbix 1.8.13 (revision 27486).
 79833:20121026:132431.347 Starting Zabbix Agent [Zabbix server]. Zabbix 2.0.3 (revision 30485).
 79836:20121026:132431.354 agent #2 started [listener]
 79835:20121026:132431.354 agent #1 started [listener]
 79834:20121026:132431.354 agent #0 started [collector]
 79837:20121026:132431.355 agent #3 started [listener]
 79838:20121026:132431.355 agent #4 started [active checks]

# ps -ax |grep zabbix
79833  ??  I       0:00,01 zabbix_agentd: main process (zabbix_agentd)
79834  ??  S       0:00,05 zabbix_agentd: collector [sleeping for 1 seconds] (z
79835  ??  S       0:00,22 zabbix_agentd: listener [waiting for connection] (za
79836  ??  S       0:00,30 zabbix_agentd: listener [waiting for connection] (za
79837  ??  S       0:00,38 zabbix_agentd: listener [waiting for connection] (za
79838  ??  S       0:00,02 zabbix_agentd: poller [sleeping for 1 second(s)] (za
79846  ??  I       0:00,13 zabbix_server: main process (zabbix_server)
79847  ??  S       0:00,16 zabbix_server: configuration syncer [sleeping for 33
79848  ??  S       0:00,15 zabbix_server: db watchdog [sleeping for 8 seconds]
79849  ??  S       0:01,04 zabbix_server: poller [sleeping for 1 seconds] (zabb
79850  ??  S       0:00,78 zabbix_server: poller [sleeping for 1 seconds] (zabb
79851  ??  S       0:00,93 zabbix_server: poller [sleeping for 1 seconds] (zabb
79852  ??  S       0:01,01 zabbix_server: poller [sleeping for 1 seconds] (zabb
79853  ??  S       0:01,49 zabbix_server: poller [sleeping for 1 seconds] (zabb
79854  ??  S       0:00,14 zabbix_server: unreachable poller [sleeping for 3 se
79855  ??  I       0:00,03 zabbix_server: trapper [waiting for connection] (zab
79856  ??  I       0:00,02 zabbix_server: trapper [waiting for connection] (zab
79857  ??  I       0:00,01 zabbix_server: trapper [waiting for connection] (zab
79858  ??  I       0:00,01 zabbix_server: trapper [waiting for connection] (zab
79859  ??  I       0:00,11 zabbix_server: trapper [waiting for connection] (zab
79860  ??  S       0:00,52 zabbix_server: icmp pinger [pinging hosts] (zabbix_s
79861  ??  S       0:00,06 zabbix_server: alerter [sleeping for 7 seconds] (zab
79862  ??  S       0:00,09 zabbix_server: housekeeper [removing old history and
79863  ??  S       0:00,16 zabbix_server: timer [sleeping for 24 seconds] (zabb
79864  ??  S       0:00,06 zabbix_server: http poller [sleeping for 1 seconds]
79865  ??  S       0:00,19 zabbix_server: discoverer [sleeping for 9 seconds] (
79866  ??  S       0:00,70 zabbix_server: history syncer [sleeping for 2 second
79867  ??  S       0:00,52 zabbix_server: history syncer [sleeping for 4 second
79868  ??  S       0:00,76 zabbix_server: history syncer [syncing history] (zab
79869  ??  S       0:00,34 zabbix_server: history syncer [syncing history] (zab
79870  ??  S       0:00,10 zabbix_server: escalator [sleeping for 1 seconds] (z
79871  ??  S       0:00,10 zabbix_server: proxy poller [sleeping for 2 seconds]
79872  ??  S       0:00,13 zabbix_server: self-monitoring [sleeping for 1 secon

Web интерфейс

Настраиваем морду - идем по шагам:






Далее переходим собственно в фронтэнд.

Клиенты

Обновите всех старых Zabbix клиентов.

вопрос

Скажите, в строке бекапа бд, "-uUser" так и должно быть слитно? просто я начинающий во фряхе)

Нет, -u пробел

Нет, -u пробел имя_пользователя

Последние статьи

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer