sqshq / sampler

Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.
https://sampler.dev
GNU General Public License v3.0
12.88k stars 572 forks source link

Feature request: Dynamic items or Dictionnary items #102

Open benoitjpnet opened 3 years ago

benoitjpnet commented 3 years ago

Supposedly you have something like :

    items:                                                                                                      
      - label: toots                                                                                            
        sample: systemd-cgtop -m -1 -b -r --depth=1| grep lxc.payload.toots | awk '{ print int($4/1024/1024) }' 
      - label: cloud                                                                                            
        sample: systemd-cgtop -m -1 -b -r --depth=1| grep lxc.payload.cloud | awk '{ print int($4/1024/1024) }' 
      - label: photos                                                                                           
        sample: systemd-cgtop -m -1 -b -r --depth=1| grep lxc.payload.photos | awk '{ print int($4/1024/1024) }'

I would like to have ability to either dynamic get items and labels.

systemd-cgtop -m -1 -b -r --depth=1| grep lxc.payload. | awk '{ print $1, int($4/1024/1024) }' 
lxc.payload.toots 1394
lxc.payload.cloud 375
lxc.payload.git 347

Automatically get label with $1, and value with $2.

Or having a dict.

    items: ['toots', 'cloud', 'photos']                                                                                                   
      - label: {{ items }}                                                                                            
        sample: systemd-cgtop -m -1 -b -r --depth=1| grep lxc.payload.{{ items }} | awk '{ print int($4/1024/1024) }'