Skip to main content

Maintainer: k dot shenk at gmail dot com

The aim of mypsl is to provide a simple interface for querying and filtering the MySQL process list. Over time the available options have become bloated, so some cases may not be so simple.

Installation

Via PIP: pip install mypsl

Usage

usage: mypsl [-h] [-H HOST] [-p PORT] [-u USER] [-P PASSWD] [-ch CHARSET]
     [--config CONNECT_CONFIG] [-sm SALT_MINION]
     [-l LOOP_SECOND_INTERVAL] [-lm LOOP_MAX] [-dft] [-c COMMAND]
     [-s STATE] [-t TIME] [-d DATABASE] [-q QUERY] [-i] [-isr]
     [--debug] [-o ORDER_BY] [-T] [-v] [--slack] [--kill]
     [-kt KILL_THRESHOLD] [-ka] [-ky] [-kl KILL_LOG] [-klo]

(mypsl: mypsl: 0.19) :: MySQL Process list watcher & query
killer.

optional arguments:
  -h, --help            show this help message and exit

Connection Options:
  -H HOST, --host HOST  The host to get the process list from. If localhost,
                        we will attempt to find and use the socket file first.
                        (default: localhost)
  -p PORT, --port PORT  The host's port. If the host is localhost, we will
                        attempt to find and use the socket file first.
                        (default: 3306)
  -u USER, --user USER  The user to connect to the host as. (default: root)
  -P PASSWD, --pass PASSWD
                        The password for authentication. (default: )
  -ch CHARSET, --charset CHARSET
                        Charset to use with the database. (default: utf8)
  --config CONNECT_CONFIG
                        Load connection configuration from a file in
                        /root/.mypsl. Just provide the filename. This will
                        override any other connection information provided
                        (default: None)
  -sm SALT_MINION, --salt-minion SALT_MINION
                        Connect to mysql running on a salt minion. Do not use
                        any other connection options with this.
                        mysql:connection:user and mysql:connection:pass must
                        exist in pillar data. (default: None)

Configuration Options:
  -l LOOP_SECOND_INTERVAL, --loop LOOP_SECOND_INTERVAL
                        Time in seconds between getting the process list.
                        (default: 0)
  -lm LOOP_MAX, --loop_max LOOP_MAX
                        If specified we will stop execution when the loop
                        interval reaches this number (default: None)
  -dft, --default       Run with defaults. Loop interval: 3 seconds, command
                        like query or connect, order by time asc, id asc,
                        truncate query to 1000. (default: False)
  -c COMMAND, --command COMMAND
                        Lookup processes running as this command. (default:
                        None)
  -s STATE, --state STATE
                        Lookup processes running in this state. (default:
                        None)
  -t TIME, --time TIME  Lookup processes running longer than the specified
                        time in seconds. (default: None)
  -d DATABASE, --database DATABASE
                        Lookup processes running against this database.
                        (default: None)
  -q QUERY, --query QUERY
                        Lookup processes where the query starts with this
                        specification. (default: None)
  -i, --id              Only print back the ID of the processes. (default:
                        False)
  -isr, --ignore_system_user
                        Ignore the 'system user' (default: False)
  --debug               Provide debug output. (default: False)
  -o ORDER_BY, --order_by ORDER_BY
                        Order the results by a particular column: "user", "db
                        asc", "db desc", "time desc"...etc (default: None)
  -T, --trim_info       Trim the info field (the query) to 1000 (default:
                        False)
  -v, --version         Show the installed program version and quit. (default:
                        False)
  --slack               Send a notification to slack anytime we kill a query.
                        Slack Auth/Config file must exist @ ~/.slack_auth
                        (default: False)

Kill Options:
  --kill                Kill the queries that we find. (default: False)
  -kt KILL_THRESHOLD, --kill_threshold KILL_THRESHOLD
                        The kill threshold. If a number is provided, we'll
                        need to hit that many total connections before killing
                        queries. You can set this to 'off' as well, which
                        kills queries no matter how many connections there
                        are. (default: 100)
  -ka, --kill_all       If this flag is provided, we'll attempt to kill
                        everything, not only select queries. Use with
                        caution! (default: False)
  -ky, --kill_yes       If this is provided we won't stop to ask if you are
                        sure that you want to kill queries. (default: False)
  -kl KILL_LOG, --kill_log KILL_LOG
                        Where to log killed queries to, granting permissions
                        to write to this file. (default:
                        /var/log/killed_queries.log)
  -klo, --kill_log_only
                        Only log the queries that would be killed, do not
                        actually kill them (default: False)

Contributing

Suggestions and contributions are welcome. Please fork me and create PRs back to the develop branch.

Metadata

Release files for mypsl 0.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mypsl 0.32
File Size Uploaded
mypsl-0.32.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mypsl 0.32
File Interpreter ABI Platform
mypsl-0.32-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 33.1 kB

Release files / mypsl-0.32.tar.gz

Download URL mypsl-0.32.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
28c56266536ebbb806ea09830f9215a5e9a1d4a37b5604570beba794019ca562
BLAKE2b-256 checksum
How to use checksums
bfe4cfe6738ee946ba77bca24fd009c8edf7ea73027734a50cd28ad88bbe3001
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

Release files / mypsl-0.32-py2.py3-none-any.whl

Download URL mypsl-0.32-py2.py3-none-any.whl
Size 18.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6b399ce77b5613465134ff6e822448d1229cdb489428826f4c89b7212fa9a258
BLAKE2b-256 checksum
How to use checksums
a7a61190938a9c134ea210473cfa677ce7901672fead36f776fac1a45697af67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16

Release history Release notifications | RSS feed

This release

0.32 This release

2 release files

0.31

2 release files

0.30

2 release files

0.29

2 release files

0.28

2 release files

0.27

2 release files

0.26

2 release files

0.25

2 release files

0.24

2 release files

0.23

2 release files

0.22

2 release files

0.20

2 release files

0.19

2 release files

0.18

2 release files

0.17

2 release files

0.16

2 release files

0.15

2 release files

0.14

2 release files

0.13

1 release file

0.12

1 release file

0.11

2 release files

0.10

2 release files

0.9

2 release files

0.8

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page