I was trying to collect some data from a file using regular expressions and for that I was looking for an optimal solution.
My file is something like the example below.
So, I wish to collect the values from 6 parameters. Parm2 to 5 and parm7 to 8.
Using regular expressions I can create individual items and collect each parameter individually using key "vfs.file.regexp".
For example:
This way, It sure gives me the expected value, but, thinking about it, doing this way would create at least 6 readings for the same file.
So, maybe there's a better way to collect this parameters with a single file reading.
I thought of using "vfs.file.contents" key and preprocessing it with something like this:
But that doesn't really add up results, and Zabbix doesn't accept multiline flag.
Anyone knows a good way to collect just those target lines with a single regular expression?
My file is something like the example below.
Code:
(...) (someParms=on) ## [some comments] ## parm1=410962 parm2=205481 parm3=138871 parm4=670 parm5=6 parm6="Oct 25 16:27" parm7="Oct 25 16:34" parm8=on parm9='Oct 25 16:34:53 dnsmasq' ## [some comments] ## (otherParms=on) (...)
Using regular expressions I can create individual items and collect each parameter individually using key "vfs.file.regexp".
For example:
Code:
vfs.file.regexp[/path/to/file/fileName,"parm2=(.*)",,,,\1]
So, maybe there's a better way to collect this parameters with a single file reading.
I thought of using "vfs.file.contents" key and preprocessing it with something like this:
Code:
parm2=(.*)|parm3=(.*)|parm4=(.*)|parm5=(.*)|parm7= (.*)|parm8=(.*)\m
Anyone knows a good way to collect just those target lines with a single regular expression?

Comment