2009-02-17 Sancho Lerena <slerena@artica.es>

* pandoradb.sql: treport_content, changed report type to string to allow
	new report types without altering DB schema. Added id_agent for supporting
	reports based on agent ids.  Tplugin new field for plugin type in order to
	support generic Nagios plugins.
	
	* pandoradb_migrate_20_to_21.sql: Updated with last changes.
	
	* module_manager_editor_common.php: Removed some ugly labels :-)
	
	* reporting_builder.php: New report (Agent detailed and grouped 
	event/alerts). Added support to add descriptions in each block.
	
	* plugin.php: Support for new plugin type option.
	
	* config_process.php: Build update.
	
	* functions.php: Updated new report type.
	
	* functions_db.php: Added support for new report type.
	
	* functions_reporting.php: Fixed problem with enterprise. Added new function
	to support new reports.
	
	* events.php: Support for grouping events. Fixed graph problem. Added quick
	search link to event fulltext.
	
	* reporting_viewer.php: Added support for adding descriptions in each block.
	Also show new report type.
	
	* fgraph.php: Fixed problem in event graph.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1464 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2009-02-17 20:39:42 +00:00
parent 6fb154591d
commit c7c8a0be1d
13 changed files with 383 additions and 77 deletions

View File

@ -1,3 +1,36 @@
2009-02-17 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: treport_content, changed report type to string to allow
new report types without altering DB schema. Added id_agent for supporting
reports based on agent ids. Tplugin new field for plugin type in order to
support generic Nagios plugins.
* pandoradb_migrate_20_to_21.sql: Updated with last changes.
* module_manager_editor_common.php: Removed some ugly labels :-)
* reporting_builder.php: New report (Agent detailed and grouped
event/alerts). Added support to add descriptions in each block.
* plugin.php: Support for new plugin type option.
* config_process.php: Build update.
* functions.php: Updated new report type.
* functions_db.php: Added support for new report type.
* functions_reporting.php: Fixed problem with enterprise. Added new function
to support new reports.
* events.php: Support for grouping events. Fixed graph problem. Added quick
search link to event fulltext.
* reporting_viewer.php: Added support for adding descriptions in each block.
Also show new report type.
* fgraph.php: Fixed problem in event graph.
2009-02-17 Evi Vanoost <vanooste@rcbi.rochester.edu>
* general/login_page.php: Fixed HTML and use print_image function

View File

