Zabbix をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
本家様 [[https://www.zabbix.com/jp/features>+https://www....
最新リリース版は Zabbix 6.0 (2022.05時点)
RHEL8系はサーバになれる. RHEL7系はエージェントにはなれる....
[[https://www.zabbix.com/download>+https://www.zabbix.com...
ここでは &color(lightseagreen){''RockyLinux8''}; に Zabbi...
&size(10){Zabbixのハード/ソフトウエア要件はこちらに記載さ...
&size(10){job queuing systemと絡めて1core使用のジョブの待...
&size(10){jobの完了の通知もzabbix経由でできそうだけど、、...
&size(10){lineに関しては [[https://blog.apar.jp/zabbix/58...
&size(10){監視対象ホストの登録[[Zabbix/Host]]};
&size(10){さっそく異常を発生させてメールを飛ばしてみる[[Z...
&size(10){さっそく異常を発生させて Slack に通知してもらう...
&size(10){ログインユーザの登録[[Zabbix/User]]};
&size(10){テンプレートの一例[[Zabbix/templates]]};
&size(10){openpbsの情報をモニター[[Zabbix/OpenPBS]]}; &...
***リポジトリ登録 [#wfae0efe]
まずはZabbixのリポジトリを登録
#code(nonumber){{
[root@zabbix ~]# cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)
[root@zabbix ~]# getenforce
Enforcing
[root@zabbix ~]# rpm -Uvh https://repo.zabbix.com/zabbix/...
[root@zabbix ~]# dnf clean all
}}
[[Zabbix/repository]]
***Zabbixパッケージをインストール [#faf073b8]
っで本家に記載の通りに作業を進める
#code(nonumber){{
[root@zabbix ~]# dnf install zabbix-server-pgsql zabbix-w...
}}
&size(10){「httpd」「php」らも一緒にインストールされるが...
&size(10){ユーザ「zabbix]がsystemアカウントとして用意され...
***PostgreSQLをインストール [#we650aea]
別にzabbixサーバとデータベースが共に存在する必要はなく、z...
ここではzabbixサーバに同居するようにしてます. 必要な post...
|BGCOLOR(yellow):Zabbix version|BGCOLOR(yellow):対応Postg...
|5.0|9.2.24 or later|https://www.zabbix.com/documentation...
|5.2|9.2.24 or later|https://www.zabbix.com/documentation...
|5.4|10.9-13.X(推奨 12.X.X or newer)|https://www.zabbix.c...
|6.0|13.0 - 14.X|https://www.zabbix.com/documentation/6.0...
使用しているRockyLinux8では現在「dnf module」側で複数のパ...
#code(nonumber){{
[root@zabbix ~]# dnf module list postgresql
Last metadata expiration check: 0:20:47 ago on Wed 04 May...
Rocky Linux 8 - AppStream
Name Stream Profiles ...
postgresql 9.6 client, server [...
postgresql 10 [d] client, server [...
postgresql 12 client, server [...
postgresql 13 client, server [...
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@zabbix ~]#
[root@zabbix ~]# dnf module install postgresql:13/server
[root@zabbix ~]# dnf info postgresql-server
Last metadata expiration check: 0:23:37 ago on Wed 04 May...
Installed Packages
Name : postgresql-server
Version : 13.5
Release : 1.module+el8.5.0+725+42e826de
Architecture : x86_64
Size : 22 M
Source : postgresql-13.5-1.module+el8.5.0+725+42e82...
Repository : @System
From repo : appstream
Summary : The programs needed to create and run a Po...
URL : http://www.postgresql.org/
License : PostgreSQL
Description : PostgreSQL is an advanced Object-Relationa...
: The postgresql-server package contains the...
: and run a PostgreSQL server, which will in...
: and maintain PostgreSQL databases.
[root@zabbix ~]#
}}
データベースのlocaleを「ja_JP.UTF-8」にしたいが、RockyLin...
#code(nonumber){{
[root@zabbix ~]# locale -a | grep -i ja_JP.UTF8 | wc -l
0
[root@zabbix ~]# dnf install langpacks-ja.noarch
[root@zabbix ~]# locale -a | grep -i ja_JP.UTF8
ja_JP.utf8
[root@zabbix ~]#
}}
データベースの初期設定を行います.
#code(nonumber){{
[root@zabbix ~]# PGSETUP_INITDB_OPTIONS="--encoding=UTF-8...
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgre...
[root@zabbix ~]# systemctl enable postgresql --now
}}
zabbix向けの &color(orangered){postgreSQL内部ユーザ};「za...
#code(nonumber){{
[root@zabbix ~]# sudo -u postgres createuser --pwprompt z...
Enter password for new role: <--- postgreSQL内に用意...
Enter it again:
[root@zabbix ~]# sudo -u postgres createdb -O zabbix --lo...
[root@zabbix ~]# sudo -u postgres psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype...
-----------+----------+----------+-------------+---------...
postgres | postgres | UTF8 | C | C ...
template0 | postgres | UTF8 | C | C ...
| | | | ...
template1 | postgres | UTF8 | C | C ...
| | | | ...
zabbix | zabbix | UTF8 | ja_JP.UTF-8 | ja_JP.UT...
(4 rows)
[root@zabbix ~]#
}}
postgreSQL内に用意した「zabbix」ユーザはOSのアカウント(/e...
同一マシンのUNIX domain socket通信ならpeerでいいが、local...
&size(10){正直、、localhost接続のための設定はzabbixの初期...
#code(nonumber){{
[root@zabbix ~]# id zabbix
uid=993(zabbix) gid=990(zabbix) groups=990(zabbix)
[root@zabbix ~]# vi /var/lib/pgsql/data/pg_hba.conf
:
local all all ...
host all all 127.0.0.1/32 ...
[root@zabbix ~]# systemctl restart postgresql
(確認テスト)
[root@zabbix ~]# sudo -u zabbix psql <-- 「local all a...
psql (13.5)
Type "help" for help.
zabbix=> \q
[root@zabbix ~]# psql -d zabbix -h localhost4 -p 5432 -U ...
Password for user zabbix: ...
psql (13.5)
Type "help" for help.
zabbix=> \q
[root@zabbix ~]#
}}
&color(red){*};&size(10){「peer」はUnixドメインソケットを...
&size(10){「ident」はOSのアカウントが存在して、そのOSパス...
&size(10){「md5」はpostgreSQL内のユーザでmd5認証を行う};
***PostgreSQLデータベースに Zabbixのスキーマを作成 [#o25f...
作ったデータベース「zabbix」にスキーマを作る
#code(nonumber){{
[root@zabbix ~]# zcat /usr/share/doc/zabbix-sql-scripts/p...
(あるいは)
[root@zabbix ~]# zcat /usr/share/doc/zabbix-sql-scripts/p...
}}
webアプリからデータベースへ接続すための設定を施す. 「/etc...
&size(10){運用時のwebアプリとデータベースの接続は peer 接...
#code(diff,nonumber){{
--- /etc/zabbix/zabbix_server.conf.20220508 2022-05-0...
+++ /etc/zabbix/zabbix_server.conf 2022-05-08 01:12:...
@@ -90,7 +90,7 @@
#
# Mandatory: no
# Default:
-# DBHost=localhost
+DBHost=
### Option: DBName
# Database name.
}}
&color(red){*};&size(10){/etc/zabbix/zabbix_server.confは...
***phpのタイムゾーン設定 [#t868fc04]
#code(diff,nonumber){{
[root@zabbix ~]# diff -u /etc/php.ini.20220504 /etc/php.ini
--- /etc/php.ini.20220504 2021-05-31 04:48:51.00000...
+++ /etc/php.ini 2022-05-04 19:48:36.642014439 +0900
@@ -899,7 +899,7 @@
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
-;date.timezone =
+date.timezone = Asia/Tokyo
; http://php.net/date.default-latitude
;date.default_latitude = 31.7667
[root@zabbix ~]#
}}
***起動 [#ze31343d]
あとはアプリの起動
#code(nonumber){{
[root@zabbix ~]# systemctl enable zabbix-server zabbix-ag...
}}
そしてfirewallを調整して
#code(nonumber){{
[root@zabbix ~]# firewall-cmd --add-service={http,https,z...
[root@zabbix ~]# firewall-cmd --reload
}}
「http://zabbix/zabbix」へアクセスしてみます. web画面がで...
&ref(2022y05m04d_201832658.png,nolink);
関連するプログラム群のバージョン確認が次で行われ、すべて...
&ref(2022y05m04d_201835674.png,nolink);
データベースとの接続をここで設定します. ネットワーク経由...
あとpostgreSQLないで作ったzabbixのパスワードを添えて「Nex...
&ref(2022y05m04d_201959629.png,nolink);
zabbixサーバの名称を定めます. ここでは「zabbix-server」と...
あとtimezoneとweb画面の色合いとかを定義します. 「Next ste...
&ref(2022y05m04d_202024032.png,nolink);
最終確認をして、「Next step」ボタンを押下します.
&ref(2022y05m04d_202028252.png,nolink);
成功すると下記のような画面が表示されます. 「Finish」ボタ...
&ref(2022y05m04d_202032202.png,nolink);
ログイン画面が表示されます.
ここで 初期アカウントは「Admin」パスワードは「zabbix」と...
&ref(2022y05m04d_202212121.png,nolink);
***メモ [#s8145fba]
上記の「起動」で「/etc/zabbix/web/zabbix.conf.php」が作ら...
だが、、、このzabbix.conf.phpに書かれた初期設定値は使われ...
終了行:
本家様 [[https://www.zabbix.com/jp/features>+https://www....
最新リリース版は Zabbix 6.0 (2022.05時点)
RHEL8系はサーバになれる. RHEL7系はエージェントにはなれる....
[[https://www.zabbix.com/download>+https://www.zabbix.com...
ここでは &color(lightseagreen){''RockyLinux8''}; に Zabbi...
&size(10){Zabbixのハード/ソフトウエア要件はこちらに記載さ...
&size(10){job queuing systemと絡めて1core使用のジョブの待...
&size(10){jobの完了の通知もzabbix経由でできそうだけど、、...
&size(10){lineに関しては [[https://blog.apar.jp/zabbix/58...
&size(10){監視対象ホストの登録[[Zabbix/Host]]};
&size(10){さっそく異常を発生させてメールを飛ばしてみる[[Z...
&size(10){さっそく異常を発生させて Slack に通知してもらう...
&size(10){ログインユーザの登録[[Zabbix/User]]};
&size(10){テンプレートの一例[[Zabbix/templates]]};
&size(10){openpbsの情報をモニター[[Zabbix/OpenPBS]]}; &...
***リポジトリ登録 [#wfae0efe]
まずはZabbixのリポジトリを登録
#code(nonumber){{
[root@zabbix ~]# cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)
[root@zabbix ~]# getenforce
Enforcing
[root@zabbix ~]# rpm -Uvh https://repo.zabbix.com/zabbix/...
[root@zabbix ~]# dnf clean all
}}
[[Zabbix/repository]]
***Zabbixパッケージをインストール [#faf073b8]
っで本家に記載の通りに作業を進める
#code(nonumber){{
[root@zabbix ~]# dnf install zabbix-server-pgsql zabbix-w...
}}
&size(10){「httpd」「php」らも一緒にインストールされるが...
&size(10){ユーザ「zabbix]がsystemアカウントとして用意され...
***PostgreSQLをインストール [#we650aea]
別にzabbixサーバとデータベースが共に存在する必要はなく、z...
ここではzabbixサーバに同居するようにしてます. 必要な post...
|BGCOLOR(yellow):Zabbix version|BGCOLOR(yellow):対応Postg...
|5.0|9.2.24 or later|https://www.zabbix.com/documentation...
|5.2|9.2.24 or later|https://www.zabbix.com/documentation...
|5.4|10.9-13.X(推奨 12.X.X or newer)|https://www.zabbix.c...
|6.0|13.0 - 14.X|https://www.zabbix.com/documentation/6.0...
使用しているRockyLinux8では現在「dnf module」側で複数のパ...
#code(nonumber){{
[root@zabbix ~]# dnf module list postgresql
Last metadata expiration check: 0:20:47 ago on Wed 04 May...
Rocky Linux 8 - AppStream
Name Stream Profiles ...
postgresql 9.6 client, server [...
postgresql 10 [d] client, server [...
postgresql 12 client, server [...
postgresql 13 client, server [...
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@zabbix ~]#
[root@zabbix ~]# dnf module install postgresql:13/server
[root@zabbix ~]# dnf info postgresql-server
Last metadata expiration check: 0:23:37 ago on Wed 04 May...
Installed Packages
Name : postgresql-server
Version : 13.5
Release : 1.module+el8.5.0+725+42e826de
Architecture : x86_64
Size : 22 M
Source : postgresql-13.5-1.module+el8.5.0+725+42e82...
Repository : @System
From repo : appstream
Summary : The programs needed to create and run a Po...
URL : http://www.postgresql.org/
License : PostgreSQL
Description : PostgreSQL is an advanced Object-Relationa...
: The postgresql-server package contains the...
: and run a PostgreSQL server, which will in...
: and maintain PostgreSQL databases.
[root@zabbix ~]#
}}
データベースのlocaleを「ja_JP.UTF-8」にしたいが、RockyLin...
#code(nonumber){{
[root@zabbix ~]# locale -a | grep -i ja_JP.UTF8 | wc -l
0
[root@zabbix ~]# dnf install langpacks-ja.noarch
[root@zabbix ~]# locale -a | grep -i ja_JP.UTF8
ja_JP.utf8
[root@zabbix ~]#
}}
データベースの初期設定を行います.
#code(nonumber){{
[root@zabbix ~]# PGSETUP_INITDB_OPTIONS="--encoding=UTF-8...
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgre...
[root@zabbix ~]# systemctl enable postgresql --now
}}
zabbix向けの &color(orangered){postgreSQL内部ユーザ};「za...
#code(nonumber){{
[root@zabbix ~]# sudo -u postgres createuser --pwprompt z...
Enter password for new role: <--- postgreSQL内に用意...
Enter it again:
[root@zabbix ~]# sudo -u postgres createdb -O zabbix --lo...
[root@zabbix ~]# sudo -u postgres psql -l
List of databases
Name | Owner | Encoding | Collate | Ctype...
-----------+----------+----------+-------------+---------...
postgres | postgres | UTF8 | C | C ...
template0 | postgres | UTF8 | C | C ...
| | | | ...
template1 | postgres | UTF8 | C | C ...
| | | | ...
zabbix | zabbix | UTF8 | ja_JP.UTF-8 | ja_JP.UT...
(4 rows)
[root@zabbix ~]#
}}
postgreSQL内に用意した「zabbix」ユーザはOSのアカウント(/e...
同一マシンのUNIX domain socket通信ならpeerでいいが、local...
&size(10){正直、、localhost接続のための設定はzabbixの初期...
#code(nonumber){{
[root@zabbix ~]# id zabbix
uid=993(zabbix) gid=990(zabbix) groups=990(zabbix)
[root@zabbix ~]# vi /var/lib/pgsql/data/pg_hba.conf
:
local all all ...
host all all 127.0.0.1/32 ...
[root@zabbix ~]# systemctl restart postgresql
(確認テスト)
[root@zabbix ~]# sudo -u zabbix psql <-- 「local all a...
psql (13.5)
Type "help" for help.
zabbix=> \q
[root@zabbix ~]# psql -d zabbix -h localhost4 -p 5432 -U ...
Password for user zabbix: ...
psql (13.5)
Type "help" for help.
zabbix=> \q
[root@zabbix ~]#
}}
&color(red){*};&size(10){「peer」はUnixドメインソケットを...
&size(10){「ident」はOSのアカウントが存在して、そのOSパス...
&size(10){「md5」はpostgreSQL内のユーザでmd5認証を行う};
***PostgreSQLデータベースに Zabbixのスキーマを作成 [#o25f...
作ったデータベース「zabbix」にスキーマを作る
#code(nonumber){{
[root@zabbix ~]# zcat /usr/share/doc/zabbix-sql-scripts/p...
(あるいは)
[root@zabbix ~]# zcat /usr/share/doc/zabbix-sql-scripts/p...
}}
webアプリからデータベースへ接続すための設定を施す. 「/etc...
&size(10){運用時のwebアプリとデータベースの接続は peer 接...
#code(diff,nonumber){{
--- /etc/zabbix/zabbix_server.conf.20220508 2022-05-0...
+++ /etc/zabbix/zabbix_server.conf 2022-05-08 01:12:...
@@ -90,7 +90,7 @@
#
# Mandatory: no
# Default:
-# DBHost=localhost
+DBHost=
### Option: DBName
# Database name.
}}
&color(red){*};&size(10){/etc/zabbix/zabbix_server.confは...
***phpのタイムゾーン設定 [#t868fc04]
#code(diff,nonumber){{
[root@zabbix ~]# diff -u /etc/php.ini.20220504 /etc/php.ini
--- /etc/php.ini.20220504 2021-05-31 04:48:51.00000...
+++ /etc/php.ini 2022-05-04 19:48:36.642014439 +0900
@@ -899,7 +899,7 @@
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
-;date.timezone =
+date.timezone = Asia/Tokyo
; http://php.net/date.default-latitude
;date.default_latitude = 31.7667
[root@zabbix ~]#
}}
***起動 [#ze31343d]
あとはアプリの起動
#code(nonumber){{
[root@zabbix ~]# systemctl enable zabbix-server zabbix-ag...
}}
そしてfirewallを調整して
#code(nonumber){{
[root@zabbix ~]# firewall-cmd --add-service={http,https,z...
[root@zabbix ~]# firewall-cmd --reload
}}
「http://zabbix/zabbix」へアクセスしてみます. web画面がで...
&ref(2022y05m04d_201832658.png,nolink);
関連するプログラム群のバージョン確認が次で行われ、すべて...
&ref(2022y05m04d_201835674.png,nolink);
データベースとの接続をここで設定します. ネットワーク経由...
あとpostgreSQLないで作ったzabbixのパスワードを添えて「Nex...
&ref(2022y05m04d_201959629.png,nolink);
zabbixサーバの名称を定めます. ここでは「zabbix-server」と...
あとtimezoneとweb画面の色合いとかを定義します. 「Next ste...
&ref(2022y05m04d_202024032.png,nolink);
最終確認をして、「Next step」ボタンを押下します.
&ref(2022y05m04d_202028252.png,nolink);
成功すると下記のような画面が表示されます. 「Finish」ボタ...
&ref(2022y05m04d_202032202.png,nolink);
ログイン画面が表示されます.
ここで 初期アカウントは「Admin」パスワードは「zabbix」と...
&ref(2022y05m04d_202212121.png,nolink);
***メモ [#s8145fba]
上記の「起動」で「/etc/zabbix/web/zabbix.conf.php」が作ら...
だが、、、このzabbix.conf.phpに書かれた初期設定値は使われ...
ページ名:
1