Coder Social home page Coder Social logo

cstat's Introduction

cstat

A visual stat tool for CrateDB clusters.

cstat is ispired by the awesome interactive process monitoring tool htop. cstat should be a similar tool to iostat, but for monitoring CrateDB clusters.

Screenshot of cstat in action

Requirements

cstat requires Python >= 3.6 and can connect to CrateDB >= 2.3.

Installation

cstat is available from Pypi so you can install it using pip.

pip install cstat

If you want to get the latest features and fixes, you can also install it directly from Github.

pip install git+https://github.com/chaudum/crate-top.git@master

Usage

After installation you can monitor CrateDB running on localhost with default configuration by invoking the following command:

>>> cstat --user crate

A full list of command line arguments are listed when invoking cstat with the --help argument:

>>> cstat --help
usage: cstat [-h] [--host HOST] [--port PORT] [--interval INTERVAL]
             [--user USER] [--version]

A visual stat tool for CrateDB clusters

optional arguments:
  -h, --help            show this help message and exit
  --host HOST, --crate-host HOST
                        CrateDB host to connect to
  --port PORT, --psql-port PORT
                        PSQL port of CrateDB host
  --interval INTERVAL, --refresh-interval INTERVAL
                        amount of time in seconds between each update
  --user USER, --db-user USER
                        database user
  --version             show program's version number and exit

By default cstat connects to localhost on port 5432 if not otherwise specified.

Keyboard Shortcuts

  • 0 ... toggle cluster info
  • 1 ... show utilization for CPU, process, memory, heap and disk
  • 2 ... show I/O statistics for network and disk
  • 3 ... show aggregated query duration based on jobs_log
  • x ... toggle nodes/aggregation view
  • f3 ... enable/disable job logging (this also sets the stats.jobs_log cluster setting)

Known Issues

  • Small terminal sizes will raise CanvasErrors because of content overflow.

Todo

  • [x] display disk usage
  • [x] display disk i/o
  • [x] display network i/o
  • [x] display node names in detail views
  • [x] use asyncio to perform http requests
  • [x] coloring of i/o stats
  • [ ] responsive i/o widget

cstat's People

Contributors

chaudum avatar mfussenegger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cstat's Issues

Canvas text is wider than the maxcol specified

I get this when monitoring on heavy load.

