Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions conf/plugins_explain.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
$conf['plugins'] = array(

'visual_explain' => '/usr/bin/pt-visual-explain',
# percona toolkit has removed query advisor
# 'query_advisor' => '/usr/bin/pt-query-advisor',

'show_create' => true,
'show_status' => true,

'explain' => function ($sample) {
$conn = array();

if (!array_key_exists('hostname_max',$sample) or strlen($sample['hostname_max']) < 5)
{
return;
}

$pos = strpos($sample['hostname_max'], ':');
if ($pos === false)
{
$conn['port'] = 3306;
$conn['host'] = $sample['hostname_max'];
}
else
{
$parts = preg_split("/:/", $sample['hostname_max']);
$conn['host'] = $parts[0];
$conn['port'] = $parts[1];
}

$conn['db'] = 'mysql';
if ($sample['db_max'] != '')
{
$conn['db'] = $sample['db_max'];
}

$conn['user'] = 'root';
$conn['password'] = '';

return $conn;
},
);
46 changes: 4 additions & 42 deletions conf/sample.config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
require_once($datasource);
}

foreach(glob("conf/plugins_*.inc.php") as $plugin) {
require_once($plugin);
}

/**
* If you're using Anemometer with MySQL 5.6's performance schema,
* then use this datasource
Expand Down Expand Up @@ -246,48 +250,6 @@
* explain plugin, then these sections will not be displayed.
*
*/
$conf['plugins'] = array(

'visual_explain' => '/usr/bin/pt-visual-explain',
# percona toolkit has removed query advisor
# 'query_advisor' => '/usr/bin/pt-query-advisor',

'show_create' => true,
'show_status' => true,

'explain' => function ($sample) {
$conn = array();

if (!array_key_exists('hostname_max',$sample) or strlen($sample['hostname_max']) < 5)
{
return;
}

$pos = strpos($sample['hostname_max'], ':');
if ($pos === false)
{
$conn['port'] = 3306;
$conn['host'] = $sample['hostname_max'];
}
else
{
$parts = preg_split("/:/", $sample['hostname_max']);
$conn['host'] = $parts[0];
$conn['port'] = $parts[1];
}

$conn['db'] = 'mysql';
if ($sample['db_max'] != '')
{
$conn['db'] = $sample['db_max'];
}

$conn['user'] = 'root';
$conn['password'] = '';

return $conn;
},
);

/**
* This is configuration information for how the actual sql queries are built
Expand Down