MyNixOS website logo
Description

Web application to view and kill MySQL queries.

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

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.

Metadata

Version

0.3.0

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows