2024/09/19追記
ubuntsu24にアップデートした際にzabbix用のレポジトリがなくてupdateできなかった。もしかしたら下記のインストール手順の前にapt用のレポジトリの設定がいるかも。設定方法は以下のイメージ。debファイルのバージョン部分に関してはこちらの公式ページを見て適宜インストールするOS情報で書き換え
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1%2Bubuntu24.04_all.deb
sudo dpkg -i zabbix-release_6.4-1+ubuntu24.04_all.deb
バージョン
yoshitake@mail:~$ cat /etc/issue
Ubuntu 22.04.4 LTS \n \l
エージェントを入れるサーバー側の作業
インストール(インストール時のログは下の方に張り付けておいた)
sudo apt-get update
sudo apt-get install zabbix-agent
とりあえず起動(同じくログは下の方に張り付けておいた)
sudo systemctl enable zabbix-agent
sudo systemctl start zabbix-agent
sudo systemctl status zabbix-agent
設定開始前のファイル退避
cd /etc/zabbix/
sudo git init
sudo git add --all
sudo git commit -m "初期状態"
/etc/zabbix/zabbix_agentd.confのServerとHostnameを編集して(hostname設定したけど使わないかも)
yoshitake@mail:/etc/zabbix$ sudo git diff
diff --git a/zabbix_agentd.conf b/zabbix_agentd.conf
index 1a4978a..838895d 100644
--- a/zabbix_agentd.conf
+++ b/zabbix_agentd.conf
@@ -114,7 +114,7 @@ LogFileSize=0
# Default:
# Server=
-Server=127.0.0.1
+Server=kanshiserver.example.co.jp
### Option: ListenPort
# Agent will listen on this port for connections from the server.
@@ -165,7 +165,7 @@ ServerActive=127.0.0.1
# Mandatory: no
# Default:
# Hostname=
-
+Hostname=kanshisareruserver.example.co.jp
### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
サービス再起動
sudo systemctl restart zabbix-agent
必要ならエージェント側のポートのファイヤウォールを開ける
sudo ufw allow 10050
本体サーバー側の作業
すでにある前提で、Webの画面からログイン
Configration->Hostsから右上の”Create host”ボタンを選択
name任意、group任意、inrterfaceはアージェントのサーバの値、必要ならテンプレートを指定。
しばらく待っていると通信できてたらConfigrationのhostsに生えてきた追加したhostのAvailability->ZBXが緑になる。
ログ関係
インストール時ログ
yoshitake@mail:~$ sudo apt-get install zabbix-agent
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了
以下のパッケージが新たにインストールされます:
zabbix-agent
アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 2 個。
298 kB のアーカイブを取得する必要があります。
この操作後に追加で 945 kB のディスク容量が消費されます。
取得:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 zabbix-agent amd64 1:5.0.17+dfsg-1 [298 kB]
298 kB を 2秒 で取得しました (163 kB/s)
以前に未選択のパッケージ zabbix-agent を選択しています。
(データベースを読み込んでいます ... 現在 135471 個のファイルとディレクトリがインストールされています。)
.../zabbix-agent_1%3a5.0.17+dfsg-1_amd64.deb を展開する準備をしています ...
zabbix-agent (1:5.0.17+dfsg-1) を展開しています...
zabbix-agent (1:5.0.17+dfsg-1) を設定しています ...
Creating config file /etc/zabbix/zabbix_agentd.conf with new version
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /lib/systemd/system/zabbix-agent.service.
man-db (2.10.2-1) のトリガを処理しています ...
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
起動設定時ログ
yoshitake@mail:~$ sudo systemctl enable zabbix-agent
Synchronizing state of zabbix-agent.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent
yoshitake@mail:~$ sudo systemctl start zabbix-agent
yoshitake@mail:~$ sudo systemctl status zabbix-agent
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor >
Active: active (running) since Wed 2024-03-13 17:37:38 JST; 5min ago
Docs: man:zabbix_agentd
Main PID: 24243 (zabbix_agentd)
Tasks: 6 (limit: 1012)
Memory: 4.3M
CPU: 88ms
CGroup: /system.slice/zabbix-agent.service
tq24243 /usr/sbin/zabbix_agentd --foreground
tq24246 "/usr/sbin/zabbix_agentd: collector [idle 1 sec]"
tq24247 "/usr/sbin/zabbix_agentd: listener #1 [waiting for connect>
tq24248 "/usr/sbin/zabbix_agentd: listener #2 [waiting for connect>
tq24249 "/usr/sbin/zabbix_agentd: listener #3 [waiting for connect>
mq24250 "/usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]"
3月 13 17:37:38 mail.epea.co.jp systemd[1]: Started Zabbix Agent.
3月 13 17:37:38 mail.epea.co.jp zabbix_agentd[24243]: Starting Zabbix Agent [m>
3月 13 17:37:38 mail.epea.co.jp zabbix_agentd[24243]: Press Ctrl+C to exit.
...skipping...
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor >
Active: active (running) since Wed 2024-03-13 17:37:38 JST; 5min ago
Docs: man:zabbix_agentd
Main PID: 24243 (zabbix_agentd)
Tasks: 6 (limit: 1012)
Memory: 4.3M
CPU: 88ms
CGroup: /system.slice/zabbix-agent.service
tq24243 /usr/sbin/zabbix_agentd --foreground
tq24246 "/usr/sbin/zabbix_agentd: collector [idle 1 sec]"
tq24247 "/usr/sbin/zabbix_agentd: listener #1 [waiting for connect>
tq24248 "/usr/sbin/zabbix_agentd: listener #2 [waiting for connect>
tq24249 "/usr/sbin/zabbix_agentd: listener #3 [waiting for connect>
mq24250 "/usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]"
3月 13 17:37:38 mail.epea.co.jp systemd[1]: Started Zabbix Agent.
3月 13 17:37:38 mail.epea.co.jp zabbix_agentd[24243]: Starting Zabbix Agent [m>
3月 13 17:37:38 mail.epea.co.jp zabbix_agentd[24243]: Press Ctrl+C to exit.