Ad Widget

Collapse

Item preprocessing regex question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • subbywan
    Junior Member
    • Sep 2020
    • 2

    #1

    Item preprocessing regex question

    Hi all,

    I'm pretty new to Zabbix and regex, so I hope this doesn't come off as being just stupid.

    I have dug around on here, but haven't found what I need.

    I have a string from a log file (that's showing up just fine)


    Line: 7306 2020-09-16 20:58:07.722849 Temp at Sensor 1 in Box 1 is 29
    I'm trying to set up graphing for this, which means I need to switch these to a int/float - Fine and dandy.

    I've cloned the item, and already filtered the log (it has other stuff in too) to give just the line info above. Now, I want to strip out the whole line, except for the last 2 characters, the actual temp.

    However, the best I've been able to do so far is create the regex to give me everything BUT those last 2 characters, with

    ^([\s\S]*)is
    giving me the output of "4837 2020-09-16 19:07:54.178560 Temp at Sensor 1 in Box 1 is"

    I fiddled with the trim options too, and was happily able to delete the characters 2 and 9 from the end.

    I can't use too much of a fixed string either, as there multiple sensors in multiple boxes, and I'm trying to parse them out so I can create a pretty graph that details them all.

    Any suggestions would be appreciated.

    Thank you!


  • DmitryL
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2016
    • 278

    #2
    Regex:
    .*in.*Box\s\d+\sis\s(\d+)

    Output:
    \1

    Comment

    • subbywan
      Junior Member
      • Sep 2020
      • 2

      #3
      Thank you!!

      Now I'm going to go sit and break that down until I understand it properly.

      Thank you so much!

      Comment

      Working...