2008-10-10 Sancho Lerena <slerena@artica.es>

* ajax.php: removed carriage return from EOF.

	* index.php: Updated final version variable (YES!)

	* config_process: Updated final version variable (YES!)

	* libupdate_manager_client.php: Do not raise a notice (probably be hidden
	for user). Show error details with a simple echo.

	* footer.php: Bad reference to image, in help don't show properly fixed.

	* pandora_help.php: Fancy layout :)

	* manage_config.php: Now works fine. If target agents not defined used
	source agent. Module mass delete now works. Added help and better deletion
	of agents. Fixed bug #2157135.

	* pandora_textlogo.png: Added new icon for help header.

	* functions_db.php: Added delete_agent() used in manage_config.

	* help_alert_validation.php, help_manageconfig.php, help_planned_downtime.php:
	New help files (english only!).

	* datos_agente.php: Stupid bug that don't allow to delete string data.

	* estado_alertas.php: Added help to alert ACK button.

	* reporting_viewer.php: Added SLA legend label (limit) and fixed render of 
	invalid SLA (was swapped bad for good). Combined graphs dimensions are used
	now on reports.

	* reporting_xml.php:; Fixed a small problem that renders header after contents.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1139 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-10-10 15:08:31 +00:00
parent 0311c6284c
commit 0b8cca9718
17 changed files with 213 additions and 90 deletions

View File

@ -1,5 +1,41 @@
2008-10-10 Sancho Lerena <slerena@artica.es>
* ajax.php: removed carriage return from EOF.
* index.php: Updated final version variable (YES!)
* config_process: Updated final version variable (YES!)
* libupdate_manager_client.php: Do not raise a notice (probably be hidden
for user). Show error details with a simple echo.
* footer.php: Bad reference to image, in help don't show properly fixed.
* pandora_help.php: Fancy layout :)
* manage_config.php: Now works fine. If target agents not defined used
source agent. Module mass delete now works. Added help and better deletion
of agents. Fixed bug #2157135.
* pandora_textlogo.png: Added new icon for help header.
* functions_db.php: Added delete_agent() used in manage_config.
* help_alert_validation.php, help_manageconfig.php, help_planned_downtime.php:
New help files (english only!).
* datos_agente.php: Stupid bug that don't allow to delete string data.
* estado_alertas.php: Added help to alert ACK button.
* reporting_viewer.php: Added SLA legend label (limit) and fixed render of
invalid SLA (was swapped bad for good). Combined graphs dimensions are used
now on reports.
* reporting_xml.php:; Fixed a small problem that renders header after contents.
2008-10-09 Sancho Lerena <slerena@artica.es>
* pandoradb_data.sql: Added support for autoupdate and trap2agent
forward in tconfig.

View File

@ -41,4 +41,4 @@ if (file_exists ($page)) {
} else {
echo "<br><b class='error'>Sorry! I can't find the page $page!</b>";
}
?>
?>

View File

