2024/07/10

ubuntu 22.04 安裝 Zabbix Agent2

 參考連結說明 https://www.zabbix.com/download?zabbix=7.0&os_distribution=ubuntu&os_version=22.04&components=agent_2&db=&ws=

Step 1:安裝 Zabbix Repository

$ sudo wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu22.04_all.deb
$ sudo dpkg -i zabbix-release_7.0-2+ubuntu22.04_all.deb
[sudo] password for it:
Selecting previously unselected package zabbix-release.
(Reading database ... 203293 files and directories currently installed.)
Preparing to unpack zabbix-release_7.0-2+ubuntu22.04_all.deb ...
Unpacking zabbix-release (1:7.0-2+ubuntu22.04) ...
Setting up zabbix-release (1:7.0-2+ubuntu22.04) ...

載入新增的套件庫
$ sudo apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:2 http://ru.archive.ubuntu.com/ubuntu jammy InRelease
Get:3 https://repo.zabbix.com/zabbix-tools/debian-ubuntu jammy InRelease [2 467 B]
Get:4 http://ru.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:5 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy InRelease [3 208 B]
Get:6 https://repo.zabbix.com/zabbix-tools/debian-ubuntu jammy/main Sources [522 B]
Get:7 https://repo.zabbix.com/zabbix-tools/debian-ubuntu jammy/main all Packages [422 B]
Get:8 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main Sources [2 797 B]
Get:9 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main amd64 Packages [4 593 B]
Get:10 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main all Packages [1 670 B]
Hit:11 http://ru.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:12 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [654 kB]
Get:13 http://ru.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1 790 kB]
Get:14 http://ru.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [716 kB]
Get:15 http://ru.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1 101 kB]
Fetched 4 534 kB in 3s (1 300 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
220 packages can be upgraded. Run 'apt list --upgradable' to see them.
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://repo.zabbix.com/zabbix/7.0/ubuntu jammy InRelease' doesn't support architecture 'i386'

Step 2:安裝 zabbix Agent

$ sudo apt install zabbix-agent2 zabbix-agent2-plugin-*
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'zabbix-agent2-plugin-mongodb' for glob 'zabbix-agent2-plugin-*'
Note, selecting 'zabbix-agent2-plugin-ember-plus' for glob 'zabbix-agent2-plugin-*'
Note, selecting 'zabbix-agent2-plugin-mssql' for glob 'zabbix-agent2-plugin-*'
Note, selecting 'zabbix-agent2-plugin-postgresql' for glob 'zabbix-agent2-plugin-*'
The following NEW packages will be installed:
  zabbix-agent2 zabbix-agent2-plugin-ember-plus zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-mssql
  zabbix-agent2-plugin-postgresql
0 upgraded, 5 newly installed, 0 to remove and 220 not upgraded.
Need to get 14,3 MB of archives.
After this operation, 47,3 MB of additional disk space will be used.
Get:1 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main amd64 zabbix-agent2 amd64 1:7.0.0-1+ubuntu22.04 [5 175 kB]
Get:2 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main amd64 zabbix-agent2-plugin-ember-plus amd64 1:7.0.0-1+ubuntu22.04 [1 294 kB]
Get:3 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main amd64 zabbix-agent2-plugin-mongodb amd64 1:7.0.0-1+ubuntu22.04 [3 139 kB]
Get:4 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main amd64 zabbix-agent2-plugin-mssql amd64 1:7.0.0-1+ubuntu22.04 [2 142 kB]
Get:5 https://repo.zabbix.com/zabbix/7.0/ubuntu jammy/main amd64 zabbix-agent2-plugin-postgresql amd64 1:7.0.0-1+ubuntu22.04 [2 531 kB]
Fetched 14,3 MB in 3s (4 462 kB/s)
Selecting previously unselected package zabbix-agent2.
(Reading database ... 203302 files and directories currently installed.)
Preparing to unpack .../zabbix-agent2_1%3a7.0.0-1+ubuntu22.04_amd64.deb ...
Unpacking zabbix-agent2 (1:7.0.0-1+ubuntu22.04) ...
Selecting previously unselected package zabbix-agent2-plugin-ember-plus.
Preparing to unpack .../zabbix-agent2-plugin-ember-plus_1%3a7.0.0-1+ubuntu22.04_amd64.deb ...
Unpacking zabbix-agent2-plugin-ember-plus (1:7.0.0-1+ubuntu22.04) ...
Selecting previously unselected package zabbix-agent2-plugin-mongodb.
Preparing to unpack .../zabbix-agent2-plugin-mongodb_1%3a7.0.0-1+ubuntu22.04_amd64.deb ...
Unpacking zabbix-agent2-plugin-mongodb (1:7.0.0-1+ubuntu22.04) ...
Selecting previously unselected package zabbix-agent2-plugin-mssql.
Preparing to unpack .../zabbix-agent2-plugin-mssql_1%3a7.0.0-1+ubuntu22.04_amd64.deb ...
Unpacking zabbix-agent2-plugin-mssql (1:7.0.0-1+ubuntu22.04) ...
Selecting previously unselected package zabbix-agent2-plugin-postgresql.
Preparing to unpack .../zabbix-agent2-plugin-postgresql_1%3a7.0.0-1+ubuntu22.04_amd64.deb ...
Unpacking zabbix-agent2-plugin-postgresql (1:7.0.0-1+ubuntu22.04) ...
Setting up zabbix-agent2-plugin-postgresql (1:7.0.0-1+ubuntu22.04) ...
Setting up zabbix-agent2-plugin-mssql (1:7.0.0-1+ubuntu22.04) ...
Setting up zabbix-agent2-plugin-ember-plus (1:7.0.0-1+ubuntu22.04) ...
Setting up zabbix-agent2-plugin-mongodb (1:7.0.0-1+ubuntu22.04) ...
Setting up zabbix-agent2 (1:7.0.0-1+ubuntu22.04) ...
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent2.service → /lib/systemd/system/zabbix-agent2.service.
Processing triggers for man-db (2.10.2-1) ...

Step 3:啟動 Zabbix Agent

$ sudo systemctl restart zabbix-agent2

$ sudo systemctl enable zabbix-agent2
Synchronizing state of zabbix-agent2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent2

Step 4:修改設定檔 zabbix_agent2.conf

$ sudo vi /etc/zabbix/zabbix_agent2.conf

指向 zabbix server (假設為 10.1.2.3)

Server=10.1.2.3
ServerActive=10.1.2.3
Hostname=Zabbix Server

若使用 Zabbix Agent 則上面的 Hostname 必須等於在 Zabbix Server GUI 針對這台所給的名稱

重新啟動

$ sudo systemctl restart zabbix-agent2


沒有留言:

張貼留言

Ubuntu 如何查看及變更時區 TimeZone

使用指令 timedatectl 查看目前 ubuntu 的時區設定 $ timedatectl 列出所有 Asia 的時區 $ timedatectl list-timezones | grep Asia 變更時區為 Asia/Taipei $ sudo timedatectl...