0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Zabbix Server 4.0から7.0へバージョンアップ(postgresql)

Posted at

Zabbix Server 4.0 を 7.0 にバージョンアップします。

なお都合上、データベースについてはすでにZabbix Server 7.0対応のバージョンを利用するかたちでZabbixのバージョンアップをします。

システム要件

Requirements Target
CPU/vCPU 2
Memory 8 GiB
DB(PostgreSQL) 13.0-17.X
PHP 8.0.0 - 8.3.X

環境

Software Before After
OS AlmaLinux release 8.8 AlmaLinux release 8.8
Zabbix Server 4.0.50-1 7.0.8-release1
PostgreSQL 15.10-1 15.10-1
httpd 2.4.37-65 2.4.37-65
PHP 7.2.24-1 8.0.30-1

バージョンアップ前の環境は以下で作成しています。

流れ

Zabbix Serverのサービスを停止し、バージョンアップを実施、そのあとにバージョンアップに係る変更箇所の確認を行います。

1.バージョンアップ事前準備
2.Zabbix Serverバージョンアップ
3.phpバージョンアップ
4.zabbix.conf再設定
5.zabbixパスワードリセット
6.関連サービス再起動
7.初回ログイン
8.triggerポーティング確認

1.バージョンアップ事前準備

バージョンアップ前に関連サービスを停止します。

# systemctl stop zabbix-server zabbix-agent httpd php-fpm

zabbix_server.confを任意の場所にバックアップしておきます。

# cp -p /etc/zabbix/zabbix_server.conf /data/backup/zabbix_server.conf.bak

PostgreSQLのデータベースバックアップも実施します。

# pg_dump -U zabbix zabbix > /data/backup/pg_dump

2.Zabbix Serverバージョンアップ

Zabbix7.0向けのリポジトリをダウンロードします。
この処理内で、既存のZabbix4.0のリポジトリが削除されます。

# rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/8/x86_64/zabbix-release-latest.el8.noarch.rpm

更新中 / インストール中...
   1:zabbix-release-7.0-5.el8
整理中 / 削除中...
   2:zabbix-release-4.0-2.el8

Zabbix Server 7.0関連のインストールを実施します。

# dnf clean all
# dnf install -y zabbix-server-pgsql zabbix-web-pgsql zabbix-web-japanese zabbix-sql-scripts zabbix-apache-conf

アップグレード済み:
  zabbix-server-pgsql-7.0.8-release1.el8.x86_64
  zabbix-web-7.0.8-release1.el8.noarch
  zabbix-web-pgsql-7.0.8-release1.el8.noarch
インストール済み:
  google-noto-cjk-fonts-common-20230817-1.el8_10.noarch
  google-noto-sans-cjk-ttc-fonts-20230817-1.el8_10.noarch
  zabbix-apache-conf-7.0.8-release1.el8.noarch
  zabbix-sql-scripts-7.0.8-release1.el8.noarch
  zabbix-web-deps-7.0.8-release1.el8.noarch
  zabbix-web-japanese-7.0.8-release1.el8.noarch

完了しました!

3.phpバージョンアップ

phpについて更新します。

# dnf remove -y php

削除しました:
  php-7.2.24-1.module_el8.3.0+2010+7c76a223.x86_64
  php-cli-7.2.24-1.module_el8.3.0+2010+7c76a223.x86_64


# dnf module list php

AlmaLinux 8 - AppStream
Name    Stream          Profiles                        Summary               
php     7.2 [d][e]      common [d], devel, minimal      PHP scripting language
php     7.3             common [d], devel, minimal      PHP scripting language
php     7.4             common [d], devel, minimal      PHP scripting language
php     8.0             common [d], devel, minimal      PHP scripting language
php     8.2             common [d], devel, minimal      PHP scripting language

ヒント: [d]efault, [e]nabled, [x]disabled, [i]nstalled


# dnf module reset -y php
# dnf module enable php:8.0 -y
# dnf install -y php

アップグレード済み:
  php-bcmath-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-common-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-fpm-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-gd-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-ldap-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-mbstring-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-pdo-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-pgsql-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-xml-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
インストール済み:
  oniguruma-6.8.2-3.el8.x86_64
  php-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-cli-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64
  php-opcache-8.0.30-1.module_el8.8.0+3655+3335cff6.x86_64

完了しました!

本環境では単純更新の実施準備にてエラーが出たため、一旦phpを削除してからインストールする方式を採っています。

# dnf module enable php:8.0 -y

