I am using Zabbix 2.0.4 to monitor several Java applications. Most values are exported via JMX. One of those exported attributes is a string that is constructed like this: [IP_1],[port_1],[ms_time_1];[IP_2],[port_2],[ms_time_2]; eg:,5060,15638;,5060,9753;

I want to construct a trigger based on the ms_time value for a given IP address. My first problem is: how do I get this value from the string? I have this regexp, which captures the correct number when I test it in several regular expression test tools:


But somehow, this doesn't seem to work in Zabbix. I have tried different versions of the regexp, e.g. using [0-9] or [:digit:] instead of [\d], but to no avail.

My trigger should get active when the ms_time value exceeds 15000, so my whole trigger definition currently looks like this:


I couldn't find any examples where a regexp was used to extract a value from a string and use that value for further processing.

  • Why you don't upgrade to newer LTS versions? I just asked out of curiosity – Daniel Gordi Oct 15 '18 at 12:22

Function regexp returns 1 if the item's value matches the regular expression provided as the argument, and returns 0 otherwise. It does not return the extracted value.

In general, what you are trying to do is currently not possible, but there are two feature requests that may make it possible in the future: ZBXNEXT-1638 (store the whole value, but extract a piece of information later) and ZBXNEXT-1427 (extract a piece of information upon receival).

As a workaround, if the threshold value for ms_time would be a round value (say, 10000), it would be possible to trigger based on ms_time length:


With the help of Asaveljevs' Answer, I finally managed to create a working trigger expression. Checking for the length of ms_time does not work in my case, but checking each digits value is a possibility. With leading zeros this is something like this:


This should match any number < 15000. Of course, another solution would be to invert the whole thing and look for any match >= 15000...

So thanks again, and let's hope these feature requests get implemented soon! ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.