Ubuntu 安装 zabbix-get,Command 'zabbix_get' not found 解决办法

背景

在上回 Ubuntu 安装 nginx 版 zabbix 之后,执行 zabbix_get 提示命令不存在:

[[email protected]:zabbix]# zabbix_get -s 127.0.0.1 -k 'nginx.status[ping]'

Command 'zabbix_get' not found, but can be installed with:

apt install zabbix-proxy-mysql  
apt install zabbix-proxy-pgsql  
apt install zabbix-proxy-sqlite3
apt install zabbix-server-mysql 
apt install zabbix-server-pgsql 

解决方法

apt 安装 zabbix-get

[[email protected]:~]# apt install zabbix-get
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  zabbix-get
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 72.7 kB of archives.
After this operation, 249 kB of additional disk space will be used.
ionic [72.7 kB]
Fetched 72.7 kB in 0s (222 kB/s)

Selecting previously unselected package zabbix-get.
(Reading database ... 106406 files and directories currently installed.)
Preparing to unpack .../zabbix-get_1%3a5.0.0~alpha2-1+bionic_amd64.deb ...
Unpacking zabbix-get (1:5.0.0~alpha2-1+bionic) .................................................] 
Setting up zabbix-get (1:5.0.0~alpha2-1+bionic) ...######.......................................] 
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...##############################.............] 

之后就可以愉快地执行 zabbix_get

[[email protected]:zabbix]# zabbix_get -s 127.0.0.1 -k 'php-fpm.status[ping]' 
0
[[email protected]:zabbix]# zabbix_get -s 127.0.0.1 -k 'php-fpm.status[conn]'
15743

切记

安装的是 zabbix-get !而不是 zabbix_get,否则会出现以下情况

[[email protected]:zabbix]# apt install zabbix_get
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package zabbix_get
[[email protected]:zabbix]# which zabbix_get
[[email protected]:zabbix]# 
[[email protected]:zabbix]# zabbix_get -s 127.0.0.1 -k 'nginx.status[ping]'

Command 'zabbix_get' not found, but can be installed with:

apt install zabbix-proxy-mysql  
apt install zabbix-proxy-pgsql  
apt install zabbix-proxy-sqlite3
apt install zabbix-server-mysql 
apt install zabbix-server-pgsql 
Responses