Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 3306 instead of MYSQL_PORT in the check_mysql plugins #338

Closed
wants to merge 3 commits into from
Closed

Use 3306 instead of MYSQL_PORT in the check_mysql plugins #338

wants to merge 3 commits into from

Conversation

orlitzky
Copy link
Contributor

This fixes compilation with newer versions MySQL/MariaDB that don't define MYSQL_PORT. The individual commit message explains.

The MYSQL_PORT constant used to be defined in mysql.h, and was used as
the default port in the two plugins check_mysql and check_mysql_query.
Now that mysql.h no longer defines that constant, our plugins fail to
build against newer versions of MySQL and MariaDB.

Since MYSQL_PORT used the "default port" on the local system, it
actually was not the best choice as the default for the check plugins:
when monitoring remote MySQL servers, the usual default of 3306 is
more likely to be correct than whatever the local server happens to be
listening on.

As a result, we fix the issue by defining our own constant, called
CHECK_PORT_DEFAULT, as "3306" at the top of both check_mysql.c and
check_mysql_query.c. The existing uses of MYSQL_PORT have been changed
to use the new CHECK_PORT_DEFAULT.

This change is backwards-incompatible: any users who compiled in a
MYSQL_PORT other than 3306 and who were running their checks on the
same server as the database will now need to specify that port
explicitly.

Closes: #288
@hedenface
Copy link
Contributor

I believe this was fixed in #340

Can you verify?

@orlitzky
Copy link
Contributor Author

orlitzky commented Jul 6, 2018

I think it's a tiny bit simpler to use a different constant name (e.g. CHECK_PORT_DEFAULT) rather than MYSQL_PORT, because then you don't need to worry about which version of MariaDB is installed. But either one should get the job done.

@orlitzky orlitzky closed this Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants