Ad Widget

Collapse

Fetch contents of file and use for item discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yurtesen
    Senior Member
    • Aug 2008
    • 130

    #1

    Fetch contents of file and use for item discovery

    I am trying to write a discovery rule for finding XFS project quotas using the `/etc/projects` file.

    The file is very simple like this:
    Code:
    20:/tmp
    30:/home
    40:/var/crash
    50:/var/tmp
    60:/var/log
    70:/var/lib/postgresql/
    What I need is to get the paths and fetch them using LLD macros, or that is my plan....

    I thought I could use
    vfs.file.contents[/etc/projects]
    then a regex to match
    Code:
    \d+:(.*)
    then turn it into JSON... but the regex only seem to match the 1st line and stop. I could not manage to give it the global modifier.

    I would like to avoid running shell scripts to manipulate the text into JSON but it may be the only way perhaps. Is there any better way?

    Thanks!
Working...