monitoring MySQL programmatically? SNMP? - mysql

I've been asked to see if we can monitor the "health" of mysql server in some way. The proposal was that there might be snmp support (this is for version 5.0.x). I was not able to find definitive information on it - A link to a reference would be great.
The real issue is to get periodic information on the "health" or status of mysql. We could write our own process that sites and actively talks to it, then publish that to our GUI (the GUI does not talk to mysql right now).
Is there a simple mechanism that can be used, or other best practice when one has no interest in the content of mysql, but just want to know what its status is? (up, down, available, other, etc)
The gui app is java, the rest of our stuff is a mix of java and c++
I'm not looking for a third party solution - just want to know if mysql "publishes" snmp data for others to consume.

This might help: MySQL Activity Report
Didn't see that you wanted it posted to your GUI app. Though, if your app can display images, you could just load the images that MySQL AR outputs...

I think there is a SNMP agent available in MySQL Enterprise Monitor, but that is of course for the commercial version. There are also several other commercial snmp agents available.
There is a C API for MYSQL that can be used for many of the monitoring tasks that you may be interested in: mysql_ping, mysql_sqlstate, etc. Since you were mentioning that you were using C++ that may be an option.
Take a look at MySQL C API for complete documentation.
That said, there is also some status information available that you can fetch with SQL statements: 'SHOW PROCESSLIST', 'SHOW SLAVE STATUS', etc.
Documentation about this you can find at SHOW Syntax

Related

Database Version Control on Cloud

I am currently looking for a version control tool for MySQL DB which is cloud hosted. The new application/tools needs to be cloud hosted as well.
I am interested in something which is free or have nominal charges. I looked over the internet but could not find a satisfactory solution. My requirement is very simple with the tools i.e. it should just capture all the changes to the DB and if required I can switch over back to the previous state of the DB.
Can you please advise some options which i can explore.
Thanks
There are a couple of tasks/tools you need to implement to consider the minimal DB version control support.
Source Control Repository - tool to physically keep track of changes made to files (i.e. git, SVN, TFS, etc.). Git is free.
Extract a representation of the DB - the DB needs to be represented in some kind of file format in order to be version controlled. It is not recommended that the database files themselves be version controlled, nor is it recommended to take backups of the db and storing those. You'll want to store the DB in a semantic representation, such as .sql file(s). There are a couple free tools that can be used (i.e. mysqldump, HeidiSQL). I like using HeidiSQL as it has a feature that allows you to selectively create dump scripts. These script can be stored in the version control system.
If you are looking at automation, you'll want to consider implementing a build server tool like Jenkins. Jenkins can be configured to poll a git repository and then execute build scripts (created by you) if it notices a change.
Some of my answer is subjective and I have glossed-over several intricacies of DB Version Control. You can research more questions about DB Version Control that have some pretty good answers and direction to well-written blog posts. There are also a plethora of paid tools out there that give significant DB Version Control functionality. To name a few, there's Red Gate, DBMaestro, Liquibase, RoundhousE, MySQL Workbench, and others.
I hope this helps.

iOS and Mac OSX communicating with MySQL database

