diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 823987f448..26068d2463 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2009-05-01 Sancho Lerena + + * extensions/dbmanager*: New extensions to interface with Pandora database + using native SQL syntax. Only for administrator (Godmode extension). + 2009-04-30 Jorge Gonzalez * pandoradb_data.sql: Fixed wrong ';' values from my last commit. @@ -27,6 +32,7 @@ * godmode/agentes/planned_downtime.php: modified a i18n string. +>>>>>>> .r1669 2009-04-24 Esteban Sánchez * godmode/agentes/module_manager.php: Added extra parameter to diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php new file mode 100644 index 0000000000..744fca532f --- /dev/null +++ b/pandora_console/extensions/dbmanager.php @@ -0,0 +1,87 @@ +'; + + $sqlcode = get_parameter ("sqlcode", ""); + + echo "

Database Interface

"; + echo "

This is an advanced extension to interface with Pandora FMS database directly from WEB console using native SQL sentences. Please note that you can damage your Pandora FMS installation if you don't know exactly what are you doing, this means that you can severily damage your setup using this extension. This extension is intended to be used only by experienced users with a depth knowledgue of Pandora FMS internals.

"; + + echo "
"; + echo "Some samples of usage:
SHOW STATUS;
DESCRIBE tagente
SELECT * FROM tserver
UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'
"; + + + echo "

"; + echo "
"; + echo ""; + echo "

"; + print_submit_button ('SQL Exec'); + //echo ""; + echo "
"; + + // Processing SQL Code + if ($sqlcode != ""){ + echo "
"; + echo "
"; + echo "Result: ".$result; + } + else { + $header = ""; + $header_printed = 0; + echo ''; + foreach ($result as $item => $value){ + $data = ""; + foreach ($value as $row => $value2){ + if ($header_printed ==0) + if (!is_numeric($row)) + $header .= ""; + $header_printed = 1; + } + echo $data; + echo ""; + } + echo "
" . $row; + if (!is_numeric($row)){ + $data .= "" . $value2; + } + } + if ($header_printed == 0){ + echo $header; + echo "
"; + } + } + +} + +/* This adds a option in the operation menu */ +add_godmode_menu_option (__('DB Interface'), 'PM'); + +/* This sets the function to be called when the extension is selected in the operation menu */ +add_extension_godmode_function ('dbmgr_extension_main'); + +?> diff --git a/pandora_console/extensions/dbmanager/dbmanager.css b/pandora_console/extensions/dbmanager/dbmanager.css new file mode 100644 index 0000000000..017f26c52d --- /dev/null +++ b/pandora_console/extensions/dbmanager/dbmanager.css @@ -0,0 +1,33 @@ +/* + Plain old table styles + written by Chris Heilmann http://wait-till-i.com +*/ +table.dbmanager,td.dbmanager,th.dbmanager{ + border:1px solid #888; + border-collapse:collapse; + margin:0; + padding:0; +} +td.dbmanager,th.dbmanager{ + padding:.2em .5em; + vertical-align:top; + font-weight:normal; + background:#fafafa; + color:#000; + font-size: 9px; +} + +th.dbmanager { + color: #fff; + text-transform: uppercase; + font-size: 8px; + background: #888; +} + + +textarea.dbmanager { + min-height: 50px; + height: 50px; + width: 90%; +} +