Traceback (most recent call last):
  File "/home/mibe/sandbox/mikethebeer/crate-top/.venv/bin/cstat", line 9, in <module>
    load_entry_point('cstat', 'console_scripts', 'cstat')()
  File "/mnt/d/sandbox/mikethebeer/crate-top/cstat/command.py", line 153, in main
    stat.main()
  File "/mnt/d/sandbox/mikethebeer/crate-top/cstat/command.py", line 80, in main
    self.loop.run()
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/main_loop.py", line 278, in run
    self._run()
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/main_loop.py", line 376, in _run
    self.event_loop.run()
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/main_loop.py", line 682, in run
    self._loop()
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/main_loop.py", line 710, in _loop
    self._entering_idle()
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/main_loop.py", line 671, in _entering_idle
    callback()
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/main_loop.py", line 564, in entering_idle
    self.draw_screen()
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/main_loop.py", line 578, in draw_screen
    canvas = self._topmost_widget.render(self.screen_size, focus=True)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 1750, in render
    canv = get_delegate(self).render(size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 1083, in render
    focus and self.focus_part == 'body')
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/decoration.py", line 816, in render
    canv = self._original_widget.render((maxcol,), focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 1520, in render
    canv = w.render((maxcol,), focus=focus and item_focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 1750, in render
    canv = get_delegate(self).render(size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 1750, in render
    canv = get_delegate(self).render(size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/decoration.py", line 225, in render
    canv = self._original_widget.render(size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 1520, in render
    canv = w.render((maxcol,), focus=focus and item_focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 2085, in render
    focus = focus and self.focus_position == i)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 1520, in render
    canv = w.render((maxcol,), focus=focus and item_focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 1750, in render
    canv = get_delegate(self).render(size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 1520, in render
    canv = w.render((maxcol,), focus=focus and item_focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 2085, in render
    focus = focus and self.focus_position == i)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/container.py", line 1520, in render
    canv = w.render((maxcol,), focus=focus and item_focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/widget.py", line 141, in cached_render
    canv = fn(self, size, focus=focus)
  File "/mnt/d/sandbox/mikethebeer/crate-top/cstat/widgets.py", line 84, in render
    maxcol=maxcol)
  File "/mnt/d/sandbox/mikethebeer/crate-top/.venv/lib/python3.5/site-packages/urwid/canvas.py", line 356, in __init__
    raise CanvasError("Canvas text is wider than the maxcol specified \n%r\n%r\n%r"%(maxcol,widths,text))
urwid.canvas.CanvasError: Canvas text is wider than the maxcol specified 
104
[105]
[b'          [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||101.0%]']

Not entirely sure why CrateDB returns 101 %, maybe this should be fixed there - Could be a problem with the Sigar plugin.

python3.4 -m env doesn't appear to do anything

Perhaps you meant

python3.4 -m venv env

Not sure, though as the venv module isn't working for me on ubuntu trusty. It asks me to install python3-venv but the package isn't found by apt-get.

Canvas text is wider than the maxcol specified

Hi!

I was just using crate-top while stress testing a cluster, and it exited a few times with the following error:

File "/Users/victorcano/Desktop/playground/crate-top/eggs/urwid-1.3.1-py3.5-macosx-10.11-x86_64.egg/urwid/canvas.py", line 356, in init
raise CanvasError("Canvas text is wider than the maxcol specified \n%r\n%r\n%r"%(maxcol,widths,text))
urwid.canvas.CanvasError: Canvas text is wider than the maxcol specified
89
[104]
[b'Jessica D [**************************************************************************************119.8%]']

I believe it's because of the readings giving more than 100% of CPU at the time.

Thanks!

Invalid markup element: None

Traceback (most recent call last):
  File "bin/ctop", line 18, in <module>
    sys.exit(crate.top.command.main())
  File "/Users/christian/sandbox/crate/crate-top/src/crate/top/command.py", line 128, in main
    top()
  File "/Users/christian/sandbox/crate/crate-top/src/crate/top/command.py", line 58, in __call__
    self.loop.run()
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/main_loop.py", line 278, in run
    self._run()
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/main_loop.py", line 376, in _run
    self.event_loop.run()
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/main_loop.py", line 682, in run
    self._loop()
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/main_loop.py", line 715, in _loop
    alarm_callback()
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/main_loop.py", line 164, in cb
    callback(self, user_data)
  File "/Users/christian/sandbox/crate/crate-top/src/crate/top/command.py", line 104, in fetch
    self.view.update(info, nodes, jobs)
  File "/Users/christian/sandbox/crate/crate-top/src/crate/top/window.py", line 153, in update
    self.update_jobs(jobs)
  File "/Users/christian/sandbox/crate/crate-top/src/crate/top/window.py", line 161, in update_jobs
    r.stmt) for r in jobs]
  File "/Users/christian/sandbox/crate/crate-top/src/crate/top/window.py", line 161, in <listcomp>
    r.stmt) for r in jobs]
  File "/Users/christian/sandbox/crate/crate-top/src/crate/top/window.py", line 167, in _jobs_row
    urwid.Text(stmt),
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/widget.py", line 836, in __init__
    self.set_text(markup)
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/widget.py", line 879, in set_text
    self._text, self._attrib = decompose_tagmarkup(markup)
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/util.py", line 375, in decompose_tagmarkup
    tl, al = _tagmarkup_recurse(tm, None)
  File "/Users/christian/.buildout/eggs/urwid-1.3.1-py3.4-macosx-10.11-intel.egg/urwid/util.py", line 416, in _tagmarkup_recurse
    raise TagMarkupException("Invalid markup element: %r" % tm)
urwid.util.TagMarkupException: Invalid markup element: None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.