I have a client who wants a control panel for the app I am developing them. The control panel is a Mac OSX application that allows the user to submit files (excel docs and such) to my MySQL database. Those files are then checked by the iOS app I have created for them.
I have no idea how to do this. I have the MySQL database all set up, and I have looked everywhere for a solution. Any help is appreciated.
I wouldn't try to connect to your MySQL database directly from your cell phone. It's a bad design for several reasons. Instead build a API on the same server as the MySQL database. It doesn't matter if you do it in java, php, c# or anything else. You might even find some product or open source project that can do this automatically. I've listed some benefits of doing it this way
It makes testing easier. You can write a test framework against your API that doesn't rely on or is using a phone.
It makes development faster. You don't need to emulate or use a phone to develop and test your table design and queries.
It gives you compatibility. When you need to change your database (and you do) you can create new APIs that the new version of the app uses while and old version still out there can continue to use the old API (that you might have to modify to still provide the same functionallity)
It gives you flexibility. If your user base grows and you might need to have replication for reads or sharded databases you build that into the API instead of into the app which is just a better way to do it.
One option would be to use PHP to handle all the database interaction.
Host the scripts on the server and just have the apps call them and get the scripts to return some sort of parseable response (I'd go for JSON).
I have never found a suitable Object-C based connector for MySQL. At this point I would suggest using a C/C++ connector. There's lots of examples of how to configure the connector for both C and C++. The hard part will be all of the data passed from the MySQL code and the Object-C code will that it will have to be in C types.
EDIT: An Example

Interface between CardDav server and MySQL database

My web app uses mysql to store contact data. I'd like to sync this data via carddav with mobile devices. I understand carddav is based on a file system, not a database. What software is available to act as an interface or wrapper to make the carddav server work with mysql? or other relational database?
You might want to take a look at Bedework.
Baikal just added this feature!!!
Most dav servers are file system based. If you use SabreDav you can build a virtual filesystem based on your own backend. Baikal is a project that uses sabredav, and a virtual file system. Until recently it stored its data in sqllite. Now it supports both mysql and sqlite.
Its still not 100% mature, but its a great starting point. Playing around with it, I have been able to create contacts directly in the DB (by uploading vcard blobs to a table) and then having them show on my ipad addressbook.
After evaluating many systems, ones built on sabredav like baikal tend to be the simplest to build on. Fruxx is something else you may also check out. Its a hosted system, but will soon have an api.
Last if you are looking for a very elaborate system, then take a look at tine20. It supports activesync (illegally in the usa), carddav, caldav, and has a decent extjs web ui. It natively stores contact information in its mysql store, which is nice since you can update a contact through a sql statement without having to build a vcf file. Where tine doesnt make sense is that it uses a bit more resources because of all the features it offers, and the complexity has ensured that it has a VERY complicated database schema. In other words, you are probably better off creating a rest api on the tine source code rather than doing bare sql inserts.
http://baikal-server.com/

Why doesn't MySQL include a decent migration tool anymore?

MySQL used to have a Migration Toolkit, to make it easier to import from SQL Server and get started with MySQL as a production platform. That has been discontinued as a product. We were promised that an equivalent product would be added to the newer MySQL Workbench, but that has not happened.
It strikes me as a bizarre business decision, by the MySQL team, to put an extra barrier in the way of people who are considering moving from an MS-stack to a LAMP-stack.
Yes, migration toolkit was awesome.
But still they support the import/export in mysql workbench.
Checkout here:
http://dev.mysql.com/doc/workbench/en/wb-server-administration-manage-data-import-export.html
That seems like a strange move indeed...
You will find several tools suggested under "Migration Tools" here: dev.mysql.com/tech-resources/articles/migrating-from-microsoft.html.
You can migrate Data from MSSQL using PHPMyAdmin Web Interface!
Check here!
To install it on your LAMP-Stack (if you don't have it already), type this on server:
sudo apt-get install phpmyadmin
and Voilá!
:)
Latest MySQL moves look like the typical management decisions based upon marketing rather than actual software capabilities. The company has been through several owners in a few years and the last one, Oracle, has a strong will to make money out of it. (They are even making money out of Sun Microsystems!) MySQL used to have a bunch of poorly maintained GUI tools with a widely variable quality level. That's okay for most users but it scares away companies, which are the type of users that are willing to pay. Creating a single suite out of it looks like an intelligent move in the long term but they probably lack resources to speed up things and they want results now.
Right now, you can still find the old tools if you dig into the archives section from the download page. You'd better grab your copy before they change their mind. ;-)

Best way to update products

Some background:
We provide a complex system consisting of a large database and several programs - most written in C#, however some legacy applications are still running on MFC.
Most of the stuff we provide runs on a single server (runs SQL server and SQL Management studio 2005), however several applications can run on a number of client's computers. Updating this is a real pain, since after we update the database the outdated software is likely to break due to database changes. Updating the server software manually is one thing, however making sure all the client software works too is practically impossible, and will only get worse with time.
I am to write an updating service, which will be able to update the whole product - update the database, reinstall services and applications. (However only the programs / files /tables / etc that are actually modified should be updated. Downloading the whole product each time there is a update available is not an option. Also, some computers may only have a subset of avaliable programs installed)
First of all is there a already a good way of doing this? If there is something similar to ClickOnce that would also be able to update databases already out there I'd much rather use that.
If not, what are the best practices when it comes to updating? All and any material will be greatly appreciated.
I will need some updates to be installed on the server ASAP after the updates have been submitted, without any user input. That includes a windows service (that is running at all times) and any database changes. After these changes have been made, I will have to prevent any software that is not up to date from either accessing the parts that have been changed, or from running at all.
Any advice will be greatly appreciated - If I do have to write a system like that, I'd like to do it right.
Best practice would be to package the app up in an MSI and use Group Policy to push the updates out to each client.
If that's not possible then you need some way of informing the client app that it is out-of-date (simple check against a server holding the current version number would probably suffice) and refuse to work until an update patch is downloaded and installed - you could even launch this process from inside the app itself.
This answer may help you, I haven't personally used Wix but this seems to be along the lines of what you're looking for. Make sure to check out Lesson 4 in the linked tutorial, as this provides the details you would require.
I'm not sure where you would find best practices when it comes to updating, but in my personal opinion you shouldn't ever force a user to update unless it breaks the underlying application (like yours does). I would be very interested to hear if someone has a link to a list of best practices on this topic.
Edit
I was interested in possible best practices for updating so I started another question thread here. The general consensus in the answers is "Ask the user/client", but there may be some other details in the answers which may help you, I'm afraid I can't find any actual hard rules on the subject anywhere (which I was expecting).