mywatch: Web application to view and kill MySQL queries

[ databases, mit, program, web ] [ Propose Tags ] [ Report a vulnerability ]

View and kill queries on multiple MySQL servers. Designed to work behind Sproxy.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.2.0, 0.2.1, 0.3.0
Change log ChangeLog.md
Dependencies aeson (>=0.8), base (>=4.8 && <50), bytestring (>=0.10), ConfigFile (>=1.1), data-default-class, docopt (>=0.7), fast-logger, filepath, http-types (>=0.9), interpolatedstring-perl6 (>=1.0), MissingH, mtl (>=2.2), mysql (>=0.1), mysql-simple (>=0.2), network (>=2.6), resource-pool (>=0.2), scotty (>=0.10), text (>=1.2), unix (>=2.7), unordered-containers (>=0.2), wai (>=3.2), wai-extra (>=3.0), wai-middleware-static (>=0.8), warp (>=3.2) [details]
License MIT
Copyright 2016-2017, Zalora South East Asia Pte. Ltd
Author Igor Pashev <pashev.igor@gmail.com>
Maintainer Igor Pashev <pashev.igor@gmail.com>
Category Databases, Web
Source repo head: git clone https://github.com/ip1981/mywatch.git
Uploaded by ip1981 at 2017-05-20T19:00:57Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables mywatch
Downloads 4062 total (25 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2017-05-20 [all 3 reports]

Readme for mywatch-0.3.0

[back to package description]

My Watch

Web application for viewing and killing MySQL queries on multiple servers. Designed to work behind Sproxy.

Requirements

MyWatch is written in Haskell with GHC. All required Haskell libraries are listed in mywatch.cabal. Use cabal-install to fetch and build all pre-requisites automatically.

Installation

$ git clone https://github.com/ip1981/mywatch.git
$ cd mywatch
$ cabal install

Usage

Type mywatch --help to see usage summary:

Usage:
  mywatch [options] MYCNF

Options:

  -d, --datadir=DIR        Data directory including static files [default: {cabal data dir}]

  -s, --socket=SOCK        Listen on this UNIX-socket [default: /tmp/mywatch.sock]
  -p, --port=PORT          Instead of UNIX-socket, listen on this TCP port (localhost)

  -h, --help               Show this message

Configuration

The MYCNF argument denotes a MySQL client config file. Each section in this file describes a MySQL server where you can view processes. As usually, the "client" section applies internally to all other sections, but is ignored by MyWatch. Remember to make this file secret if it includes passwords, or use the !include directive. However, MyWatch does not parse included files for more sections.

[foo]
host = example.com
user = user1
...

[bar]
host = example.net
user = user2
...

!include /run/keys/my.secret.cnf

Sproxy Configuration

  • To access the service allow GET for /, /static/% and /serverlist.json.
  • To see processes on a particular MySQL server allow GET and (optional) HEAD for /server/:server/processlist.json. The latter is only required with Sproxy2 before version 1.95.0
  • To kill processes allow DELETE for /server/:server/process/%

Database Configuration

MyWatch needs the PROCESS privilege.

To be able to kill queries a procedure named mywatch_kill must exist in the mysql database. MyWatch invokes CALL mysql.mywatch_kill(id) for killing queries. It's up to you how to implement this routine, for a safe example see sql/mywatch_kill.sql. Of course, MyWatch should be granted to execute this procedure. If this procedure does not exist, MyWatch will not show this possibility in user interface, API will work, but result in Internal Server Error (HTTP 500). There is no filtering at application level, though the "kill" button may not be shown in some circumstances.

Screenshots

MyWatch1 MyWatch2