[ZBX-14796] trigger function count() with eq on string not working Created: 2018 Aug 31  Updated: 2018 Aug 31  Resolved: 2018 Aug 31

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 3.4.12
Fix Version/s: None

Type: Problem report Priority: Major
Reporter: Markus Fischbacher Assignee: Unassigned
Resolution: Commercial support required Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu containers (official) on ubuntu


Attachments: PNG File image-2018-08-31-11-23-03-203.png     PNG File image-2018-08-31-11-45-22-431.png    

 Description   

Steps to reproduce:

Trigger Template should count the number of values in the last 2 samples which equals "red". Trigger fires if greater than 1 ( so if both samples are "red" ).

Problem: {Infotech - vPoller Proxy - Template vSphere Host:vpoller["host.get", "{$VSPHERE.HOST}", "{HOST.CONN}","summary.overallStatus", "null"].count(#2,"red",eq)}>1

Result:

Trigger is NOT fired even if both samples are "red".

Expected:

Trigger should fire on both samples are "red".

 

Workaround:

Problem: (({Infotech - vPoller Proxy - Template vSphere Host:vpoller["host.get", "{$VSPHERE.HOST}", "{HOST.CONN}","summary.overallStatus", "null"].count(#2,red,iregexp*)*})=2)

Switching to iregexp/regexp works. The trigger fires if last two samples are "red".



 Comments   
Comment by Markus Fischbacher [ 2018 Aug 31 ]

This doesn't work for me at least since 3.4.7

Comment by Markus Fischbacher [ 2018 Aug 31 ]

On the other hand ...

Problem: (({Infotech - vPoller Proxy - Template vSphere Host:vpoller["host.get", "{$VSPHERE.HOST}", "{HOST.CONN}","summary.rebootRequired", "null"].count(#2,true,eq*)*})>1)

... works without problems! If two samples are boolean true the trigger fires as expected.

Comment by Alexey Pustovalov [ 2018 Aug 31 ]

Do you have exactly "red" value? Please show screenshot of values from Monitoring->Latest data

Comment by Markus Fischbacher [ 2018 Aug 31 ]

Yes. Leading and Trailing " but that is comming from the plugin/module

Comment by Alexey Pustovalov [ 2018 Aug 31 ]

So you have trailing double quotes, in this case your expression must be count(#2,"\"red\"",eq) or count(#2,"red",like).

Comment by Alexey Pustovalov [ 2018 Aug 31 ]

Anyway it is bug tracker. The issue definitely is not a bug.

Please refer to https://zabbix.org/wiki/Getting_help for ways of getting help from Zabbix company or the Zabbix community.

I would suggest raising your question on the Zabbix IRC channel first, as there are usually community members available to help you.

Comment by Markus Fischbacher [ 2018 Aug 31 ]

You're right but i'm not on IRC? And thought it's a bug as it's in the docs too:

So maybe the docs should get updated.

Anyway thanks for the help, will try like or escaping " then.

Generated at Wed Jul 16 11:16:29 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.