sqshq / sampler

Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.

Home Page:https://sampler.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Converter script to convert the raw values for the axis legend

dwt opened this issue · comments

Hi there,

I use sampler to show what my mobile router is actually transmitting with a config like this:

runcharts:
  - title: Net Statistics
    position: [[0, 0], [80, 40]]
    rate-ms: 1000
    legend:
        enabled: true
        details: false
    scale: 2
    items:
      - label: Downloadrate
        sample: curl --cookie SessionID=$(curl --silent --cookie-jar - 'http://www.huaweimobilewifi.com/html/index.html'
            | tail -n 1 | cut -f 7) 'http://www.huaweimobilewifi.com/api/monitoring/traffic-statistics'
            | xpath '//response/CurrentDownloadRate/text()' 2>/dev/null
        transform: numfmt --to=iec
      - label: Uploadloadrate
        sample: curl --cookie SessionID=$(curl --silent --cookie-jar - 'http://www.huaweimobilewifi.com/html/index.html'
            | tail -n 1 | cut -f 7) 'http://www.huaweimobilewifi.com/api/monitoring/traffic-statistics'
            | xpath '//response/CurrentUploadRate/text()' 2>/dev/null
        transform: numfmt --to=iec

Now I would really like to convert the numbers that are shown in the x axis of the graph so that instead of the 3333.323 I could have something like 30k / 40k / 40k …

I haven't been able to find a way to achieve this - but maybe I overlooked something? If not, I would like to promote a key like transform_display: $some_shell_command that would allow this.

ping, anybody out there? Is this something you guys like / dislike?

That sounds reasonable, I think we can introduce an option for that (with the current behavior as a default). Might implement this in future, feel free to contribute if interested.