";
echo "
" . $label;
echo " | " . $data;
echo " | ";
echo "";
}
}
$console_mode = 1;
if (!isset($argc))
$console_mode = 0;
if ($console_mode == 1) {
echo "\nPandora FMS PHP diagnostic tool v3.2 (c) Artica ST 2009-2010 \n";
if ($argc == 1 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
echo "\nThis command line script gives information about Pandora FMS database.
This program only can be executed from console, and need a parameter, the
full path to Pandora FMS 'config.php' file.
Usage:
php pandora_diag.php path_to_pandora_console
Example:
php pandora_diag.php /var/www/pandora_console
";
exit;
}
if (preg_match ('/[^a-zA-Z0-9_\/\.]|(\/\/)|(\.\.)/', $argv[1])) {
echo "Invalid path: $argv[1]. Always use absolute paths.";
exit;
}
include $argv[1]."/include/config.php";
}
else {
if (file_exists("../include/config.php"))
include "../include/config.php";
global $config;
// Not from console, this is a web session
if ((!isset($config["id_user"])) OR (!check_acl ($config["id_user"], 0, "PM"))) {
echo "You don't have privileges to use diagnostic tool
";
echo "Please login with an administrator account before try to use this tool
";
exit;
}
// Header
ui_print_page_header (__('Pandora FMS Diagnostic tool'), "", false, "", true);
echo "";
echo "".__("Item")." | ";
echo "".__("Data value")." |
";
}
render_row ($build_version, "Pandora FMS Build");
render_row ($pandora_version, "Pandora FMS Version");
render_row ($config["homedir"], "Homedir");
render_row ($config["homeurl"], "HomeUrl");
render_row (phpversion(), "PHP Version");
render_info ("tagente");
render_info ("tagent_access");
render_info ("tagente_datos");
render_info ("tagente_datos_string");
render_info ("tagente_estado");
render_info ("tagente_modulo");
render_info ("talert_actions");
render_info ("talert_commands");
render_info ("talert_template_modules");
render_info ("tevento");
render_info ("tlayout");
if($config['enterprise_installed'])
render_info ("tlocal_component");
render_info ("tserver");
render_info ("treport");
render_info ("ttrap");
render_info ("tusuario");
render_info ("tsesion");
switch ($config["dbtype"]) {
case "mysql":
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'enterprise_installed'", "Enterprise installed");
render_row ( date ("Y/m/d H:i:s",
db_get_sql ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_maintance'")), "PandoraDB Last run");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'customer_key';", "Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE `key` = 'current_update'", "Current Update #");
break;
case "postgresql":
render_info_data ("SELECT \"value\"
FROM tconfig
WHERE \"token\" = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT \"value\"
FROM tconfig
WHERE \"token\" = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT \"value\"
FROM tconfig
WHERE \"token\" = 'enterprise_installed'", "Enterprise installed");
render_row ( date ("Y/m/d H:i:s",
db_get_sql ("SELECT \"value\"
FROM tconfig WHERE \"token\" = 'db_maintance'")), "PandoraDB Last run");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE \"key\" = 'customer_key';", "Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE \"key\" = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE \"key\" = 'current_update'", "Current Update #");
break;
case "oracle":
render_info_data ("SELECT value
FROM tconfig
WHERE token = 'db_scheme_version'", "DB Schema Version");
render_info_data ("SELECT value
FROM tconfig
WHERE token = 'db_scheme_build'", "DB Schema Build");
render_info_data ("SELECT value
FROM tconfig
WHERE token = 'enterprise_installed'", "Enterprise installed");
render_row (db_get_sql ("SELECT value
FROM tconfig
WHERE token = 'db_maintance'"), "PandoraDB Last run");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE key = 'customer_key'", "Update Key");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE key = 'updating_code_path'", "Updating code path");
render_info_data ("SELECT value
FROM tupdate_settings
WHERE key = 'current_update'", "Current Update #");
break;
}
if ($console_mode == 0) {
echo "
";
}
?>