@ -32,11 +32,11 @@ function um_xml_rpc_client_call ($server_host, $server_path, $server_port, $prox
$result = $client->send ($msg, XMLRPC_TIMEOUT);
if (! $result) {
trigger_error ('<strong>Open Update Manager</strong> Server comunication error. '.$client->errstr);
echo '<strong>Open Update Manager</strong> Server comunication error: '.$client->errstr;
return false;
}
if ($result->faultCode ()) {
trigger_error ('<strong>Open Update Manager</strong> XML-RPC error. '.$result->faultString ());
echo '<strong>Open Update Manager</strong> XML-RPC error: '.$result->faultString ();
return false;
}

View File

@ -32,7 +32,7 @@ if ((isset($develop_bypass)) AND ($develop_bypass == 1)) {
echo ' - Saved '.format_numeric ($sql_cache["saved"]).' Queries';
}
echo '</a><br>';
echo '<a href="http://www.mozilla-europe.org/en/firefox/"><img src="images/firefox.gif" align="middle"
echo '<a href="http://www.mozilla-europe.org/en/firefox/"><img src="'.$config["homeurl"].'/images/firefox.gif" align="middle"
title="'.__('Pandora FMS console is best viewed with Firefox web browser').'" /></a>';
echo "</center>";

View File

@ -46,6 +46,9 @@ if (! $id || ! file_exists ($help_file)) {
/* Show help */
echo '<div>';
echo '<span style="float:left; margin: 0px; padding: 0px">';
echo '<img src="../images/pandora_textlogo.png" border=0>';
echo "</span>";
echo '<p style="text-align: right"><strong>'.__('Pandora FMS Help System').'</strong></p>';
echo '</div>';
echo '<hr width="100%" size="1" />';

View File

@ -17,6 +17,8 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// WARNING: Do not use generic get_parameter() functions here, because some of the
// variables passed are arrays and are not supported by these functions.
// Load global vars
require ("include/config.php");
@ -270,9 +272,13 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
// Initial checkings
// if selected more than 0 agents
$destino = $_POST["destino"];
if (isset($_POST["destino"]))
$destino = $_POST["destino"];
else
$destino = array();
if (count($destino) <= 0) {
break;
echo "<h3>" . __("Deleting source agent. No destination targets defined") . "</h3>";
$destino[0] = $origen;
}
// If selected modules or alerts
@ -283,44 +289,60 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
if (isset($_POST["alerts"]))
$alertas = 1;
else
$alertas = 0;
if (($alertas + $modulos) >= 0)
// Delete
$alertas = 0;
if (isset($_POST["origen_modulo"]))
$origen_modulo = $_POST["origen_modulo"];
else
$origen_modulo = array();
if (count($origen_modulo) <= 0)
$allmodules = 1;
else
$allmodules = 0;
for ($a=0;$a <count($destino); $a++){ // for each agent
$id_agente = $destino[$a];
if ($modulos == 1){
echo "<br>".__('Deleting data')." -> ".dame_nombre_agente($id_agente);
echo "<br>".__('Deleting data')." -> ".dame_nombre_agente($id_agente);
if ($allmodules == 1){
// Deleting data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM tagente_datos WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete2="DELETE FROM tagente_datos_inc WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete3="DELETE FROM tagente_datos_string WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result=mysql_query($sql_delete1);
$result=mysql_query($sql_delete2);
$result=mysql_query($sql_delete3);
if ($modulos == 1){
mysql_query ("DELETE FROM tagente_datos WHERE id_agente_modulo=$id_agente");
mysql_query ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo=$id_agente");
mysql_query ("DELETE FROM tagente_datos_string WHERE id_agente_modulo=$id_agente");
mysql_query ("DELETE FROM tagente_estado WHERE id_agente = $id_agente");
mysql_query ("DELETE FROM tagente_modulo WHERE id_agente = $id_agente");
}
if ($alertas == 1){
mysql_query ("DELETE FROM talerta_agente_modulo WHERE id_agent = $id_agente");
echo "DELETE talertas* where id_agente = $id_agente <br>";
}
mysql_query ("DELETE FROM tevent WHERE id_agente = $id_agente");
} else {
for ($i=0; $i < count($origen_modulo); $i++){
$source_module = $origen_modulo[$i];
$source_module_name = get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = $source_module");
$id_modulo = get_db_sql ("SELECT id_agente_modulo FROM tagente_modulo WHERE nombre = '$source_module_name' AND id_agente = $id_agente");
if ($modulos == 1){
mysql_query ("DELETE FROM tagente_datos WHERE id_agente_modulo=$id_modulo");
mysql_query ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo=$id_modulo");
mysql_query ("DELETE FROM tagente_datos_string WHERE id_agente_modulo=$id_modulo");
mysql_query ("DELETE FROM tagente_datos_string WHERE id_agente_modulo=$id_modulo");
mysql_query ("DELETE FROM tagente_estado WHERE id_agente_modulo = $id_modulo");
mysql_query ("DELETE FROM tagente_modulo WHERE id_agente_modulo = $id_modulo");
}
if ($alertas == 1){
mysql_query ("DELETE FROM talerta_agente_modulo WHERE id_agente_modulo = $id_modulo");
}
mysql_query ("DELETE FROM tevent WHERE id_agentmodule = $id_modulo");
}
// Delete conf
$sql_delete5 ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente; // delete from table tagente_modulo
$sql_delete6 ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente; // detele from table tagente_estado
$result=mysql_query($sql_delete5);
$result=mysql_query($sql_delete6);
}
// delete alerts definitions
if ($alertas == 1){
// delete data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM talerta_agente_modulo WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result = mysql_query($sql_delete1);
} // while
}//if
}// for
}//delete
}
}
// -----------
// DELETE AGENT
// -----------
elseif (isset($_POST["delete_agent"])) {
echo "<h2>".__('Delete agents')."</h2>";
// Initial checkings
@ -328,7 +350,7 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
// if selected more than 0 agents
$destino = $_POST["destino"];
if (count($destino) <= 0) {
break;
$destino[0]=$origen;
}
// Delete
@ -336,38 +358,7 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
$id_agente = $destino[$a];
echo "<br>".__('Deleting data')." -> ".dame_nombre_agente($id_agente);
// Deleting data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM tagente_datos WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete2="DELETE FROM tagente_datos_inc WHERE id_agente_modulo=".$row["id_agente_modulo"];
$sql_delete3="DELETE FROM tagente_datos_string WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result=mysql_query($sql_delete1);
$result=mysql_query($sql_delete2);
$result=mysql_query($sql_delete3);
}
// Delete conf
$sql_delete5 ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente; // delete from table tagente_modulo
$sql_delete6 ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente; // detele from table tagente_estado
$result=mysql_query($sql_delete5);
$result=mysql_query($sql_delete6);
// delete alerts definitions
// delete data
$sql1='SELECT * FROM tagente_modulo WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
while ($row=mysql_fetch_array($result1)){
$sql_delete1="DELETE FROM talerta_agente_modulo WHERE id_agente_modulo=".$row["id_agente_modulo"];
$result = mysql_query($sql_delete1);
} // while
// delete agent
$sql1='DELETE FROM tagente WHERE id_agente = '.$id_agente;
$result1=mysql_query($sql1);
delete_agent($id_agente);
}// for
}//delete
@ -377,7 +368,7 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
} else {
// title
echo '<h2>'.__('Agent configuration'). '&gt;'. __('Configuration Management').'</h2>';
echo '<h2>'.__('Agent configuration'). '&gt;'. __('Configuration Management'). '</h2>';
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/manage_config&operacion=1">';
echo "<table width='650' border='0' cellspacing='4' cellpadding='4' class='databox'>";
@ -432,7 +423,9 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
echo "</select>";
echo '<td class="datost">';
echo '<b>'.__('Copy Configuration'). '</b><br><br>';
echo '<b>'.__('Targets'). '</b> ';
pandora_help ('manageconfig');
echo '<br><br>';
echo '<table>';
echo '<tr class=datos><td>'.__('Modules');
echo '<td><input type="checkbox" name="modules" value="1" class="chk">';
@ -456,9 +449,12 @@ if ((isset($_GET["operacion"])) && ($update_agent == -1) && ($update_group == -1
// Form buttons
echo '<td align="left" class="datosb">';
echo "<br><br>";
echo '<input type="submit" name="copy" class="sub copy" value="'.__('Copy').'" onClick="if (!confirm("'.__('Are you sure?').'")) return false;>';
echo '<input type="submit" name="copy" class="sub copy" value="'.__('Copy').'" onClick="if (!confirm("'.__('Are you sure?').'")) return false;> ';
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
pandora_help ('manageconfig');
echo "<br><br>";
echo '<input type="submit" name="delete" class="sub delete" value="'. __('Delete').'" onClick="if (!confirm("'.__('Are you sure?').'")) return false;>';
echo "<br><br>";
echo '<input type="submit" name="delete_agent" class="sub delete" value="'. __('Delete Agents').'" onClick="if (!confirm("'.__('Are you sure?').'")) return false;>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -18,9 +18,9 @@
//Pandora Version
if (!isset ($build_version))
$build_version = "PC080822";
$build_version="PC081010";
if (!isset ($pandora_version))
$pandora_version = "v2.0Beta1";
$pandora_version="v2.0";
// This is directory where placed "/attachment" directory, to upload files stores.
// This MUST be writtable by http server user, and should be in pandora root.

View File

@ -2172,4 +2172,21 @@ function server_status ($id_server) {
return $serverinfo;
}
function delete_agent ($id_agente) {
/*
mysql_query ("DELETE FROM tagente_datos WHERE id_agente_modulo = $id_agente");
mysql_query ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo = $id_agente");
mysql_query ("DELETE FROM tagente_datos_string WHERE id_agente_modulo = $id_agente");
mysql_query ("DELETE FROM talerta_agente_modulo WHERE id_agent = $id_agente");
mysql_query ("DELETE FROM tevent WHERE id_agente = $id_agente");
mysql_query ("DELETE FROM tagent_access WHERE id_agent = $id_agente");
mysql_query ("DELETE FROM tplanned_downtime_agents WHERE id_agent = $id_agente");
mysql_query ("DELETE FROM tagente_estado WHERE id_agente = $id_agente");
mysql_query ("DELETE FROM tagente_modulo WHERE id_agente = $id_agente");
mysql_query ("DELETE FROM tagente WHERE id_agente = $id_agente");
mysql_query ("DELETE FROM taddress_agent WHERE id_agent = $id_agente");
*/
echo "BORRANDO AGENTE A SACO $id_agente";
}
?>

View File

@ -0,0 +1,4 @@
<h1>Alert validation</h1>
<p>
ACK an alert only changes it's current bit and clear the "fired", so if alert fired again, the process continues. It's oriented to alerts with a long threshold, for example 1 day. If you get an alarm, and you review and fix it, you probably want to set to green status and don't wait 1 day to get green again.
</p>

View File

@ -0,0 +1,48 @@
<h1>Configuration management</h1>
This tool is used to several purposes:<br><br>
<ul>
<li> Copy module and/or alert configuration from one agent to one or several destination agents.
<li> Delete module and/or alert configuration from a group of agents.
<li> Full deletion of agents selecting several at once.
</ul>
<h2> Copy module / alert configuration </h2>
<ol>
<li> Select source group and click on "filter" button.
<li> Select source agent and click on "get info" button
<li> Select one or more modules in source agent.
<li> Select destination agents for copy operation.
<li> Select targets: Module for only copy modules, Alert for only copy alerts (if destination agents don't have a module with the same name defined in source agent, tool cannot replicate alert). You could select both to first create module and after replicate alert (if defined).
<li> Click on "copy" button.
</ol>
<h2> Delete module / alert configuration </h2>
<p>
This will delete all destination modules/alerts with the same name that has been selected in source agent / modules. All alerts associated to source modules will be deleted in destination agents if they have a module with the same name and alerts associated to them.
</p>
<ol>
<li> Select source group and click on "filter" button.
<li> Select source agent and click on "get info" button
<li> Select one or more modules in source agent.
<li> Select destination agents for delete operation.
<li> Select targets: Modules, Alerts or both.
<li> Click on "delete" button.
</ol>
<h2> Delete agents</h2>
<p>
This will delete all agent information (modules, alerts, events..) from the list of agents selected in the listbox on the bottom.
</p>
<ol>
<li> Select destination agents for delete operation in the listbox on the bottom.
<li> Click on "delete agents" button.
</ol>

View File

@ -0,0 +1,8 @@
<h1>Planned downtimes</h1>
<p>
This tool is used to plan non-monitoring periods of time. This is useful if you know, for example, that a group of systems will be disconnected in a specific time. This helps to avoid false alarms.
<br><br>
It's very easy to setup, you specify start date/time of planned downtime and an end date/time. You can include in that downtime a list of agents.
<br><br>
When planned downtime starts, Pandora FMS automatically disable all agents assigned to this downtime and no alerts or data are processed. When downtime ends, Pandora FMS will be enable all agents assigned to this downtime. You cannot delete or modify a downtime definition when it's fired, you need to wait for ending before doing anything in this downtime definition. Of course you can manually, enable an agent using the agent configuration dialog.
</p>

View File

@ -20,8 +20,8 @@
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
// Pandora FMS uses Pear Image::Graph code
$build_version="PC080901";
$pandora_version="v2.0Beta1 ";
$build_version="PC081010";
$pandora_version="v2.0";
global $build_version;
global $pandora_version;

View File

@ -88,9 +88,12 @@ function datos_raw ($id_agente_modulo, $periodo) {
$color = 1;
}
echo "<tr>";
if ((give_acl ($config['id_user'], $id_group, "AW") ==1) && ($string_type == 0)) {
if (give_acl ($config['id_user'], $id_group, "AW") ==1) {
echo "<td class='".$tdcolor."' width=20>";
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=$periodo_label&id=$id_agente_modulo&delete=".$row["id_agente_datos"]."'><img src='images/cross.png' border=0>";
if ($string_type == 0)
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=$periodo_label&id=$id_agente_modulo&delete=".$row["id_agente_datos"]."'><img src='images/cross.png' border=0>";
else
echo "<a href='index.php?sec=estado&sec2=operation/agentes/datos_agente&tipo=$periodo_label&id=$id_agente_modulo&delete_text=".$row["id_agente_datos"]."'><img src='images/cross.png' border=0>";
} else {
echo "<td class='".$tdcolor."'>";
}
@ -122,11 +125,17 @@ if (isset ($_GET["tipo"]) && isset ($_GET["id"])) {
}
if (isset($_GET["delete"])) {
$delete =$_GET["delete"];
$delete = $_GET["delete"];
$sql = "DELETE FROM tagente_datos WHERE id_agente_datos = $delete";
$result = process_sql ($sql);
}
if (isset($_GET["delete_text"])) {
$delete = $_GET["delete_text"];
$sql = "DELETE FROM tagente_datos_string WHERE id_agente_datos = $delete";
$result = process_sql ($sql);
}
datos_raw ($id, $tipo);
?>

View File

@ -64,7 +64,7 @@ if (isset($_GET["id_agente"])){
<th>".__('Last fired')."</th>
<th>".__('Times Fired')."</th>
<th>".__('Status')."</th>
<th>".__('Validate')."</th></tr>";
<th>".__('Validate') ." " . pandora_help('alert_validation', true)."</th></tr>";
$color = 1;
foreach ($result as $data) {
if ($color == 1){

View File

@ -174,9 +174,13 @@ foreach ($contents as $content) {
array_push ($weights, $content2["weight"]);
}
$graph_width = get_db_sql ("SELECT width FROM tgraph WHERE id_graph = ".$content["id_gs"]);
$graph_height= get_db_sql ("SELECT height FROM tgraph WHERE id_graph = ".$content["id_gs"]);
$table->colspan[1][0] = 4;
$data = array ();
$data[0] = '<img src="reporting/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">';
$data[0] = '<img src="reporting/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height='.$graph_height.'&width='.$graph_width.'&period='.$content['period'].'&date='.$datetime.'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">';
array_push ($table->data, $data);
break;
@ -212,7 +216,8 @@ foreach ($contents as $content) {
$data[0] .= $sla['sla_max']."<br />";
$data[0] .= '<strong>'.__('SLA Min. (value)')."</strong> : ";
$data[0] .= $sla['sla_min']."<br />";
$data[0] .= '<strong>'.__('SLA Limit')."</strong> : ";
$data[0] .= $sla['sla_limit'];
$sla_value = get_agent_module_sla ($sla['id_agent_module'], $content['period'],
$sla['sla_min'], $sla['sla_max'], $datetime);
if ($sla_value === false) {
@ -233,7 +238,7 @@ foreach ($contents as $content) {
}
if (!empty ($slas)) {
$data = array ();
if ($sla_failed !== false)
if ($sla_failed == false)
$data[0] = '<span style="font: bold 3em Arial, Sans-serif; color: #000000;">'.__('Ok').'</span>';
else
$data[0] = '<span style="font: bold 3em Arial, Sans-serif; color: #ff0000;">'.__('Fail').'</span>';

View File

@ -121,7 +121,7 @@ if (! give_acl ($config['id_user'], $report['id_group'], "AR")) {
if ($report['id_user'] != $config['id_user'] && ! dame_admin ($config['id_user']) && ! $report['private']) {
return;
}
header ('Content-type: application/xml; charset="utf-8"', true);
echo '<?xml version="1.0" encoding="UTF-8" ?>';
$date = (string) get_parameter ('date', date ('Y-m-j'));
@ -288,9 +288,6 @@ foreach ($contents as $content) {
array_push ($xml["reports"], $data);
}
header ('Content-type: application/xml; charset="utf-8"',true);
function xml_array ($array) {
foreach ($array as $name => $value) {
if (is_int ($name)) {