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 573 forks source link

Cannot use MySQL query as a source for runcharts #50

Closed coramba closed 5 years ago

coramba commented 5 years ago

Hi!

I'm trying to setup monitoring of number of records per minute in a table. It works like a charm when when using sparklines, but show nothing if I switch to runcharts. Am I doing something wrong or MySQL is not supported for runcharts yet? Thank you!

variables:
  mysql_connection: mysql -u user -s --database someDBName  --skip-column-names
runcharts:
  - title: App log messages
    position: [[40, 0], [40, 24]]
    rate-ms: 1000
    legend:
        enabled: true
        details: true
    scale: 2
    items:
      - label: Errors
        init: $mysql_connection
        sample: SELECT RAND();
      - label: Warnings
        init: $mysql_connection
        sample: SELECT RAND();
sparklines:
  - title: MySQL (random number example)
    pty: true
    init: $mysql_connection
    sample: SELECT RAND();
sqshq commented 5 years ago

Hi @coramba, MySQL shell requires PTY mode for proper work. You specified pty=true for sparklines, but did not do it for runcharts.

Could you please fix the config and try again?

coramba commented 5 years ago

Hi @sqshq

Could you please fix the config and try again?

Yup, seems I just missed this part in the doc. Sorry. Works like a charm now! Thank you!