08 Jul

Monitoring Galera cluster using Percona Nagios plugins on Debian

1. Download the repository packages:

wget https://repo.percona.com/apt/percona-release_0.1-3.$(lsb_release -sc)_all.deb

2. Install it:

dpkg -i percona-release_0.1-3.$(lsb_release -sc)_all.deb

3. Update the packages list:

apt-get update

4. Install

apt-get install percona-nagios-plugins

5. Grant the privileges:

GRANT USAGE, SELECT, REPLICATION CLIENT on *.* to 'test'@'localhost' IDENTIFIED BY 'password';

6. Test:

/usr/lib64/nagios/plugins/pmp-check-mysql-status -x wsrep_cluster_status -C == -T str -c non-Primary -l test -p password
21 Jan

How to get and debug WordPress SQL queries

WordPress provides handy way to get all queries and to debug them easily.

To enable queries collecting add the following in your wp-config.php:

define('SAVEQUERIES', true);

Next should be added to your theme footer (wp-content/themes/<your_theme>/footer.php)

<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.

<?php
if (current_user_can('administrator')){
global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";
}
?>

At the end you should be able to get something like:

134 queries in 0.301 seconds.

and a bunch of SQL queries.