You are here

function acquia_spi_get_platform_mysql_data in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.2 acquia_spi/acquia_spi.module \acquia_spi_get_platform_mysql_data()
1 call to acquia_spi_get_platform_mysql_data()
acquia_spi_get_platform in acquia_spi/acquia_spi.module
Gather platform specific information.

File

acquia_spi/acquia_spi.module, line 1302
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquia_spi_get_platform_mysql_data() {
  $res = db_query("SHOW GLOBAL STATUS");

  // what happens if we run this on mssql or postgres
  $ret = array();
  while ($row = db_fetch_array($res)) {
    if (!isset($row['Variable_name'])) {
      continue;
    }
    switch ($row['Variable_name']) {
      case 'Table_locks_waited':
        $ret['Table_locks_waited'] = $row['Value'];
        break;
      case 'Slow_queries':
        $ret['Slow_queries'] = $row['Value'];
        break;
      case 'Qcache_hits':
        $ret['Qcache_hits'] = $row['Value'];
        break;
      case 'Qcache_inserts':
        $ret['Qcache_inserts'] = $row['Value'];
        break;
      case 'Qcache_queries_in_cache':
        $ret['Qcache_queries_in_cache'] = $row['Value'];
        break;
      case 'Qcache_lowmem_prunes':
        $ret['Qcache_lowmem_prunes'] = $row['Value'];
        break;
      case 'Open_tables':
        $ret['Open_tables'] = $row['Value'];
        break;
      case 'Opened_tables':
        $ret['Opened_tables'] = $row['Value'];
        break;
      case 'Select_scan':
        $ret['Select_scan'] = $row['Value'];
        break;
      case 'Select_full_join':
        $ret['Select_full_join'] = $row['Value'];
        break;
      case 'Select_range_check':
        $ret['Select_range_check'] = $row['Value'];
        break;
      case 'Created_tmp_disk_tables':
        $ret['Created_tmp_disk_tables'] = $row['Value'];
        break;
      case 'Created_tmp_tables':
        $ret['Created_tmp_tables'] = $row['Value'];
        break;
      case 'Handler_read_rnd_next':
        $ret['Handler_read_rnd_next'] = $row['Value'];
        break;
      case 'Sort_merge_passes':
        $ret['Sort_merge_passes'] = $row['Value'];
        break;
      case 'Qcache_not_cached':
        $ret['Qcache_not_cached'] = $row['Value'];
        break;
    }
  }
  return $ret;
}