Ad Widget

Collapse

zabbix_agent requesting in cli: vfs.dir.get wrapper, find command style

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sperrot2
    Junior Member
    • Nov 2023
    • 11

    #1

    zabbix_agent requesting in cli: vfs.dir.get wrapper, find command style

    Hi Zabbixers,


    [If you're used to requesting zabbix agent directly via zabbix_get in CLI, you might be interested in the following]

    As you may know, vfs.dir.get key, which was introduced in v6.0, returns a recursive listing of directories (for exemple /var/logs) in JSON format.
    It offers more or less same functionality as unix find command.

    Probem is : its arguments are positional, comma separated, and there

    I have developed a shell wrapper around it, named zafind (find for zabbix agent), with the same options as find, that converts named arguments/value pairs in positional parameters



    Output is deliberately kept as JSON, as it more convenienty processed with tools such as jq

    A typical call would be
    > zafind -ip <target> -from /var/log -type f -mtime -10 -size +100k | jq -C '.'

    IT IS PARTICULARLY USEFUL when, for some reasons, ypou are not granted access to remote targets, where you have to monitor specific files and/or conf files

    BETA version, but functional

    Have fun (and let me know) if you use it

    Stephane Perrot, zcs
    Paris, France


    (plus to : -ip : the host/ip to request and -from: the top dir)
    I intend to write a similar zaps, wrapper around the proc.get (v6.2) key
Working...