ZBX_NOTSUPPORTED: Item does not allow parameters.

时间:2022-10-10 01:34:04

搞mongo监控的时候,zabbix报错:ZBX_NOTSUPPORTED: Item does not allow parameters.

 

想了半天,不知道原因,最后经过大神指点,原来是zabbix_agend.conf配置文件的问题

zabbix主机错误如下

[root@zabbix ~]# zabbix_get -s 192.168.xxx.xxx -k "MongoDB.Status[mem,resident]"
ZBX_NOTSUPPORTED: Item does not allow parameters.

原来是zabbix_agend.conf中定义的UserParameter的问题,修改如下:

UserParameter=MongoDB.Status[*],/bin/echo "db.serverStatus().$1" | /usr/local/mongodb/bin/mongo admin -port 50000| grep "$2"|awk -F
: '{print $$2}'|awk -F, '{print $$1}'

缺少了*号

然后再取值,正常

[root@zabbix ~]# zabbix_get -s 192.168.xxx.xxx -k "MongoDB.Status[mem,resident]"
64