Ad Widget

Collapse

External Check Item Preprocessing - Regular Expression Match Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brunogauer
    Junior Member
    • Jul 2018
    • 9

    #1

    External Check Item Preprocessing - Regular Expression Match Error

    Hello!

    I am using Zabbix 3.4 with an external tool (Nagios SAP CCMS Plugin) that collects via an external check item specific informations from an SAP system. As the script returns a string I need to preprocess it in order to extract only the required value, for example:

    - Script output --> ResponseTime=293msec | ResponseTime=293msec;3000.000000;5000.000000;0;

    - Information needed --> 293

    The script is collecting and returing data correctly:

    Click image for larger version

Name:	history.jpg
Views:	6574
Size:	61.6 KB
ID:	362606

    This is the item configuration (I've tried both Text and Numeric Unsigned in the Type of Information):

    Click image for larger version

Name:	item.jpg
Views:	6667
Size:	90.9 KB
ID:	362603

    This is the preprocessing (I've tested on regex101 and it seems fine) to remove the data that is not the value. I've created two steps to remove the beggining and the end of the text (substitution

    /^ResponseTime=
    /msec*.*

    Click image for larger version

Name:	preprocessing.jpg
Views:	7000
Size:	48.0 KB
ID:	362607

    When the collector runs the following error occurs:

    Item preprocessing step #1 failed: cannot perform regular expression match on value "ResponseTime=3msec | ResponseTime=3msec;3000.000000;5000.000000;0;" of type "string": pattern does not match

    Click image for larger version

Name:	error.jpg
Views:	6572
Size:	61.4 KB
ID:	362608

    Do you have any suggestions or ideas on how could I fix this issue? I'm not sure if the regular expression is wrong or I misunderstood how the preprocessing works. Maybe the is also another way of doing that.

    Thanks in advance!
    Attached Files
  • lpossamai
    Senior Member
    • Jun 2018
    • 119

    #2
    Originally posted by brunogauer
    Hello!

    ...

    Do you have any suggestions or ideas on how could I fix this issue? I'm not sure if the regular expression is wrong or I misunderstood how the preprocessing works. Maybe the is also another way of doing that.

    Thanks in advance!
    Maybe something like:
    Code:
    ResponseTime\=(\d+)\msec
    Cheers!

    Comment

    • brunogauer
      Junior Member
      • Jul 2018
      • 9

      #3
      Originally posted by lpossamai

      Maybe something like:
      Code:
      ResponseTime\=(\d+)\msec
      Cheers!
      Thanks for the feedback! I've tried that regular expression by itself but now I get the below error. It seems like something else is needed in order only to get the numeric part of the string.

      Value "ResponseTime=4msec" of type "string" is not suitable for value type "Numeric (unsigned)"

      Comment

      • lpossamai
        Senior Member
        • Jun 2018
        • 119

        #4
        Originally posted by brunogauer

        Thanks for the feedback! I've tried that regular expression by itself but now I get the below error. It seems like something else is needed in order only to get the numeric part of the string.

        Value "ResponseTime=4msec" of type "string" is not suitable for value type "Numeric (unsigned)"
        Hi,

        What about this one?

        Code:
        (?<==)(\d+)
        DEMO

        Comment

        • brunogauer
          Junior Member
          • Jul 2018
          • 9

          #5
          Originally posted by lpossamai

          Hi,

          What about this one?

          Code:
          (?<==)(\d+)
          DEMO
          Hello!

          I was able to do it using the following expression: (\d+)

          Thanks for the input!

          Comment

          Working...