オペレーションは、モジュール 'php' ストリーム '7.2' を ストリーム '8.0' へと切り替える結果となります
エラー: 設定オプション module_stream_switch から明示的に有効化されていない限り、モジュールの有効なストリームを切り替えることはできません。
モジュールからインストールされた全てのコンテンツを削除し、'dnf module reset <module_name>' コマンドを使用してリセットすることが推奨されます。モジュールのリセット後、他のストリームをインストール可能です。

phpタイムゾーン設定を実施します。

# vi /etc/php-fpm.d/zabbix.conf
--------------------------------------
php_value[date.timezone] = Asia/Tokyo

4.zabbix.conf再設定

事前にバックアップしておいたzabbix_server.confと、Zabbix Serverバージョンアップ後に配置されてあるzabbix_server.confについて内容比較し、必要に応じて編集をします。

# diff /data/backup/zabbix_server.conf.bak /etc/zabbix/zabbix_server.conf

本環境では内容差異なきため編集は行っていません。

5.zabbixパスワードリセット

ZabbixのAdminユーザパスワードのリセットを実施します。
リセット後のパスワードはzabbixです。

# psql -U zabbix

=> UPDATE users SET passwd = '$2a$10$ZXIvHAEP2ZM.dLXTm6uPHOMVlARXX7cqjbhM6Fn0cANzkCQBWpMrS' WHERE username = 'Admin';

=> \q

上記の要因は以下に別記しています。

6.関連サービス再起動

関連サービスの再起動を実施します。

systemctl restart zabbix-server zabbix-agent httpd php-fpm

7.初回ログイン

バージョンアップ前同様、 http://[IP or FQDN]/zabbix にアクセスし、初回デフォルトログインを実施します。

ユーザ:Admin
パスワード:zabbix

image.png

バージョンアップ後のログインが完了しました。
image.png

8.triggerポーティング確認

Zabbix Server 4.0 から 7.0 へのバージョンアップに伴い以下のような変更が存在します。

・Zabbix Server 5.4:トリガー構文の全面修正
・Zabbix Server 5.4:アプリケーションの廃止(タグへの統合)

事前に作成しておいたItem/Triggerがどう変化したかを確認します。

バージョンアップ中、zabbix_server.logに以下のようなアップグレード情報が表示されます。

20250126:160730.152 current database version (mandatory/optional): 04000000/04000006
20250126:160730.152 required mandatory version: 07000000
20250126:160730.152 mandatory patches were found
20250126:160730.153 starting automatic database upgrade
20250126:160730.172 completed 0% of database upgrade
20250126:160730.333 completed 1% of database upgrade
20250126:160730.397 completed 2% of database upgrade
・・・
20250126:160741.097 database upgrade fully completed

8.1 ICMP監視

■before(4.0)

Item Parameter
Name ICMP ping
Key icmpping
Application Status
Trigger Parameter
Name Unavailable by ICMP ping
Expression {Template Module ICMP Ping:icmpping.max(#3)}=0

■after(7.0)

Item Parameter
Name ICMP ping
Key icmpping
Tag Application:Status
Trigger Parameter
Name Unavailable by ICMP ping
Expression max(/Template Module ICMP Ping/icmpping,#3)=0

8.2 CPU監視(Zabbixエージェント)

■before(4.0)

Item Parameter
Name rs_cpu_util
Key system.cpu.util[all,user,avg1]
Application Resource
Trigger Parameter
Name trigger_CPU_80% {ITEM.VALUE}
Expression {001_linux_template:system.cpu.util[all,user,avg1].last()}>80

■after(7.0)

Item Parameter
Name rs_cpu_util
Key system.cpu.util[all,user,avg1]
Tag Application:Resource
Trigger Parameter
Name trigger_CPU_80% {ITEM.VALUE}
Expression last(/001_linux_template/system.cpu.util[all,user,avg1])>80

8.3 メッセージ監視(Zabbixアクティブエージェント)

■before(4.0)

Item Parameter
Name logrt_var/log/messages
Key logrt[/var/log/^messages$,test,,,skip,,,]
Application Log
Trigger Parameter
Name trigger_messages_test {ITEM.VALUE}
Expression {001_linux_template:logrt[/var/log/^messages$,test,,,skip,,,].regexp(.*)}=1

■after(7.0)

Item Parameter
Name logrt_var/log/messages
Key logrt[/var/log/^messages$,test,,,skip,,,]
Tag Application:Log
Trigger Parameter
Name trigger_messages_test {ITEM.VALUE}
Expression find(/001_linux_template/logrt[/var/log/^messages$,test,,,skip,,,],,"regexp",".*")=1

アプリケーションに関するタグへの統合、またトリガーの記述変更についてバージョンアップ時に行われていることが確認できました。



Itemのbefore(4.0)/After(7.0)
image.png

Triggerのbefore(4.0)/After(7.0)
image.png

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?