Showing entries 61 to 70 of 82
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: Scripts (reset)
mycheckpoint rev. 76: OS monitoring, auto deploy, brief HTML and 24/7 reports

Revision 76 of mycheckpoint comes with quite a few improvements, including:

  • OS monitoring (CPU, load average, memory)
  • Auto-deploy
  • Improved charting
  • Brief HTML reports
  • 24/7 charts

OS Monitoring

When monitoring the local machine, mycheckpoint now monitors CPU utilization, load average, memory and swap space.

This only applies to the Linux operating system; there is currently no plan to work this out for other operating systems.


mysql> SELECT os_cpu_utilization_percent FROM sv_report_chart_sample;

mysql> SELECT ts, os_loadavg FROM mycheckpoint.sv_report_sample;
| 2009-12-27 11:45:01 |       1.78 |
| 2009-12-27 11:50:01 |       2.48 |
| …
[Read more]
sar-sql New Alpha Release

I just uploaded a new tarball for sar-sql containing a few bug fixes, overall code improvements. I also added options to get a partial snapshot of SHOW SLAVE STATUS and SHOW MASTER STATUS. I chose only a few columns to avoid over complicating the project.

I plan one more round of heavy code changes, but no new features until I can stabilize the code enough to release it as beta.

Feel free to visit the project page in Launchpad to comment on the Blueprints, report new bugs and participate through the Answers section.

Thank you very much to Patrick Galbraith who provided some ideas on the best way to solve some of the coding issues.

Enjoy the …

[Read more]
On restoring a single table from mysqldump

Following Restore one table from an ALL database dump and Restore a Single Table From mysqldump, I would like to add my own thoughts and comments on the subject.

I also wish to note performance issues with the two suggested solutions, and offer improvements.

Problem relevance

While the problem is interesting, I just want to note that it is relevant in very specific database dimensions. Too small – and it doesn’t matter how you solve it (e.g. just open vi/emacs and copy+paste). Too big – and it would not be worthwhile to restore from mysqldump anyway. I would suggest that the problem is interesting in the whereabouts of a few dozen GB worth of data.

Problem recap

Given a dump …

[Read more]
My MySQL Tool Chest

Every time I need to install or reconfigure a new workstation, I review the set of tools I use. It's an opportunity to refresh the list, reconsider the usefulness of old tools and review new ones. During my first week at Open Market I got one of these opportunities. Here is my short list of free (as in 'beer') OSS tools and why they have a place in my tool chest.
Testing Environments
Virtual Box
Of all the Virtual Machines out there, I consider Virtual Box to be the easiest to use. Since I first looking into it while I was still working at Sun/MySQL, this package has been improved constantly. It's a must have to stage High Availability scenarios or run tools that are not available in your OS of choice.
MySQL SandboxDid you compile MySQL from source and want to test it without affecting your current …

[Read more]
Kontrollkit – new version for download

Kontrollkit has been updated and has a new script for optimizing your database schemas. Some of the cnf files have been updated, some of the other files have had link corrections. Overall, a nice update. You can find the download here:

Monitoring Disk Space

Some time back, when a client wanted us to setup MySQL Enterprise Monitor, we were surprised to find out that disk monitoring was not available! We worked hard to come up with a solution. Eventually, we decided to setup a custom agent to monitor the disk. Below is the result of that.

While this script may not work as-is for everyone, it should at least provide a basis for such a script. This script has been modified to send an email instead of plug directly into the MySQL Enterprise Monitor. But, it hopefully will get our creative juices flowing...

# This script does a very simple test for checking disk space.
# Valcora:

CHECKDISK=`df -h | awk '{print $5}' | grep % | grep -v Use | sort -n | tail -1 | cut -d "%" -f1 -`
MAIL_SUBJECT="Daily Disk Check"

if [ "$CHECKDISK" -ge "$ALERT_VALUE" ]; then
  echo "At least one of my disks is …
[Read more]
Export All To CSV

Last night I was asked by a client to export all of the tables into CSV format. I thought no problem. Then I saw the long list of table names! They wanted every one of them in CSV format! At that point, I started thinking about making a backup and then importing them all as CSV storage engine and then I realized CSV was disabled on the sandbox server! So, I thought well, I could try MySQL Query Browser, but then I figured I would still have to do it on a table-by-table basis. That is when I decided to go the Bash script route!

This lead to the formation of the brief script you see below. It simply connects to a given database, shows the list of tables, and then dumps out the contents in CSV format to individual files named tablename.csv in the current directory. After just a few minutes of scripting, it was all over and I had a handy little script for the next time they or another client ask for the same thing!

[Read more]
Converting Storage Engine

Have you ever been asked to convert all of the tables in a given database or on a server to a new storage engine? Well, we have! Sometimes, if it is only a few tables, firing off a few "ALTER TABLE ... ENGINE=InnoDB;" is fine. Other times, it is a nightmare if there are lots of tables and/or databases.

To make our life easier in such times, we created the following Bash script. Save the file as something like "" and make sure to make it executable. You can do this in Linux by executing "chmod a+x ./" Take a look at the code and we will give you an example of how to run it!

# Crawl through all of the tables in a database or databases and convert all tables to a given storage engine.
# Valcora:

#### Begin Configuration ####
DBNAMES="mydb1 mydb2"           # Separate list of Databases by spaces
NEW_ENGINE_TYPE="InnoDB"        # Storage engine to …
[Read more]
Finding All MyISAM Tables

Below is a small Bash script to crawl through all the tables in a MySQL database and look for any and all MyISAM tables. We developed this script when we realized that a team of developers were ignoring our requests to create all tables as InnoDB. We set the default storage engine to be InnoDB, however, the team would declare the Storage Enginge to be MyISAM which caused MySQL to ignore our default declaration.

Yes, we could run a "SHOW TABLE STATUS," but that would require staring at a lot of table entries in some databases. Naturally, we could also query the Information Schema database as well. All of those methods are fine. For our purposes, we wanted a fairly simple script that would do the scanning for us lazy types and yet work on pretty well all versions of MySQL.

To solve the problem, we developed this simple script to find any and all tables that were MyISAM format. With that in mind, all of the values are …

[Read more]
DBA Scripts

Over the years the DBA's have created simple Bash and PHP scripts to make their life easier. We feel that sharing these with the MySQL community may help our fellow database administrators and make their life a little easier from time to time!

With that in mind, we will periodically post a new script that we hope will be of some value. Some of the scripts are meant to perform regular maintenance activity, routine tasks, and/or query the database schema for certain table types, and such.

Some of the scripts may work as-is, while others may need to be modified to suit your needs. Either way, it should provide a starting point for accomplishing your work.

Naturally, we can make no guarantees as to the effectiveness of these scripts. It should go without saying that you need to always test them on a non-critical server before you attempt to run them in a critical production environment. While, we believe our …

[Read more]
Showing entries 61 to 70 of 82
« 10 Newer Entries | 10 Older Entries »