Files
scylladb/tools/scyllatop/views/stdout.py
Yoav Kleinberger 624165da79 scyllatop: dump all output to stdout instead of running a fancy console interface
Sometimes the user would like to dump all the metrics into a file or
pipe it to another program, as requested in issue #1506.
This patch makes scyllatop check if stdout is connected to a TTY,
and if not - it does not fire up the fancy urwid UI but instead, just
writes all it's collected metrics to stdout.

Optionally, the user tell the program to quit after a specific
number of iterations via the -n or --iterations flag

Signed-off-by: Yoav Kleinberger <yoav@scylladb.com>
Message-Id: <1471777516-9903-1-git-send-email-yoav@scylladb.com>
2016-08-31 08:31:36 +03:00

11 lines
255 B
Python

import base
import helpers
import sys
class Stdout(base.Base):
def update(self, liveData):
for metric in liveData.measurements:
print('{} {}'.format(metric.symbol, helpers.formatValues(metric.status)))
sys.stdout.flush()