Files
cacti/scripts/ss_sql.php
T
Larry Adams 5de32d6470 a script server version of the sql.php
git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/trunk/cacti@1997 860744bd-22fc-0310-8c96-e9fe5004b5ca
2004-08-24 01:49:42 +00:00

36 lines
1005 B
PHP

<?php
$no_http_headers = true;
/* display ALL errors */
error_reporting(E_ALL);
include_once(dirname(__FILE__) . "/../include/config.php");
include_once(dirname(__FILE__) . "/../lib/snmp.php");
if (!isset($called_by_script_server)) {
print call_user_func("ss_sql");
}
function ss_sql() {
global $database_username;
global $database_password;
global $database_hostname;
if ($database_password != "") {
$result = `mysqladmin --host=$database_hostname --user=$database_username --password=$database_password status`;
}else{
$result = `mysqladmin --host=$database_hostname --user=$database_username status`;
}
$result = ereg_replace(": ", ":", $result);
$result = ereg_replace(" ", " ", $result);
$result = ereg_replace("Slow queries", "SlowQueries", $result);
$result = ereg_replace("Open tables", "OpenTables", $result);
$result = ereg_replace("Queries per second avg", "QPS", $result);
$result = ereg_replace("Flush tables", "FlushTables", $result);
return trim($result);
}
?>