SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL Process Management Idea

    As was mentioned in another thread, there doesn't appear to be a clear cut program for the analysis of the SHOW PROCESSLIST command. I had an idea for a python (I sort of like python so I was considering doing it in python, thought about PHP too) script which would:

    1. Connect to the database using a given set of credentials
    2. Attempt to use the SHOW PROCESSLIST command
      • Check if there is an error and identify if it is due to a faulty server or permissions, customize the return error depending on which of these it is
    3. Check on the time and produce "warning levels" based on certain time ranges
    4. A logical branch should occur on the state of the query, customizing the analytics message to the combination of time and state
    5. If the info tag contains SQL, output that as well so the full statement is show, I'm also considering the possibility of a pretty printer for SQL
    6. At the end, there would be an option to kill processes, be it single or a comma deliminated list


    The polling of information would be a configurable variable (most likely as a command line option), with the default planned for 10 seconds. Due to the dangers of what could be done with such a program, I'm considering leaving the option of saved passwords / command line option based passwords out, in essence forcing people to be sure they're doing the right thing. However, this is not the case with all people, so I'd be open to simply making it a command line option.

    For the interface, I've contemplated using ncurses to provide a bit of a "graphical" feel for the user interface, while still being usable to those remotely accessing from ssh, or using a command line terminal in general.

    If someone knows of a freely available piece of software that does this, let me know so I'm not re-inventing the wheel . Also please feel free to pass on any suggestions on how to improve the functionality.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Been using this for years:
    http://jeremy.zawodny.com/mysql/mytop/

    Shows the process list with a set refresh interval. Takes most of the same command line switches as mysql for providing login, password, hostname, etc. Includes statistics such as uptime and queries per second. Can explain and kill threads.

  3. #3
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    Been using this for years:
    http://jeremy.zawodny.com/mysql/mytop/

    Shows the process list with a set refresh interval. Takes most of the same command line switches as mysql for providing login, password, hostname, etc. Includes statistics such as uptime and queries per second. Can explain and kill threads.
    Ah, this seems to do what I was talking about. Might take a look and see if I can add anything on (once I re-establish my perl-fu ). Must admit, I wasn't expecting anything as straightforward as MySQL and top... oh well, over analysis happens


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •