
解决方法:
方案一、
shell脚本输出值的方式由: echo $count_line 修改为 echo $count_line |bc (数据类型string转换int)
方案二、
shell脚本输出值的方式由: echo $count_line 修改为 echo $count_line | awk ‘{print int($0)}’ (数据类型string转换int)
在使用Zabbix调用shell脚本获取监控值时遇到错误:Value "" of type "string" is not suitable for value type "Numeric (unsigned)"。本文提供了两种解决方案:1. 使用`echo $count_line | bc`将字符串转换为整数;2. 使用`echo $count_line | awk '{print int($0)}'`同样实现字符串到整数的转换。

解决方法:
方案一、
shell脚本输出值的方式由: echo $count_line 修改为 echo $count_line |bc (数据类型string转换int)
方案二、
shell脚本输出值的方式由: echo $count_line 修改为 echo $count_line | awk ‘{print int($0)}’ (数据类型string转换int)
1万+
3389

被折叠的 条评论
为什么被折叠?