mywatch: Web application to view and kill MySQL queries

[ databases, mit, program, web ] [ Propose Tags ]

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

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.2.0, 0.2.1, 0.3.0
Change log
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 <>
Maintainer Igor Pashev <>
Category Databases, Web
Source repo head: git clone
Uploaded by ip1981 at 2017-05-20T19:00:57Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables mywatch
Downloads 4001 total (21 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.


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.


$ git clone
$ cd mywatch
$ cabal install


Type mywatch --help to see usage summary:

  mywatch [options] MYCNF


  -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


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.

host =
user = user1

host =
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.


MyWatch1 MyWatch2