Updated MySQL OSMetrics PluginsIt has been some time since I have posted updates to my plugins.  After the initial version, I decided to split the plugins into categories of metrics.  This will allow users to choose whether they want to install all of the plugins or only select ones they care about.

Since the installation process is unfamiliar to many users, I also expanded the instructions to make it a little easier to follow.  Moreover, I added a Makefile.

I have also reformatted the output of some plugins to be either horizontal or vertical in orientation.  There is still more work to do in this area as well.

Where to Get The MySQL Plugins

You can get the plugins from GitHub at https://github.com/toritejutsu/osmetrics but they will have to be compiled from source.  As mentioned above, you can choose whether to install all of them or one by one.  If you have an interest, feel free to contribute to the code as it would make them much more useful to get more input and actual usage.

What Are The Plugins?

These are a collection of MySQL plugins for displaying Operating System metrics in INFORMATION_SCHEMA. This would allow monitoring tools, such as Percona Monitoring and Management (PMM), to retrieve these values remotely via the MySQL interface.

Values are pulled via standard C library calls and some are read from the /proc filesystem so overhead is absolutely minimal. I added a couple of libraries originally to show that even Windows and other variants of UNIX can be utilized, but commented them out to keep it all simple for now.

Many variables were added to show what was possible. Some of these may not be of interest. I just wanted to see what kind of stuff was possible and would tweak these over time.

Also, none of the calculations were rounded. This was done just to keep precision for the graphing of values but could easily be changed later. If there is interest, this could be expanded to add more metrics and unnecessary ones removed. Just looking for feedback.

Keep in mind that my C programming skills are rusty and I am sure the code could be cleaned up.

Make sure you have the source code for MySQL and have done a cmake on it. This will be necessary to compile the plugin as well as some SQL install scripts.

Preparing The Environment

Below is the way that I compiled the plugin. You will obviously need to make changes to match your environment. You will also need to have the Percona Server for MySQL source code on your server:

Uncompress the file and go into the directory:

I also had to add a few utilities:

Compiling The Plugins

First, you will need to put the plugin code in the plugin directory of the source code you downloaded. For me, this was “/home/ec2-user/percona-server-5.7.17-13/plugin” and I named the directory “osmetrics”. Of course, you can just do a “git” to retrieve this to your server or download it as a zip file and decompress it. Just make sure it is placed into the “plugin” directory of the source code as noted above.

Next, you will need to know where your MySQL plugin directory is located. You can query that with the following SQL:

You will then need to edit the Makefile and define this path there. Once that is complete, you can compile the plugins:

Installing The Plugins

Finally, you can log in to MySQL and activate the plugins:

Alternatively, you can run the install SQL script:

Verify Installation

If all went well, you should see several new plugins available. Just make sure the status is “ACTIVE.”

Querying The Plugins

Let’s look at some example output from each of the plugins below:

Uninstalling The Plugins

To uninstall the plugins, you can remove them with the following SQL commands. To completely remove them, you will need to remove them from your plugin directory.

Alternatively, you can run the uninstall SQL script:

What’s Next?

Who knows! If there is enough interest, I would be happy to expand the plugins. First, I need to do some more code cleanup and performance test them. I do not expect them to have a significant performance impact, but one never knows until you test…

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Gustavo Colombo

Hello, do you have a sheet where it is explained with more details? Because from the point “Compiling The Plugins” ahead I can’t make it work. Thanks.

TheCrackeen

Hello, I am having the same problem that Gustavo comments.

Do you have any details or contact email to know more about this configuration and to be able to use it?

Thanks