@ -73,7 +73,6 @@ function add_component_selection ($id_network_component_type) {
$component_groups = get_network_component_groups ($id_network_component_type);
$data[1] = '<span id="component_group" class="left">';
$data[1] .= __('Group').'<br />';
$data[1] .= print_select ($component_groups,
'network_component_group', '', '', '--'.__('Manual setup').'--', 0,
true, false, false);
@ -83,7 +82,6 @@ function add_component_selection ($id_network_component_type) {
$data[1] .= __('No component was found');
$data[1] .= '</span>';
$data[1] .= '<span id="component" class="invisible right">';
$data[1] .= __('Component').'<br />';
$data[1] .= print_select (array (), 'network_component', '', '',
'---'.__('Manual setup').'---', 0, true);
$data[1] .= '</span>';

View File

@ -2,7 +2,7 @@
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es
// Copyright (c) 2009 Artica Soluciones Tecnológicas, 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
@ -136,16 +136,18 @@ if ($add_content) {
$id_agent_module = (int) get_parameter ('id_module');
$period = (int) get_parameter ('period');
$type = (string) get_parameter ('type');
$id_agent = (int) get_parameter ('id_agent',0);
$id_custom_graph = (int) get_parameter ('id_custom_graph');
$module_description = (string) get_parameter ('module_description', '');
$order = (int) get_db_value ('COUNT(*)', 'treport_content', 'id_report', $id_report);
$sql = sprintf ('INSERT INTO treport_content (id_report, id_gs, id_agent_module,
`order`, type, period)
VALUES (%d, %s, %s, %d, "%s", %d)',
`order`, type, period, description, id_agent)
VALUES (%d, %s, %s, %d, "%s", %d, "%s", %d)',
$id_report, $id_custom_graph ? $id_custom_graph : "NULL",
$id_agent_module ? $id_agent_module : "NULL",
$order, $type, $period * 3600);
$order, $type, $period * 3600, $module_description, $id_agent);
$result = process_sql ($sql);
if ($result !== false) {
@ -159,6 +161,7 @@ if ($add_content) {
$sla_max = 0;
$sla_min = 0;
$sla_limit = 0;
$module_description = "";
} else {
echo '<h3 class="error">'.__('There was a problem creating reporting')."</h3>";
/* Do not unset so the values are kept in the form */
@ -334,6 +337,9 @@ if ($edit_sla_report_content) {
$table->style[0] = 'font-weight: bold';
$table->data[0][0] = __('Report name');
$table->data[0][1] = print_input_text ('report_name', $report_name, '', 35, 150, true);
$table->data[0][1] .= "&nbsp;&nbsp;<a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report' title='".__('View report')."'><img src='images/reporting.png'></a>";
$table->data[1][0] = __('Group');
if ($report_id_group) {
/* Changing the group is not allowed. */
@ -418,6 +424,10 @@ if ($edit_sla_report_content) {
$table->data[4][1] = print_select_from_sql ('SELECT id_graph, name FROM tgraph',
'id_custom_graph', 0, '', '--', 0, true);
$module_description = "";
$table->data[5][0] = __('Description');
$table->data[5][1] = print_textarea ("module_description", 3, 35, $module_description, 'height: 50px;', true) ;
echo "<form method='post' action='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder'>";
print_table ($table);
echo '<div class="action-buttons" style="width: 500px;">';
@ -470,10 +480,11 @@ if ($edit_sla_report_content) {
'"><img src="images/down.png" title="'.__('Down').'"></a>';
}
$data[1] = get_report_name ($report_content['type']);
$data[2] = '--';
$data[2] = get_agent_name ($report_content['id_agent']);
$data[3] = '--';
if (get_report_type_data_source ($report_content['type']) == 'module') {
$data[2] = strtolower (get_agentmodule_agent_name ($report_content['id_agent_module']));
if ($report_content['id_agent_module'] > 0)
$data[2] = strtolower (get_agentmodule_agent_name ($report_content['id_agent_module']));
$data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']));
}
$data[4] = human_time_description ($report_content['period']);
@ -597,7 +608,7 @@ function report_type_changed () {
$(custom_graph_inputs).fadeIn ('normal');
});
break;
break;
case 'sla':
case 'agent-group':
$(module_inputs).fadeOut ('normal');

View File

@ -2,7 +2,7 @@
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
// Copyright (c) 2009 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
@ -41,6 +41,8 @@ if (isset($_GET["update_plugin"])){ // if modified any parameter
$plugin_net_port_opt = get_parameter ("form_net_port_opt", "");
$plugin_user_opt = get_parameter ("form_user_opt", "");
$plugin_pass_opt = get_parameter ("form_pass_opt", "");
$plugin_plugin_type = get_parameter ("form_plugin_type", "0");
$sql_update ="UPDATE tplugin SET
name = '$plugin_name',
description = '$plugin_description',
@ -49,6 +51,7 @@ if (isset($_GET["update_plugin"])){ // if modified any parameter
net_dst_opt = '$plugin_net_dst_opt',
net_port_opt = '$plugin_net_port_opt',
user_opt = '$plugin_user_opt',
plugin_type = '$plugin_plugin_type',
pass_opt = '$plugin_pass_opt'
WHERE id = $plugin_id";
$result=mysql_query($sql_update);
@ -69,7 +72,9 @@ if (isset($_GET["create_plugin"])){
$plugin_net_port_opt = get_parameter ("form_net_port_opt", "");
$plugin_user_opt = get_parameter ("form_user_opt", "");
$plugin_pass_opt = get_parameter ("form_pass_opt", "");
$sql_insert ="INSERT tplugin (name, description, max_timeout, execute, net_dst_opt, net_port_opt, user_opt, pass_opt) VALUES ('$plugin_name', '$plugin_description', '$plugin_max_timeout', '$plugin_execute', '$plugin_net_dst_opt', '$plugin_net_port_opt', '$plugin_user_opt', '$plugin_pass_opt')";
$plugin_plugin_type = get_parameter ("form_plugin_type", "0");
$sql_insert ="INSERT tplugin (name, description, max_timeout, execute, net_dst_opt, net_port_opt, user_opt, pass_opt, plugin_type) VALUES ('$plugin_name', '$plugin_description', '$plugin_max_timeout', '$plugin_execute', '$plugin_net_dst_opt', '$plugin_net_port_opt', '$plugin_user_opt', '$plugin_pass_opt', $plugin_plugin_type)";
$result=mysql_query($sql_insert);
if (! $result){
echo "<h3 class='error'>".__('Problem creating plugin')."</h3>";
@ -108,6 +113,7 @@ if ($view != ""){
$form_net_port_opt = $plugin ["net_port_opt"];
$form_user_opt = $plugin ["user_opt"];
$form_pass_opt = $plugin ["pass_opt"];
$form_plugin_type = $plugin ["plugin_type"];
}
if ($create != ""){
$form_name = "";
@ -118,6 +124,7 @@ if ($create != ""){
$form_net_port_opt = "";
$form_user_opt = "";
$form_pass_opt = "";
$form_plugin_type = 0;
}
// SHOW THE FORM
@ -150,6 +157,12 @@ if (($create != "") OR ($view != "")){
echo '<td class="datos2">';
echo '<input type="text" name="form_execute" size=45 value="'.$form_execute.'"></td>';
echo '<tr><td class="datos2">'.__('Plugin type');
echo '<td class="datos2">';
$fields[0]= __("Standard");
$fields[1]= __("Nagios");
print_select ($fields, "form_plugin_type", $form_plugin_type);
echo '<tr><td class="datos">'.__('Max.Timeout');
echo '<td class="datos">';
echo '<input type="text" name="form_max_timeout" size=5 value="'.$form_max_timeout.'"></td>';
@ -194,9 +207,10 @@ else {
$sql1='SELECT * FROM tplugin ORDER BY name';
$result=mysql_query($sql1);
if (mysql_num_rows($result) > 0){
echo '<table width="530" cellspacing="4" cellpadding="4" class="databox">';
echo '<table width="730" cellspacing="4" cellpadding="4" class="databox">';
echo "<th>".__('Name');
echo "<th>".__('execute');
echo "<th>".__('Type');
echo "<th>".__('Command');
echo "<th>".__('Delete');
$color = 0;
while ($row=mysql_fetch_array($result)){
@ -214,6 +228,11 @@ else {
echo $row["name"];
echo "</a></b>";
echo "<td class=$tdcolor>";
if ($row["plugin_type"] == 0)
echo __('Standard');
else
echo __('Nagios');
echo "<td class=$tdcolor>";
echo $row["execute"];
echo "<td class=$tdcolor>";
echo "<a href='index.php?sec=gservers&sec2=godmode/servers/plugin&kill_plugin=".$row["id"]."'><img src='images/cross.png' border=0></a>";
@ -223,7 +242,7 @@ else {
echo '<div class="nf">'. __('There are no plugins in the system');
echo "<br>";
}
echo "<table width=530>";
echo "<table width=730>";
echo "<tr><td align=right>";
echo "<form name=plugin method='post' action='index.php?sec=gservers&sec2=godmode/servers/plugin&create=1'>";
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//Pandora Version
$build_version = 'PC090216';
$build_version = 'PC090217';
$pandora_version = 'v2.1-dev';
// Next is the directory where "/attachment" directory is placed, to upload files stores.

View File

@ -715,6 +715,7 @@ function get_report_types () {
$types['general_group_report'] = __('General group report');
$types['monitor_health'] = __('Monitor health');
$types['agents_detailed'] = __('Agents detailed view');
$types['agent_detailed_event'] = __('Agent detailed event');
return $types;
}
@ -756,6 +757,7 @@ function get_report_type_data_source ($type) {
case 'min_value':
case 10:
case 'sumatory':
case 'agent_detailed_event':
return 'module';
case 2:
case 'custom_graph':

View File

@ -714,6 +714,30 @@ function get_group_events ($id_group, $period, $date) {
return get_db_all_rows_sql ($sql);
}
/**
* Get all the events happened in an Agent during a period of time.
*
* The returned events will be in the time interval ($date - $period, $date]
*
* @param int $id_agent Agent id to get events.
* @param int $period Period of time in seconds to get events.
* @param int $date Beginning date to get events.
*
* @return array An array with all the events happened.
*/
function get_agent_events ($id_agent, $period, $date) {
$datelimit = $date - $period;
$sql = sprintf ('SELECT evento,event_type,criticity, count(*) as count_rep, max(timestamp) AS time2
FROM tevento WHERE id_agente = %d AND utimestamp > %d AND utimestamp <=%d
GROUP BY id_agentmodule, evento ORDER BY time2 DESC', $id_agent,
$datelimit, $date);
return get_db_all_rows_sql ($sql);
}
/**
* Get all the monitors defined in an agent.
*

View File

@ -17,7 +17,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require_once ("include/functions_agents.php");
global $config;
require_once ($config["homedir"]."/include/functions_agents.php");
/**
* Get SLA of a module.
@ -254,6 +256,7 @@ function get_group_stats ($id_group) {
return $data;
}
/**
* Get an event reporting table.
*
@ -727,4 +730,54 @@ function get_agents_detailed_reporting ($id_group, $period = 0, $date = 0, $retu
return $output;
}
/**
* Get a detailed report of summarized events per agent
*
* It construct a table object with all the grouped events happened in an agent
* during a period of time.
*
* @param int Agent id to get the report.
* @param int Period of time to get the report.
* @param int Beginning date of the report
* @param int Flag to return or echo the report table (echo by default).
*
* @return object A table object
*/
function get_agents_detailed_event_reporting ($id_agent, $period, $date = 0) {
if (empty ($date)) {
$date = get_system_time ();
} elseif (!is_numeric ($date)) {
$date = strtotime ($date);
}
$table->width = '99%';
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Event name');
$table->head[1] = __('Event type');
$table->head[2] = __('Criticity');
$table->head[3] = __('Count');
$table->head[4] = __('Timestamp');
$events = get_agent_events ($id_agent, $period, $date);
if (empty ($events)) {
$events = array ();
}
foreach ($events as $event) {
$data = array ();
$data[0] = $event['evento'];
$data[1] = $event['event_type'];
$data[2] = get_priority_name($event['criticity']);
$data[3] = $event['count_rep'];
$data[4] = $event['time2'];
array_push ($table->data, $data);
}
$output = print_table ($table, true);
return $output;
}
?>

View File

@ -3,7 +3,7 @@
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2009 Artica Soluciones Tecnologicas, http://www.artica.es
// Please see http://pandora.sourceforge.net for full contribution list
// Please see http://pandorafms.org 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
@ -62,7 +62,7 @@ $pagination = (int) get_parameter ("pagination", $config["block_size"]);
$groups = get_user_groups ($config["id_user"], "IR");
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
$id_user_ack = (int) get_parameter ("id_user_ack", 0);
$group_rep = (int) get_parameter ("group_rep", 0);
$group_rep = (int) get_parameter ("group_rep", 1);
//Group selection
if ($ev_group > 1 && in_array ($ev_group, array_keys ($groups))) {
@ -99,7 +99,7 @@ if ($id_user_ack != 0)
$unixtime = date("U") - ($event_view_hr*60*60);
$sql_post .= " AND utimestamp > $unixtime ";
$url = "index.php?sec=eventos&sec2=operation/events/events&search=$search&event_type=$event_type&severity=$severity&status=$status&ev_group=$ev_group&refr=60&id_agent=$id_agent&id_event=$id_event&pagination=$pagination";
$url = "index.php?sec=eventos&sec2=operation/events/events&search=$search&event_type=$event_type&severity=$severity&status=$status&ev_group=$ev_group&refr=60&id_agent=$id_agent&id_event=$id_event&pagination=$pagination&group_rep=$group_rep";
echo "<h2>".__('Events')." &gt; ".__('Main event view'). "&nbsp";
@ -209,7 +209,10 @@ echo "</td>";
echo "<td>";
echo __("Repeated");
echo "</td><td>";
print_checkbox ("group_rep", 1, $group_rep, false);
$repeated_sel[0] = __("All events");
$repeated_sel[1] = __("Group events");
print_select ($repeated_sel, "group_rep", $group_rep);
echo "</td></tr>";
echo "<tr><td colspan=4 align=right>";
@ -233,7 +236,7 @@ echo '</div><div style="clear:both">&nbsp;</div>';
if ($group_rep == 0)
$sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
else
$sql = "SELECT *, COUNT(*) AS event_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
$sql = "SELECT *, COUNT(*) AS event_rep, max(timestamp) AS timestamp_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
$result = get_db_all_rows_sql ($sql);
if ($group_rep == 0)
@ -285,7 +288,10 @@ $table->align[4] = 'center';
$table->head[5] = __('Group');
$table->align[5] = 'center';
$table->head[6] = __('User ID');
if ($group_rep == 0)
$table->head[6] = __('User ID');
else
$table->head[6] = __('Rep');
$table->align[6] = 'center';
$table->head[7] = __('Timestamp');
@ -352,15 +358,13 @@ foreach ($result as $row) {
// Event description
$data[2] = '<span title="'.$row["evento"].'" class="f9">';
if (strlen ($row["evento"]) > 39) {
$data[2] .= substr ($row["evento"], 0, 37)."...";
$data[2] .= "<a href='$url&group_rep=0&id_agent=".$row["id_agente"]."&pure=".$config["pure"]."&search=".$row["evento"]."'>";
if (strlen ($row["evento"]) > 50) {
$data[2] .= substr ($row["evento"], 0, 50)."...";
} else {
$data[2] .= $row["evento"];
}
$data[2] .= '</span>';
if ($group_rep == 1)
$data[2] .= " ( ".$row["event_rep"] . " ) ";
$data[2] .= '</a></span>';
if ($row["event_type"] == "system") {
$data[3] = __('System');
@ -388,23 +392,24 @@ foreach ($result as $row) {
$data[5] = print_group_icon ($row["id_grupo"], true);
if (!empty ($row["estado"])) {
if ($row["id_usuario"] != '0' && $row["id_usuario"] != ''){
$data[6] = '<a href="index.php?sec=usuario&sec2=operation/user/user_edit&ver='.$row["id_usuario"].'" title="'.dame_nombre_real ($row["id_usuario"]).'">'.substr ($row["id_usuario"],0,8).'</a>';
if ($group_rep == 1)
$data[6] = $row["event_rep"];
else {
if (!empty ($row["estado"])) {
if ($row["id_usuario"] != '0' && $row["id_usuario"] != ''){
$data[6] = '<a href="index.php?sec=usuario&sec2=operation/user/user_edit&ver='.$row["id_usuario"].'" title="'.dame_nombre_real ($row["id_usuario"]).'">'.substr ($row["id_usuario"],0,8).'</a>';
} else {
$data[6]=__('System');
}
} else {
$data[6]=__('System');
$data[6] = '';
}
} else {
$data[6] = '';
}
//Time
if ($group_rep == 1){
if ($row["event_rep"] == 1)
$data[7] = print_timestamp ($row["timestamp"], true);
else
$data[7] = print_timestamp (get_db_sql ("SELECT timestamp FROM tevento WHERE id_agentmodule = ".$row["id_agentmodule"]." AND evento = '".$row["evento"]."' ORDER BY utimestamp DESC LIMIT 1"), true);
$data[7] = print_timestamp ($row['timestamp_rep'], true);
} else {
$data[7] = print_timestamp ($row["timestamp"], true);
}
@ -430,20 +435,23 @@ foreach ($result as $row) {
array_push ($table->data, $data);
}
if (empty ($table->data)) {
echo '<div class="nf">'.__('No events').'</div>';
} else {
echo '<form method="post" action="'.$url.'&pure='.$config["pure"].'">';
print_table ($table);
echo '<div style="width:750px; text-align:right">';
if (!empty ($table->data))
print_table ($table);
if (empty ($table->data))
echo '<div style="visibility:hidden; width:750px; text-align:right">';
else
echo '<div style="width:750px; text-align:right">';
if (give_acl ($config["id_user"], 0, "IW") == 1) {
print_submit_button (__('Validate'), 'validate', false, 'class="sub ok"');
}
if (give_acl ($config["id_user"], 0,"IM") == 1) {
print_submit_button (__('Delete'), 'delete', false, 'class="sub delete"');
}
echo '</div></form>
<script language="JavaScript" type="text/javascript">
echo '</div></form>';
echo '<script language="JavaScript" type="text/javascript">
$(document).ready( function() {
$("INPUT[name=\'allbox\']").click( function() {
$("INPUT[name=\'eventid[]\']").each( function() {
@ -456,23 +464,28 @@ if (empty ($table->data)) {
});
});
</script>';
if ($config["pure"]== 0) {
echo '<div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Status').'</h3>';
echo '<img src="images/dot_green.png" /> - '.__('Validated event');
echo '<br />';
echo '<img src="images/dot_red.png" /> - '.__('Not validated event');
if (!empty ($table->data)){
if ($config["pure"]== 0) {
echo '<div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Status').'</h3>';
echo '<img src="images/pixel_green.png" width="10" height="10" /> - '.__('Validated event');
echo '<br />';
echo '<img src="images/pixel_red.png" width="10" height="10" /> - '.__('Not validated event');
echo '</div><div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Action').'</h3>';
echo '<img src="images/ok.png" /> - '.__('Validate event');
echo '<br />';
echo '<img src="images/cross.png" /> - '.__('Delete event');
echo '<br />';
echo '<img src="images/page_lightning.png" /> - '.__('Create incident');
echo '</div><div style="clear:both;">&nbsp;</div>';
}
}
else
echo '<div class="nf">'.__('No events').'</div>';
echo '</div><div style="padding-left:30px; width:150px; float:left; line-height:17px;">';
echo '<h3>'.__('Action').'</h3>';
echo '<img src="images/ok.png" /> - '.__('Validate event');
echo '<br />';
echo '<img src="images/cross.png" /> - '.__('Delete event');
echo '<br />';
echo '<img src="images/page_lightning.png" /> - '.__('Create incident');
echo '</div><div style="clear:both;">&nbsp;</div>';
}
}
unset ($table);
?>

View File

@ -2,7 +2,7 @@
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
// Copyright (c) 2009 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
@ -138,6 +138,14 @@ foreach ($contents as $content) {
$data[2] = '<h4>'.human_time_description ($content['period']).'</h4>';
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[2][0] = 4;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$data[0] = '<img src="reporting/fgraph.php?tipo=sparse&id='.$content['id_agent_module'].'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&avg_only=1&pure=1" border="0" alt="">';
array_push ($table->data, $data);
@ -152,6 +160,14 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[0][0] = 4;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$result = get_db_all_rows_field_filter ("tgraph_source", "id_graph", $content['id_gs']);
$modules = array ();
$weights = array ();
@ -182,11 +198,19 @@ foreach ($contents as $content) {
$data[1] = '<h4>'.human_time_description ($content['period']).'</h4>';;
$n = array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[1][0] = 3;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$slas = get_db_all_rows_field_filter ('treport_content_sla_combined',
'id_report_content', $content['id_rc']);
if ($slas === false) {
$data = array ();
$table->colspan[1][0] = 3;
$table->colspan[2][0] = 3;
$data[0] = __('There are no SLAs defined');
array_push ($table->data, $data);
$slas = array ();
@ -196,7 +220,7 @@ foreach ($contents as $content) {
foreach ($slas as $sla) {
$data = array ();
$table->colspan[$n][0] = 2;
$table->colspan[$n][0] = 3;
$data[0] = '<strong>'.__('Agent')."</strong> : ";
$data[0] .= get_agentmodule_agent_name ($sla['id_agent_module'])."<br />";
$data[0] .= '<strong>'.__('Module')."</strong> : ";
@ -239,14 +263,21 @@ foreach ($contents as $content) {
break;
case 4:
case 'event_report':
$table->colspan[0][0] = 2;
$id_agent = dame_agente_id ($agent_name);
$data = array ();
$data[0] = "<h4>".__('Event report')."</h4>";
$data[1] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
$table->colspan[1][0] = 3;
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[1][0] = 3;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$table->colspan[2][0] = 3;
$data = array ();
$table_report = event_reporting ($report['id_group'], $content['period'], $datetime, true);
$table_report->class = 'databox';
@ -263,8 +294,16 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[1][0] = 3;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[1][0] = 3;
$table->colspan[2][0] = 3;
$data[0] = alert_reporting ($report['id_group'], $content['period'], $datetime, true);
array_push ($table->data, $data);
@ -277,6 +316,14 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[1][0] = 3;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$monitor_value = format_numeric (get_agent_module_sla ($content['id_agent_module'], $content['period'], 1, 1, $datetime));
$data[0] = '<p style="font: bold 3em Arial, Sans-serif; color: #000000;">';
@ -295,8 +342,16 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[1][0] = 3;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[1][0] = 2;
$table->colspan[2][0] = 3;
$value = format_numeric (get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $datetime));
$data[0] = '<p style="font: bold 3em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
array_push ($table->data, $data);
@ -310,8 +365,16 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[1][0] = 3;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[1][0] = 2;
$table->colspan[2][0] = 3;
$value = format_numeric (get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $datetime));
$data[0] = '<p style="font: bold 3em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
array_push ($table->data, $data);
@ -325,6 +388,14 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[0][0] = 2;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[1][0] = 2;
$value = format_numeric (get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $datetime));
@ -340,6 +411,14 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[0][0] = 2;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[1][0] = 2;
$value = format_numeric (get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $datetime));
@ -354,6 +433,14 @@ foreach ($contents as $content) {
$data[1] = "<h4>$group_name</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[0][0] = 2;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[1][0] = 2;
$data[0] = general_group_reporting ($report['id_group'], true);
@ -368,6 +455,14 @@ foreach ($contents as $content) {
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[0][0] = 4;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[1][0] = 4;
$data[0] = monitor_health_reporting ($report['id_group'], $content['period'], $datetime, true);
@ -380,15 +475,44 @@ foreach ($contents as $content) {
$data[0] = "<h4>".__('Agents detailed view')."</h4>";
$data[1] = "<h4>$group_name</h4>";
array_push ($table->data, $data);
$table->colspan[0][0] = 2;
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[0][0] = 2;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$table->colspan[0][0] = 2;
$data = array ();
$table->colspan[1][0] = 3;
$data[0] = get_agents_detailed_reporting ($report['id_group'], $content['period'], $datetime, true);
array_push ($table->data, $data);
break;
case 'agent_detailed_event':
$data = array ();
$data[0] = "<h4>".__('Agent detailed event')."</h4>";
$data[1] = "<h4>".get_agent_name($content['id_agent'])."</h4>";
array_push ($table->data, $data);
// Put description at the end of the module (if exists)
if ($content["description"] != ""){
$table->colspan[1][0] = 3;
$data_desc = array();
$data_desc[0] = $content["description"];
array_push ($table->data, $data_desc);
}
$data = array ();
$table->colspan[2][0] = 3;
$data[0] = get_agents_detailed_event_reporting ($content['id_agent'], $content['period'], $datetime);
array_push ($table->data, $data);
break;
}
print_table ($table);
flush ();
}

View File

@ -698,9 +698,11 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`id_report` INTEGER UNSIGNED NOT NULL default 0,
`id_gs` INTEGER UNSIGNED NULL default NULL,
`id_agent_module` bigint(14) unsigned NULL default NULL,
`type` enum ('simple_graph', 'custom_graph', 'SLA', 'event_report', 'alert_report', 'monitor_report', 'avg_value', 'max_value', 'min_value', 'sumatory', 'general_group_report', 'monitor_health', 'agents_detailed') default 'simple_graph',
`type` varchar(30) default 'simple_graph',
`period` int(11) NOT NULL default 0,
`order` int (11) NOT NULL default 0,
`description` mediumtext,
`id_agent` int(10) unsigned NOT NULL default 0,
PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -759,6 +761,7 @@ CREATE TABLE IF NOT EXISTS tplugin (
`net_port_opt` varchar(50) default '',
`user_opt` varchar(50) default '',
`pass_opt` varchar(50) default '',
`plugin_type` int(2) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -817,7 +820,6 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- tlocal_component is a repository of local modules for
-- physical agents on Windows / Unix physical agents
CREATE TABLE IF NOT EXISTS `tlocal_component` (

View File

@ -242,3 +242,30 @@ CREATE TABLE IF NOT EXISTS `talert_compound_actions` (
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tlocal_component` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(80) NOT NULL,
`data` mediumtext NOT NULL,
`description` varchar(250) default NULL,
`id_os` int(10) unsigned default '0',
`os_version` varchar(100) default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `tlocal_component_group` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(200) NOT NULL default '',
`parent` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--Changes added 16 February 2009
ALTER TABLE tplugin ADD `plugin_type` int(2) UNSIGNED NOT NULL default 0;
ALTER TABLE treport_content ADD `description` mediumtext;
ALTER TABLE treport_content MODIFY `type` varchar(30) default 'simple_graph';
ALTER TABLE treport_content ADD `id_agent` int(10) unsigned NOT NULL default 0;

View File

@ -2,7 +2,7 @@
// Pandora FMS - the Flexible Monitoring System
// ============================================
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
// Copyright (c) 2009 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
@ -1263,7 +1263,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
$legend = array();
$loop = 0;
$badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT ");
$badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT ", "EXEC");
$url = str_ireplace ($badstrings,"",$url); //remove bad strings from the query so queries like ; DELETE FROM don't pass
//This will give the distinct id_agente, give the id_grupo that goes
@ -1284,9 +1284,9 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
$legend[5] = __('Other')." (".$data[5].")";
} else {
if ($row["id_agente"] == 0) {
$legend = __('SYSTEM')." (".$row["count"].")";
$legend[0] = __('SYSTEM')." (".$row["count"].")";
} else {
$legend[] = mb_substr (get_agent_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
$legend[] = mb_substr (get_agent_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
}
$data[] = $row["count"];
}