Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Zabbix MySQL监视--找不到以下命令的错误预处理失败:sh:MySQL:command_Mysql_Monitoring_Zabbix - Fatal编程技术网

Zabbix MySQL监视--找不到以下命令的错误预处理失败:sh:MySQL:command

Zabbix MySQL监视--找不到以下命令的错误预处理失败:sh:MySQL:command,mysql,monitoring,zabbix,Mysql,Monitoring,Zabbix,到目前为止,我执行的步骤如下:- 在我的DB机器[mysql]中安装了Zabbix代理 已使用Zabbix代理将模板_db_mysql.conf复制到文件夹中 配置(/etc/zabbix/zabbix_agentd.d/) 已创建mysql用户 创建由“”标识的用户“zbx_监视器”@“%”;授权使用、复制客户端、进程、显示数据库、在上显示视图。到“zbx_监视器”@“%” 在/var/lib/zabbix文件夹中创建了带有用户详细信息的.my.cnf 我的模板\u db\u my

到目前为止,我执行的步骤如下:-

  • 在我的DB机器[mysql]中安装了Zabbix代理

  • 已使用Zabbix代理将模板_db_mysql.conf复制到文件夹中 配置(/etc/zabbix/zabbix_agentd.d/)

  • 已创建mysql用户
    创建由“”标识的用户“zbx_监视器”@“%”;授权使用、复制客户端、进程、显示数据库、在上显示视图。到“zbx_监视器”@“%”

  • 在/var/lib/zabbix文件夹中创建了带有用户详细信息的.my.cnf

我的模板\u db\u mysql.conf文件是:-

UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status"
UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version
UserParameter=mysql.db.discovery[*], mysql -h"$1" -P"$2" -sN -e "show databases"
UserParameter=mysql.dbsize[*], mysql -h"$1" -P"$2" -sN -e "SELECT COALESCE(SUM(DATA_LENGTH + INDEX_LENGTH),0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'"
UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
UserParameter=mysql.slave_status[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"```

cat /var/lib/zabbix/.my.cnf
[client]
user='zbx_monitor'
password='<password>'

post restarting the zabbix-agent getting below errors
Preprocessing failed for: sh: mysql: command not found
1. Failed: cannot extract XML value with xpath "/resultset/row[field/text()='Connection_errors_internal']/field[@name='Value']/text()": cannot parse xml value: Start tag expected, '<' not found
Value "sh: mysql: command not found" of type "string" is not suitable for value type "Numeric (unsigned)"
[enter image description here][1]


  [1]: https://i.stack.imgur.com/Jxwux.png
UserParameter=mysql.get_status_variables[*],mysql-h“$1”-P“$2”-sNX-e“显示全局状态”
UserParameter=mysql.version[*],mysqladmin-s-h“$1”-P“$2”版本
UserParameter=mysql.db.discovery[*],mysql-h“$1”-P“$2”-sN-e“显示数据库”
UserParameter=mysql.dbsize[*],mysql-h“$1”-P“$2”-sN-e”从信息_SCHEMA.TABLES中选择合并(总和(数据长度+索引长度),0),其中TABLE_SCHEMA='$3''
UserParameter=mysql.replication.discovery[*],mysql-h“$1”-P“$2”-sNX-e“显示从机状态”
UserParameter=mysql.slave_status[*],mysql-h“$1”-P“$2”-sNX-e“显示slave status”```
cat/var/lib/zabbix/.my.cnf
[客户]
用户=“zbx\u监视器”
密码=“”
重新启动zabbix代理后出现以下错误
未找到:sh:mysql:命令的预处理失败

1.失败:无法使用xpath“/resultset/row[field/text()='Connection\u errors\u internal']/field[@name='value']/text()”提取XML值:无法分析XML值:需要开始标记,'路径中是否有二进制文件
su-zabbix-s/bin/sh-c“哪个mysql”