Ad Widget

Collapse

Extracting substring from text item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasad_SL
    Member
    • May 2018
    • 35

    #1

    Extracting substring from text item

    Hi,
    I am new to Zabbix and Regex. I try to extract information from executing a command
    (Ex: SSH to Linux and execute script df -h grep /dev/mapper/zabbix--vg-root)
    Filesystem Size Used Avail Use% Mounted on /dev/mapper/zabbix--vg-root 5.1G 3.1G 1.8G 63% / I want to get 5.1G and 3.1G to dependent Items. When I preprocess by regex \d.\d+G and output as \0, its ok returning 5.1G But for the second value, when I preprocess by regex \d.\d+G and output as \1, "" returns. as per my understanding, global flag cannot set and regex stops and returns the first occurrence. But Zabbix provided output parameters "An \N (where N=1…9) escape sequence is replaced with the Nth matched group" there must be a way to get multiple matched items indexed by \N .. is that so ? Or Am I missing something here ?
  • prasad_SL
    Member
    • May 2018
    • 35

    #2
    Hi, if any one interested, I managed to do it.
    just used (\d.\d)G

    Comment

    Working...