mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
2009-05-01 Sancho Lerena <slerena@artica.es>
* extensions/dbmanager*: New extensions to interface with Pandora database using native SQL syntax. Only for administrator (Godmode extension). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1670 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
94e88913fb
commit
be912e000e
@ -1,3 +1,8 @@
|
|||||||
|
2009-05-01 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
|
* extensions/dbmanager*: New extensions to interface with Pandora database
|
||||||
|
using native SQL syntax. Only for administrator (Godmode extension).
|
||||||
|
|
||||||
2009-04-30 Jorge Gonzalez <jorgegonz@artica.es>
|
2009-04-30 Jorge Gonzalez <jorgegonz@artica.es>
|
||||||
|
|
||||||
* pandoradb_data.sql: Fixed wrong ';' values from my last commit.
|
* pandoradb_data.sql: Fixed wrong ';' values from my last commit.
|
||||||
@ -27,6 +32,7 @@
|
|||||||
|
|
||||||
* godmode/agentes/planned_downtime.php: modified a i18n string.
|
* godmode/agentes/planned_downtime.php: modified a i18n string.
|
||||||
|
|
||||||
|
>>>>>>> .r1669
|
||||||
2009-04-24 Esteban Sánchez <estebans@artica.es>
|
2009-04-24 Esteban Sánchez <estebans@artica.es>
|
||||||
|
|
||||||
* godmode/agentes/module_manager.php: Added extra parameter to
|
* godmode/agentes/module_manager.php: Added extra parameter to
|
||||||
|
87
pandora_console/extensions/dbmanager.php
Normal file
87
pandora_console/extensions/dbmanager.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Pandora FMS - the Flexible Monitoring System
|
||||||
|
// ============================================
|
||||||
|
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||||
|
// Please see http://pandora.sourceforge.net for full contribution list
|
||||||
|
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation for version 2.
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
/* You can safely delete this file */
|
||||||
|
|
||||||
|
function dbmgr_extension_main () {
|
||||||
|
|
||||||
|
echo '<link rel="stylesheet" href="extensions/dbmanager/dbmanager.css" type="text/css" />';
|
||||||
|
|
||||||
|
$sqlcode = get_parameter ("sqlcode", "");
|
||||||
|
|
||||||
|
echo "<h1>Database Interface</h1>";
|
||||||
|
echo "<p>This is an advanced extension to interface with Pandora FMS database directly from WEB console using native SQL sentences. Please note that <b>you can damage</b> your Pandora FMS installation if you don't know </b>exactly</b> what are you doing, this means that you can severily damage your setup using this extension. This extension is intended to be used <b>only by experienced users</b> with a depth knowledgue of Pandora FMS internals.</p>";
|
||||||
|
|
||||||
|
echo "<br>";
|
||||||
|
echo "Some samples of usage: <i><blockquote>SHOW STATUS;<br>DESCRIBE tagente<br>SELECT * FROM tserver<br>UPDATE tagente SET id_grupo = 15 WHERE nombre LIKE '%194.179%'</blockquote></i>";
|
||||||
|
|
||||||
|
|
||||||
|
echo "<br><br>";
|
||||||
|
echo "<form method='post' action=''>";
|
||||||
|
echo "<textarea class='dbmanager' name='sqlcode'>";
|
||||||
|
echo $sqlcode;
|
||||||
|
echo "</textarea>";
|
||||||
|
echo "<br><br>";
|
||||||
|
print_submit_button ('SQL Exec');
|
||||||
|
//echo "<input type='submit' class='next' value='SQL Exec'>";
|
||||||
|
echo "</form>";
|
||||||
|
|
||||||
|
// Processing SQL Code
|
||||||
|
if ($sqlcode != ""){
|
||||||
|
echo "<br>";
|
||||||
|
echo "<hr>";
|
||||||
|
echo "<br";
|
||||||
|
$result = process_sql ($sqlcode);
|
||||||
|
if (!is_array($result)){
|
||||||
|
echo "<b>Result: <b>".$result;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$header = "";
|
||||||
|
$header_printed = 0;
|
||||||
|
echo '<table width=90% class="dbmanager">';
|
||||||
|
foreach ($result as $item => $value){
|
||||||
|
$data = "";
|
||||||
|
foreach ($value as $row => $value2){
|
||||||
|
if ($header_printed ==0)
|
||||||
|
if (!is_numeric($row))
|
||||||
|
$header .= "<th class='dbmanager'>" . $row;
|
||||||
|
if (!is_numeric($row)){
|
||||||
|
$data .= "<td class='dbmanager'>" . $value2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($header_printed == 0){
|
||||||
|
echo $header;
|
||||||
|
echo "<tr class='dbmanager'>";
|
||||||
|
$header_printed = 1;
|
||||||
|
}
|
||||||
|
echo $data;
|
||||||
|
echo "<tr class='dbmanager'>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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');
|
||||||
|
|
||||||
|
?>
|
33
pandora_console/extensions/dbmanager/dbmanager.css
Normal file
33
pandora_console/extensions/dbmanager/dbmanager.css
Normal file
@ -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%;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user