今天在添加zabbix对2台mysql服务器监控的时候,其中有一台的item报如下错误:

Value "Warning: Using a password on the command line interface can be insecure.6158" of type "string" is not suitable for value type "Numeric(unsigned)"

我设置的获取的值类型是数字格式,2台机器用的同一个模版的key取值,但为什么有一台接收到的是string格式。

 

web中的item里我设置的

zabbix_agentd.conf里key写的 UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | mysql -u zabbix -pzabbix -N | awk '{print $$2}'

 

后来发现这2台mysql版本不一样。。。一台是5.5,一台是5.6。

在5.6以上版本的时候用mysql相关命令-p后面接密码这种方式会有一个警告提示(Warning: Using a password on the command line interface can be insecure.),这是安全风险提示。

这样zabbix服务端使用表达式过滤获取数值的时候,会带有该字符串,导致item获取值类型错误。。。

 

解决方法:

在key中用 2>/dev/null把这段告警忽略掉。

UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | mysql -u zabbix -pzabbix -N 2>/dev/null| awk '{print $$2}'

 

相关文章:

  • 2021-06-25
  • 2021-07-27
  • 2022-12-23
  • 2022-02-24
  • 2021-10-09
  • 2022-01-24
  • 2022-12-23
  • 2021-12-30
猜你喜欢
  • 2022-12-23
  • 2021-10-07
  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案