Remotely monitoring MySql databases with Mytop and Terminator

21 10 2008

When finding yourself maintaining Mysql servers within a cluster, network, or even further spread out, it becomes very handy, for monitoring purposes, to take a peak at the activities of Mysql.

A very useful little tool that helps doing this, is MyTop

mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL 3.22.x, 3.23.x, and 4.x server. It runs on most Unix systems (including Mac OS X) which have Perl, DBI, and Term::ReadKey installed. And with Term::ANSIColor installed you even get color. If you install Time::HiRes, you’ll get good real-time queries/second stats. As of version 0.7, it even runs on Windows (somewhat).

The source can be found on the official page. For ubuntu, the package is in the repositories, and this is the case we’ll be talking about.

sudo apt-get install mytop

After the installation, in your home folder you will be able to find the configuration file.
To set a few predefined parameters we can edit this file.

gedit ~/.mytop

For example, my configuration file looks like this:

user=sid
pass=********
host=xxx.xxx.xxx.xxx
delay=5
port=3306
socket=
batchmode=0
header=1
color=1
idle=1

where of course ***** is replaced with your password.
These parameters defined in the file will be the default ones if you start mytop from the command line with no options. Alternatively, all of the above can be overriden.

-u username
-p password
-h host
-d database

and so on. for more details take a look at the mytop man page.

Another thing to be kept in mind is that, if you’re going to check a machine other than localhost you need to have the correct permissions in my Mysql user table to do that.

In combination with this, there’s another nifty piece of software called Terminator.

Terminator, multiple terminals in one window. The goal of this project is to produce a useful tool for arranging terminals. It is inspired by programs such as gnome-multi-term, quadkonsole, etc. in that the main focus is arranging terminals in grids (tabs is the most common default method, which Terminator also supports).

So basically what Terminator does , is split your normal gnome-terminal window in as many sections as you wish, the way you wish, dropping you into the command line into each one of them.

The output :

About these ads

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

%d bloggers like this: