Merge remote-tracking branch 'origin/develop' into features/oracle

Conflicts resolved:
	pandora_console/include/functions_reporting.php
This commit is contained in:
Alejandro Gallardo Escobar 2015-05-19 19:16:35 +02:00
commit 137acdb232
53 changed files with 10201 additions and 9606 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.0dev-150514 Version: 6.0dev-150519
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0dev-150514" pandora_version="6.0dev-150519"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0dev'; use constant AGENT_VERSION => '6.0dev';
use constant AGENT_BUILD => '150514'; use constant AGENT_BUILD => '150519';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0dev %define version 6.0dev
%define release 150514 %define release 150519
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0dev %define version 6.0dev
%define release 150514 %define release 150519
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -21,7 +21,7 @@ my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`;
my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`; my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`;
my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`; my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`;
my $available=$freemem+$cached+$cachedwap; my $available=$freemem+$cached+$cachedwap;
my $available_percent = floor(($available / $STOTAL)*100); my $available_percent = floor(($available / $TOTAL)*100);
print "<module>\n"; print "<module>\n";

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{150514} {150519}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0dev(Build 150514)") #define PANDORA_VERSION ("6.0dev(Build 150519)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0dev(Build 150514))" VALUE "ProductVersion", "(6.0dev(Build 150519))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 6.0dev-150514 Version: 6.0dev-150519
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0dev-150514" pandora_version="6.0dev-150519"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -258,6 +258,7 @@ config_check();
} }
$table->data[0][3] = $maintenance_img; $table->data[0][3] = $maintenance_img;
// Main help icon // Main help icon
$table->data[0][4] = ui_print_help_icon ("main_help", true, '', 'images/header_help.png'); $table->data[0][4] = ui_print_help_icon ("main_help", true, '', 'images/header_help.png');

View File

@ -938,7 +938,7 @@ if ($update_module || $create_module) {
$plugin_parameter = (string) get_parameter ('plugin_parameter'); $plugin_parameter = (string) get_parameter ('plugin_parameter');
} }
$ip_target = (string) get_parameter ('ip_target'); $ip_target = (string) get_parameter ('ip_target');
$custom_id = (string) get_parameter ('custom_id'); $custom_id = (string) get_parameter ('custom_id');
$history_data = (int) get_parameter('history_data'); $history_data = (int) get_parameter('history_data');

View File

@ -139,6 +139,7 @@ if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "PM"))
else else
$return_all_group = true; $return_all_group = true;
html_print_select_groups(false, "AR", $return_all_group, "ag_group", $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false, 'width:100px;'); html_print_select_groups(false, "AR", $return_all_group, "ag_group", $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false, 'width:100px;');
echo "<td>"; echo "<td>";
echo __('Show Agents') . '&nbsp;'; echo __('Show Agents') . '&nbsp;';
$fields = array( $fields = array(
@ -398,6 +399,7 @@ else {
} }
} }
$agents = db_get_all_rows_sql ($sql); $agents = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function // Delete rnum row generated by oracle_recode_query() function

View File

@ -31,7 +31,7 @@ if (is_ajax ()) {
$component['throw_unknown_events'] = $component['throw_unknown_events'] =
!network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN); !network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
// Decrypt passwords in the component. // Decrypt passwords in the component.
$component['plugin_pass'] = io_output_password($component['plugin_pass']); $component['plugin_pass'] = io_output_password($component['plugin_pass']);

View File

@ -140,7 +140,7 @@ if (is_ajax ()) {
$rfield = html_print_select($fields_value_select, $rfield = html_print_select($fields_value_select,
'field'.$i.'_recovery_value', '', '', '', 0, true, false, false, 'fields_recovery'); 'field'.$i.'_recovery_value', '', '', '', 0, true, false, false, 'fields_recovery');
} }
else{ else {
$ffield = html_print_textarea ('field' . $i . '_value',1, 1, $fv[0], $ffield = html_print_textarea ('field' . $i . '_value',1, 1, $fv[0],
'style="min-height:40px" class="fields"', true); 'style="min-height:40px" class="fields"', true);
$rfield = html_print_textarea ('field' . $i . '_recovery_value', 1, 1, $fv[0], $rfield = html_print_textarea ('field' . $i . '_recovery_value', 1, 1, $fv[0],

View File

@ -306,7 +306,7 @@ $(document).ready (function () {
$("[name=field" + i + "_value]").val(old_value); $("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); $("[name=field" + i + "_recovery_value]").val(old_recovery_value);
} }
else{ else {
$("[name=field" + i + "_value]").val($("[name=field" + i + "_value]").val()); $("[name=field" + i + "_value]").val($("[name=field" + i + "_value]").val());
$("[name=field" + i + "_recovery_value]").val($("[name=field" + i + "_recovery_value]").val()); $("[name=field" + i + "_recovery_value]").val($("[name=field" + i + "_recovery_value]").val());
} }

View File

@ -471,7 +471,7 @@ print_alert_template_steps ($step, $id);
$table->id = 'template'; $table->id = 'template';
$table->width = '98%'; $table->width = '98%';
if(defined("METACONSOLE")){ if(defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head[0] = __('Create Template'); $table->head[0] = __('Create Template');
@ -479,7 +479,7 @@ if(defined("METACONSOLE")){
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
} }
$table->style = array (); $table->style = array ();
if(!defined("METACONSOLE")){ if(!defined("METACONSOLE")) {
$table->style[0] = 'font-weight: bold; vertical-align: top'; $table->style[0] = 'font-weight: bold; vertical-align: top';
$table->style[2] = 'font-weight: bold; vertical-align: top'; $table->style[2] = 'font-weight: bold; vertical-align: top';
} }

View File

@ -43,7 +43,7 @@ if(defined('METACONSOLE')) {
'text' => '<a href="index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int)$config['pure'].'">' . 'text' => '<a href="index.php?sec=advanced&sec2=godmode/category/category&tab=list&pure='.(int)$config['pure'].'">' .
html_print_image ("images/list.png", true, array ("title" => __('List categories'))) .'</a>')); html_print_image ("images/list.png", true, array ("title" => __('List categories'))) .'</a>'));
} }
else{ else {
$buttons = array( $buttons = array(
'list' => array( 'list' => array(
'active' => false, 'active' => false,
@ -132,6 +132,7 @@ if (!empty($result)) {
$iterator++; $iterator++;
$data = array (); $data = array ();
if(defined('METACONSOLE')){ if(defined('METACONSOLE')){
$data[0] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=" . $category["id"] . "&pure=" . (int)$config['pure'] . "'>" . $category["name"] . "</a>"; $data[0] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=" . $category["id"] . "&pure=" . (int)$config['pure'] . "'>" . $category["name"] . "</a>";
$data[1] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category["id"] . "&pure=" . (int)$config['pure'] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;"; $data[1] = "<a href='index.php?sec=advanced&sec2=godmode/category/edit_category&action=update&id_category=".$category["id"] . "&pure=" . (int)$config['pure'] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;";

View File

@ -28,6 +28,7 @@ if (! check_acl($config['id_user'], 0, "EW")) {
$update = get_parameter('upd_button', ''); $update = get_parameter('upd_button', '');
$default = (int) get_parameter('default', 0); $default = (int) get_parameter('default', 0);
if ($default != 0) { if ($default != 0) {
$event_fields = io_safe_input('evento,id_agente,estado,timestamp'); $event_fields = io_safe_input('evento,id_agente,estado,timestamp');
$fields_selected = explode (',', $event_fields); $fields_selected = explode (',', $event_fields);

View File

@ -159,7 +159,8 @@ $table->class = "databox";
$table->style[0] = 'vertical-align: top;'; $table->style[0] = 'vertical-align: top;';
$table->valign[1] = 'top'; $table->valign[1] = 'top';
if (defined('METACONSOLE')){
if (defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->border = 0; $table->border = 0;
$table->cellspacing = 3; $table->cellspacing = 3;
@ -288,7 +289,7 @@ $add_without_tag_disabled = empty($tags_select_without);
$remove_without_tag_disabled = empty($tag_without_temp); $remove_without_tag_disabled = empty($tag_without_temp);
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->data[13][0] = '<b>' . __('Events with following tags') . '</b>'; $table->data[13][0] = '<b>' . __('Events with following tags') . '</b>';
$table->data[13][0] .= '<br>' . html_print_select ($tags_select_with, 'select_with', $table->data[13][0] .= '<br>' . html_print_select ($tags_select_with, 'select_with',

View File

@ -57,7 +57,7 @@ else {
$table->width = '90%'; $table->width = '90%';
if(defined('METACONSOLE')){ if(defined('METACONSOLE')) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head[0] = __('Edit event responses'); $table->head[0] = __('Edit event responses');

View File

@ -25,7 +25,7 @@ if (! check_acl($config['id_user'], 0, "PM")) {
return; return;
} }
if(!defined('METACONSOLE')){ if(!defined('METACONSOLE')) {
echo '<br><br><div style="width:99%;text-align:right;">'; echo '<br><br><div style="width:99%;text-align:right;">';
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">';
html_print_submit_button(__('Create response'), 'create_response_button', false, array('class' => 'sub next')); html_print_submit_button(__('Create response'), 'create_response_button', false, array('class' => 'sub next'));
@ -78,7 +78,7 @@ foreach($event_responses as $response) {
html_print_table($table); html_print_table($table);
if(defined('METACONSOLE')){ if(defined('METACONSOLE')) {
echo '<br><br><div style="width:100%;text-align:right;">'; echo '<br><br><div style="width:100%;text-align:right;">';
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">'; echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=responses&mode=editor&amp;pure='.$config['pure'].'">';
html_print_submit_button(__('Create response'), 'create_response_button', false, array('class' => 'sub next')); html_print_submit_button(__('Create response'), 'create_response_button', false, array('class' => 'sub next'));

View File

@ -176,7 +176,7 @@ $agents_with_templates_json = json_encode($agents_with_templates_json);
echo "<input type='hidden' id='hidden-agents_with_templates' value='$agents_with_templates_json'>"; echo "<input type='hidden' id='hidden-agents_with_templates' value='$agents_with_templates_json'>";
echo '<div class="action-buttons" style="width: '. $table->width . '" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'; echo '<div class="action-buttons" style="width: ' . $table->width . '" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden ('add', 1); html_print_input_hidden ('add', 1);
html_print_submit_button (__('Add'), 'go', false, 'class="sub add"'); html_print_submit_button (__('Add'), 'go', false, 'class="sub add"');
echo '</div>'; echo '</div>';

View File

@ -58,6 +58,7 @@ $group = 0;
$group_by_agent = 0; $group_by_agent = 0;
$order_uptodown = 0; $order_uptodown = 0;
$show_resume = 0; $show_resume = 0;
$show_address_agent = 0;
$top_n = 0; $top_n = 0;
$top_n_value = 10; $top_n_value = 10;
$exception_condition = REPORT_EXCEPTION_CONDITION_EVERYTHING; $exception_condition = REPORT_EXCEPTION_CONDITION_EVERYTHING;
@ -87,6 +88,7 @@ $inventory_modules = array();
$date = null; $date = null;
// Only avg is selected by default for the simple graphs // Only avg is selected by default for the simple graphs
$only_avg = true; $only_avg = true;
$time_compare_overlapped = false;
//Added for events items //Added for events items
$filter_event_validated = false; $filter_event_validated = false;
@ -102,6 +104,9 @@ $netflow_filter = 0;
$max_values = 0; $max_values = 0;
$resolution = 0; $resolution = 0;
//Others
$filter_search = "";
switch ($action) { switch ($action) {
case 'new': case 'new':
$actionParameter = 'save'; $actionParameter = 'save';
@ -128,6 +133,7 @@ switch ($action) {
case 'exception': case 'exception':
case 'general': case 'general':
case 'network_interfaces_report': case 'network_interfaces_report':
case 'availability':
$get_data_editor = true; $get_data_editor = true;
break; break;
default: default:
@ -187,6 +193,9 @@ switch ($action) {
$projection_period = $item['top_n_value']; $projection_period = $item['top_n_value'];
$period_pg = $item['period']; $period_pg = $item['period'];
} }
// HACK it is saved in show_graph field.
$time_compare_overlapped = $item['show_graph'];
break; break;
case 'prediction_date': case 'prediction_date':
$description = $item['description']; $description = $item['description'];
@ -406,6 +415,8 @@ switch ($action) {
$event_graph_by_user_validator = $style['event_graph_by_user_validator']; $event_graph_by_user_validator = $style['event_graph_by_user_validator'];
$event_graph_by_criticity = $style['event_graph_by_criticity']; $event_graph_by_criticity = $style['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated']; $event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
$filter_search = $style['event_filter_search'];
break; break;
case 'event_report_module': case 'event_report_module':
$description = $item['description']; $description = $item['description'];
@ -419,7 +430,15 @@ switch ($action) {
$period = $item['period']; $period = $item['period'];
$order_uptodown = $item['order_uptodown']; $order_uptodown = $item['order_uptodown'];
$show_resume = $item['show_resume']; $show_resume = $item['show_resume'];
$show_graph = $item['show_graph']; break;
case 'availability':
$description = $item['description'];
$period = $item['period'];
$order_uptodown = $item['order_uptodown'];
$show_resume = $item['show_resume'];
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
$show_address_agent = $item['show_graph'];
break; break;
case 'group_report': case 'group_report':
$description = $item['description']; $description = $item['description'];
@ -1040,6 +1059,14 @@ else
?> ?>
</td> </td>
</tr> </tr>
<tr id="row_time_compare_overlapped" style="" class="datos">
<td><?php echo __('Time compare (Overlapped)');?></td>
<td>
<?php
html_print_checkbox('time_compare_overlapped', 1, $time_compare_overlapped);
?>
</td>
</tr>
<tr id="row_only_avg" style="" class="datos"> <tr id="row_only_avg" style="" class="datos">
<td><?php echo __('Only average');?></td> <td><?php echo __('Only average');?></td>
<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td> <td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
@ -1081,6 +1108,20 @@ else
<td><?php html_print_select ($show_graph_options, 'combo_graph_options', $show_graph);?></td> <td><?php html_print_select ($show_graph_options, 'combo_graph_options', $show_graph);?></td>
</tr> </tr>
<tr id="row_show_address_agent" style="" class="datos">
<td>
<?php
echo __('Show address instead module name.') .
ui_print_help_tip(__('Show the main address of agent.'), true);
?>
</td>
<td>
<?php
html_print_checkbox('checkbox_show_address_agent', 1,
$show_address_agent);
?>
</td>
</tr>
<tr id="row_show_resume" style="" class="datos"> <tr id="row_show_resume" style="" class="datos">
<td><?php echo __('Show resume') . ui_print_help_tip(__('Show a resume table with max, min, average of total modules on the report bottom'), true);?></td> <td><?php echo __('Show resume') . ui_print_help_tip(__('Show a resume table with max, min, average of total modules on the report bottom'), true);?></td>
<td> <td>
@ -1154,13 +1195,21 @@ else
?> ?>
</td> </td>
</tr> </tr>
<tr id="row_filter_search" style="" class="datos">
<td><?php echo __('Free search');?></td>
<td>
<?php
html_print_input_text('filter_search', $filter_search);
?>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<br /> <br />
<br /> <br />
<?php <?php
print_SLA_list('95%', $action, $idItem); print_SLA_list('95%', $action, $idItem);
print_General_list('95%', $action, $idItem); print_General_list('95%', $action, $idItem, $type);
echo '<div class="action-buttons" style="width: 100%">'; echo '<div class="action-buttons" style="width: 100%">';
if ($action == 'new') { if ($action == 'new') {
html_print_submit_button(__('Create item'), 'create_item', false, 'class="sub wand"'); html_print_submit_button(__('Create item'), 'create_item', false, 'class="sub wand"');
@ -1339,7 +1388,7 @@ function print_SLA_list($width, $action, $idItem = null) {
<?php <?php
} }
function print_General_list($width, $action, $idItem = null) { function print_General_list($width, $action, $idItem = null, $type = 'general') {
global $config; global $config;
global $meta; global $meta;
@ -1357,11 +1406,24 @@ function print_General_list($width, $action, $idItem = null) {
<table class="databox" id="general_list" border="0" cellpadding="4" cellspacing="4" width="100%"> <table class="databox" id="general_list" border="0" cellpadding="4" cellspacing="4" width="100%">
<thead> <thead>
<tr> <tr>
<th class="header" scope="col"><?php echo __('Agent');?></th> <?php
<th class="header" scope="col"><?php echo __('Module');?></th> if ($type == "availability") {
<th class="header" scope="col"><?php echo __('Operation') . ?>
ui_print_help_tip(__("Please be careful, when the module have diferent intervals in their life, the summatory maybe get bad result."), true);?></th> <th class="header" scope="col"><?php echo __('Agent');?></th>
<th class="header" scope="col"><?php echo __('Action');?></th> <th class="header" scope="col"><?php echo __('Module');?></th>
<th class="header" scope="col"><?php echo __('Action');?></th>
<?php
}
else {
?>
<th class="header" scope="col"><?php echo __('Agent');?></th>
<th class="header" scope="col"><?php echo __('Module');?></th>
<th class="header" scope="col"><?php echo __('Operation') .
ui_print_help_tip(__("Please be careful, when the module have diferent intervals in their life, the summatory maybe get bad result."), true);?></th>
<th class="header" scope="col"><?php echo __('Action');?></th>
<?php
}
?>
</tr> </tr>
</thead> </thead>
<?php <?php
@ -1406,14 +1468,27 @@ function print_General_list($width, $action, $idItem = null) {
$server_name_element .= ' (' . $server_name . ')'; $server_name_element .= ' (' . $server_name . ')';
echo '<tr id="general_' . $item['id'] . '" style="" class="datos"> if ($type == "availability") {
echo '<tr id="general_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . $server_name_element . '</td> <td>' . printSmallFont($nameAgent) . $server_name_element . '</td>
<td>' . printSmallFont($nameModule) . '</td> <td>' . printSmallFont($nameModule) . '</td>
<td>' . printSmallFont($operation[$item['operation']]) . '</td>
<td style="text-align: center;"> <td style="text-align: center;">
<a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a> <a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a>
</td> </td>
</tr>'; </tr>';
}
else {
echo '<tr id="general_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . $server_name_element . '</td>
<td>' . printSmallFont($nameModule) . '</td>
<td>' .
printSmallFont($operation[$item['operation']]) .
'</td>
<td style="text-align: center;">
<a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a>
</td>
</tr>';
}
if ($meta) { if ($meta) {
@ -1427,7 +1502,13 @@ function print_General_list($width, $action, $idItem = null) {
<tr id="row" style="display: none;" class="datos"> <tr id="row" style="display: none;" class="datos">
<td class="agent_name"></td> <td class="agent_name"></td>
<td class="module_name"></td> <td class="module_name"></td>
<td class="operation_name"></td> <?php
if ($type != "availability") {
?>
<td class="operation_name"></td>
<?php
}
?>
<td style="text-align: center;"><a class="delete_button" href="javascript: deleteGeneralRow(0);"><?php html_print_image("images/cross.png", false); ?></a></td> <td style="text-align: center;"><a class="delete_button" href="javascript: deleteGeneralRow(0);"><?php html_print_image("images/cross.png", false); ?></a></td>
</tr> </tr>
</tbody> </tbody>
@ -1459,14 +1540,20 @@ function print_General_list($width, $action, $idItem = null) {
<option value="0"><?php echo __('Select an Agent first'); ?></option> <option value="0"><?php echo __('Select an Agent first'); ?></option>
</select> </select>
</td> </td>
<td> <?php
<?php if ($type !== "availability") {
html_print_select($operation, ?>
'id_operation_module_general', 0, <td>
false, '', '', false, false, true, <?php
'width: 200px', false); html_print_select($operation,
?> 'id_operation_module_general', 0,
</td> false, '', '', false, false, true,
'width: 200px', false);
?>
</td>
<?php
}
?>
<td style="text-align: center;"><a href="javascript: addGeneralRow();"><?php html_print_image("images/disk.png", false); ?></a></td> <td style="text-align: center;"><a href="javascript: addGeneralRow();"><?php html_print_image("images/disk.png", false); ?></a></td>
</tr> </tr>
</tbody> </tbody>
@ -1839,7 +1926,13 @@ function addGeneralRow() {
var idAgent = $("input[name=id_agent_general]").val(); var idAgent = $("input[name=id_agent_general]").val();
var serverId = $("input[name=id_server]").val(); var serverId = $("input[name=id_server]").val();
var idModule = $("#id_agent_module_general").val(); var idModule = $("#id_agent_module_general").val();
var operation = $("#id_operation_module_general").val(); var operation;
if ($("#id_operation_module_general").length) {
operation = $("#id_operation_module_general").val();
}
else {
operation = "";
}
var nameModule = $("#id_agent_module_general :selected").text(); var nameModule = $("#id_agent_module_general :selected").text();
var nameOperation = $("#id_operation_module_general :selected").text(); var nameOperation = $("#id_operation_module_general :selected").text();
@ -1960,9 +2053,11 @@ function chooseType() {
$("#general_list").hide(); $("#general_list").hide();
$("#row_order_uptodown").hide(); $("#row_order_uptodown").hide();
$("#row_show_resume").hide(); $("#row_show_resume").hide();
$("#row_show_address_agent").hide();
$("#row_show_graph").hide(); $("#row_show_graph").hide();
$("#row_max_min_avg").hide(); $("#row_max_min_avg").hide();
$("#row_only_avg").hide(); $("#row_only_avg").hide();
$("#row_time_compare_overlapped").hide();
$("#row_quantity").hide(); $("#row_quantity").hide();
$("#row_exception_condition_value").hide(); $("#row_exception_condition_value").hide();
$("#row_exception_condition").hide(); $("#row_exception_condition").hide();
@ -1984,6 +2079,7 @@ function chooseType() {
$("#row_max_values").hide(); $("#row_max_values").hide();
$("#row_resolution").hide(); $("#row_resolution").hide();
$("#row_last_value").hide(); $("#row_last_value").hide();
$("#row_filter_search").hide();
// SLA list default state // SLA list default state
$("#sla_list").hide(); $("#sla_list").hide();
@ -2012,8 +2108,11 @@ function chooseType() {
$("#row_event_graph_by_user").show(); $("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show(); $("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show(); $("#row_event_graph_by_validated").show();
$("#row_filter_search").show();
break; break;
case 'simple_graph': case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_only_avg").show(); $("#row_only_avg").show();
// The break hasn't be forgotten, this element // The break hasn't be forgotten, this element
// only should be shown on the simple graphs. // only should be shown on the simple graphs.
@ -2024,6 +2123,7 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
$("#row_show_in_landscape").show(); $("#row_show_in_landscape").show();
$("#row_time_compare_overlapped").show();
break; break;
case 'projection_graph': case 'projection_graph':
$("#row_description").show(); $("#row_description").show();
@ -2264,6 +2364,15 @@ function chooseType() {
$("input[name='last_value']").prop("checked", true); $("input[name='last_value']").prop("checked", true);
} }
break; break;
case 'availability':
$("#row_description").show();
$("#row_period").show();
$("#general_list").show();
$("#row_order_uptodown").show();
$("#row_show_address_agent").show();
$("#row_show_in_two_columns").show();
$("#row_show_resume").show();
break;
case 'group_report': case 'group_report':
$("#row_group").show(); $("#row_group").show();
$("#row_servers").show(); $("#row_servers").show();

View File

@ -77,7 +77,7 @@ else {
$agents[$row['id_agente']] = $row['nombre']; $agents[$row['id_agente']] = $row['nombre'];
} }
switch ($config['dbtype']){ switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$rows = db_get_all_rows_sql(' $rows = db_get_all_rows_sql('

View File

@ -97,11 +97,11 @@ if ($idReport != 0) {
$edit = true; $edit = true;
break; break;
} }
if (! $edit) { if (! $edit) {
// The user that created the report should can delete it. Despite its permissions. // The user that created the report should can delete it. Despite its permissions.
$delete_report_bypass = false; $delete_report_bypass = false;
if ($action == 'delete_report') { if ($action == 'delete_report') {
if ($config['id_user'] == $report['id_user'] || is_user_admin ($config["id_user"])) { if ($config['id_user'] == $report['id_user'] || is_user_admin ($config["id_user"])) {
$delete_report_bypass = true; $delete_report_bypass = true;
@ -342,14 +342,14 @@ switch ($action) {
} }
break; break;
} }
if (! $delete) { if (! $delete) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
"Trying to access report builder deletion"); "Trying to access report builder deletion");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
} }
$result = reports_delete_report ($idReport); $result = reports_delete_report ($idReport);
if ($result !== false) if ($result !== false)
db_pandora_audit("Report management", "Delete report #$idReport"); db_pandora_audit("Report management", "Delete report #$idReport");
@ -402,7 +402,7 @@ switch ($action) {
html_print_table($table_aux); html_print_table($table_aux);
echo "</form>"; echo "</form>";
} }
ui_require_jquery_file ('pandora.controls'); ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue'); ui_require_jquery_file ('ajaxqueue');
@ -453,8 +453,14 @@ switch ($action) {
$filter['metaconsole'] = 0; $filter['metaconsole'] = 0;
$reports = reports_get_reports ($filter, $reports = reports_get_reports ($filter,
array ('name', 'id_report', 'description', 'private', array (
'id_user', 'id_group', 'non_interactive'), $return_all_group, 'RR', $group, $strict_user); 'name',
'id_report',
'description',
'private',
'id_user',
'id_group',
'non_interactive'), $return_all_group, 'RR', $group, $strict_user);
$table->width = '0px'; $table->width = '0px';
if (sizeof ($reports)) { if (sizeof ($reports)) {
@ -557,7 +563,8 @@ switch ($action) {
if (enterprise_hook ('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) { if (enterprise_hook ('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) {
$next = 7; $next = 7;
} }
//Admin options only for RM flag //Admin options only for RM flag
if (check_acl ($config['id_user'], 0, "RM")) { if (check_acl ($config['id_user'], 0, "RM")) {
@ -688,7 +695,7 @@ switch ($action) {
} }
break; break;
case 'update': case 'update':
case 'save': case 'save':
switch ($activeTab) { switch ($activeTab) {
case 'main': case 'main':
$reportName = get_parameter('name'); $reportName = get_parameter('name');
@ -768,12 +775,13 @@ switch ($action) {
$first_page = $config['custom_report_front_firstpage']; $first_page = $config['custom_report_front_firstpage'];
$footer = $config['custom_report_front_footer']; $footer = $config['custom_report_front_footer'];
} else { }
else {
$start_url = ui_get_full_url(false, false, false, false); $start_url = ui_get_full_url(false, false, false, false);
$first_page = "&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;" . $start_url . "/images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;"; $first_page = "&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;" . $start_url . "/images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;";
$logo = $header = $footer = null; $logo = $header = $footer = null;
} }
$idOrResult = db_process_sql_insert('treport', $idOrResult = db_process_sql_insert('treport',
@ -813,7 +821,8 @@ switch ($action) {
break; break;
case 'item_editor': case 'item_editor':
$resultOperationDB = null; $resultOperationDB = null;
$report = db_get_row_filter('treport', array('id_report' => $idReport)); $report = db_get_row_filter('treport',
array('id_report' => $idReport));
$reportName = $report['name']; $reportName = $report['name'];
$idGroupReport = $report['id_group']; $idGroupReport = $report['id_group'];
@ -855,6 +864,8 @@ switch ($action) {
$values['top_n'] = get_parameter('combo_sla_sort_options',0); $values['top_n'] = get_parameter('combo_sla_sort_options',0);
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text'); $values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true; $good_format = true;
break; break;
case 'inventory': case 'inventory':
@ -886,11 +897,27 @@ switch ($action) {
$values['top_n_value'] = get_parameter('max_values'); $values['top_n_value'] = get_parameter('max_values');
$good_format = true; $good_format = true;
break; break;
case 'availability':
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
$values['show_graph'] =
get_parameter('checkbox_show_address_agent');
$good_format = true;
break;
case 'simple_graph':
case 'simple_baseline_graph':
// HACK it is saved in show_graph field.
$values['show_graph'] =
(int)get_parameter('time_compare_overlapped');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text'); $values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true; $good_format = true;
} }
@ -922,7 +949,6 @@ switch ($action) {
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown'); $values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown');
$values['exception_condition'] = (int)get_parameter('exception_condition', 0); $values['exception_condition'] = (int)get_parameter('exception_condition', 0);
$values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['exception_condition_value'] = get_parameter('exception_condition_value');
$values['show_graph'] = get_parameter('combo_graph_options');
$values['id_module_group'] = get_parameter('combo_modulegroup'); $values['id_module_group'] = get_parameter('combo_modulegroup');
$values['id_group'] = get_parameter ('combo_group'); $values['id_group'] = get_parameter ('combo_group');
$values['server_name'] = get_parameter ('server_name'); $values['server_name'] = get_parameter ('server_name');
@ -948,6 +974,8 @@ switch ($action) {
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0); $event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0); $event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
$event_filter_search = get_parameter('filter_search', '');
// If metaconsole is activated // If metaconsole is activated
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) { if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) { if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
@ -1014,6 +1042,13 @@ switch ($action) {
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator; $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
switch ($values['type']) {
case 'event_report_group':
$style['event_filter_search'] =
$event_filter_search;
break;
}
break; break;
case 'simple_graph': case 'simple_graph':
// Warning. We are using this column to hold this value to avoid // Warning. We are using this column to hold this value to avoid
@ -1065,6 +1100,8 @@ switch ($action) {
$values['top_n'] = get_parameter('combo_sla_sort_options',0); $values['top_n'] = get_parameter('combo_sla_sort_options',0);
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text'); $values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true; $good_format = true;
break; break;
case 'inventory': case 'inventory':
@ -1102,11 +1139,28 @@ switch ($action) {
$values['top_n_value'] = get_parameter('max_values'); $values['top_n_value'] = get_parameter('max_values');
$good_format = true; $good_format = true;
break; break;
case 'availability':
$values['period'] = get_parameter('period');
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
$values['show_graph'] =
get_parameter('checkbox_show_address_agent');
$good_format = true;
break;
case 'simple_graph':
case 'simple_baseline_graph':
// HACK it is saved in show_graph field.
$values['show_graph'] =
(int)get_parameter('time_compare_overlapped');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text'); $values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true; $good_format = true;
} }
@ -1154,7 +1208,6 @@ switch ($action) {
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown',0); $values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown',0);
$values['exception_condition'] = (int)get_parameter('radiobutton_exception_condition', 0); $values['exception_condition'] = (int)get_parameter('radiobutton_exception_condition', 0);
$values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['exception_condition_value'] = get_parameter('exception_condition_value');
$values['show_graph'] = get_parameter('combo_graph_options');
$values['id_module_group'] = get_parameter('combo_modulegroup'); $values['id_module_group'] = get_parameter('combo_modulegroup');
$values['id_group'] = get_parameter ('combo_group'); $values['id_group'] = get_parameter ('combo_group');
$values['server_name'] = get_parameter ('server_name'); $values['server_name'] = get_parameter ('server_name');
@ -1218,6 +1271,9 @@ switch ($action) {
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0); $event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0); $event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0); $event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
$event_filter_search = get_parameter('filter_search', '');
//Added for events items //Added for events items
$style['filter_event_no_validated'] = $filter_event_no_validated; $style['filter_event_no_validated'] = $filter_event_no_validated;
$style['filter_event_validated'] = $filter_event_validated; $style['filter_event_validated'] = $filter_event_validated;
@ -1228,6 +1284,14 @@ switch ($action) {
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator; $style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity; $style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated; $style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
switch ($values['type']) {
case 'event_report_group':
$style['event_filter_search'] =
$event_filter_search;
break;
}
break; break;
case 'simple_graph': case 'simple_graph':
// Warning. We are using this column to hold this value to avoid // Warning. We are using this column to hold this value to avoid
@ -1592,7 +1656,7 @@ switch ($action) {
switch ($activeTab) { switch ($activeTab) {
case 'main': case 'main':
$buttons['list_reports']['active'] = true; $buttons['list_reports']['active'] = true;
$subsection = ' &raquo; '.__('Custom reporting'); $subsection = ' &raquo; ' . __('Custom reporting');
break; break;
default: default:
$subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons); $subsection = reporting_enterprise_add_subsection_main($activeTab, $buttons);

BIN
pandora_console/images/json.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC150514'; $build_version = 'PC150519';
$pandora_version = 'v6.0dev'; $pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -343,27 +343,42 @@ define('SERVER_TYPE_ENTERPRISE_ICMP', 11);
define('SERVER_TYPE_ENTERPRISE_SNMP', 12); define('SERVER_TYPE_ENTERPRISE_SNMP', 12);
/* REPORTS */ /* REPORTS */
define ('REPORT_TOP_N_MAX', 1); define('REPORT_TOP_N_MAX', 1);
define ('REPORT_TOP_N_MIN', 2); define('REPORT_TOP_N_MIN', 2);
define ('REPORT_TOP_N_AVG', 0); define('REPORT_TOP_N_AVG', 0);
define ('REPORT_TOP_N_ONLY_GRAPHS', 2); define('REPORT_TOP_N_ONLY_GRAPHS', 2);
define ('REPORT_TOP_N_SHOW_TABLE_GRAPS', 1); define('REPORT_TOP_N_SHOW_TABLE_GRAPS', 1);
define ('REPORT_TOP_N_ONLY_TABLE', 0); define('REPORT_TOP_N_ONLY_TABLE', 0);
define ('REPORT_EXCEPTION_CONDITION_EVERYTHING', 0); define('REPORT_EXCEPTION_CONDITION_EVERYTHING', 0);
define ('REPORT_EXCEPTION_CONDITION_GE', 1); define('REPORT_EXCEPTION_CONDITION_GE', 1);
define ('REPORT_EXCEPTION_CONDITION_LE', 5); define('REPORT_EXCEPTION_CONDITION_LE', 5);
define ('REPORT_EXCEPTION_CONDITION_L', 2); define('REPORT_EXCEPTION_CONDITION_L', 2);
define ('REPORT_EXCEPTION_CONDITION_G', 6); define('REPORT_EXCEPTION_CONDITION_G', 6);
define ('REPORT_EXCEPTION_CONDITION_E', 7); define('REPORT_EXCEPTION_CONDITION_E', 7);
define ('REPORT_EXCEPTION_CONDITION_NE', 8); define('REPORT_EXCEPTION_CONDITION_NE', 8);
define ('REPORT_EXCEPTION_CONDITION_OK', 3); define('REPORT_EXCEPTION_CONDITION_OK', 3);
define ('REPORT_EXCEPTION_CONDITION_NOT_OK', 4); define('REPORT_EXCEPTION_CONDITION_NOT_OK', 4);
define ('REPORT_ITEM_ORDER_BY_AGENT_NAME', 3); define('REPORT_ITEM_ORDER_BY_AGENT_NAME', 3);
define ('REPORT_ITEM_ORDER_BY_ASCENDING', 2); define('REPORT_ITEM_ORDER_BY_ASCENDING', 2);
define ('REPORT_ITEM_ORDER_BY_DESCENDING', 1); define('REPORT_ITEM_ORDER_BY_DESCENDING', 1);
define('REPORT_ITEM_ORDER_BY_UNSORT', 0);
define('REPORT_OLD_TYPE_SIMPLE_GRAPH', 1);
define('REPORT_OLD_TYPE_CUSTOM_GRAPH', 2);
define('REPORT_OLD_TYPE_SLA', 3);
define('REPORT_OLD_TYPE_MONITOR_REPORT', 6);
define('REPORT_OLD_TYPE_AVG_VALUE', 7);
define('REPORT_OLD_TYPE_MAX_VALUE', 8);
define('REPORT_OLD_TYPE_MIN_VALUE', 9);
define('REPORT_OLD_TYPE_SUMATORY', 10);
define('REPORT_GENERAL_NOT_GROUP_BY_AGENT', 0);
define('REPORT_GENERAL_GROUP_BY_AGENT', 1);
define('REPORTING_CUSTOM_GRAPH_LEGEND_EACH_MODULE_VERTICAL_SIZE', 15);
/* POLICIES */ /* POLICIES */

View File

@ -853,6 +853,7 @@ function config_process_config () {
// } // }
require_once ($config["homedir"] . "/include/auth/mysql.php"); require_once ($config["homedir"] . "/include/auth/mysql.php");
require_once ($config["homedir"] . "/include/functions_io.php");
// Next is the directory where "/attachment" directory is placed, // Next is the directory where "/attachment" directory is placed,

View File

@ -109,7 +109,9 @@ function events_get_event ($id, $fields = false) {
return $event; return $event;
} }
function events_get_events_grouped($sql_post, $offset = 0, $pagination = 1, $meta = false, $history = false, $total = false) { function events_get_events_grouped($sql_post, $offset = 0,
$pagination = 1, $meta = false, $history = false, $total = false) {
global $config; global $config;
$table = events_get_events_table($meta, $history); $table = events_get_events_table($meta, $history);
@ -1184,7 +1186,8 @@ function events_print_type_description ($type, $return = false) {
*/ */
function events_get_group_events ($id_group, $period, $date, function events_get_group_events ($id_group, $period, $date,
$filter_event_validated = false, $filter_event_critical = false, $filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false) { $filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
global $config; global $config;
@ -1214,8 +1217,17 @@ function events_get_group_events ($id_group, $period, $date,
if ($filter_event_no_validated) { if ($filter_event_no_validated) {
$sql_where .= ' AND estado = 0 '; $sql_where .= ' AND estado = 0 ';
} }
$sql_where .= sprintf(' AND id_grupo IN (%s) AND utimestamp > %d
AND utimestamp <= %d ', implode (",", $id_group), $datelimit, $date); if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%'. io_safe_input($filter_event_search) . '%"'.
' OR id_evento LIKE "%' . io_safe_input($filter_event_search) . '%")';
}
$sql_where .= sprintf('
AND id_grupo IN (%s)
AND utimestamp > %d
AND utimestamp <= %d ',
implode (",", $id_group), $datelimit, $date);
return events_get_events_grouped($sql_where, 0, 1000); return events_get_events_grouped($sql_where, 0, 1000);
} }
@ -1352,7 +1364,7 @@ function events_get_module ($id_agent_module, $period, $date = 0) {
$datelimit = $date - $period; $datelimit = $date - $period;
$sql_where .= sprintf(' AND id_agentmodule = %d AND utimestamp > %d $sql_where = sprintf(' AND id_agentmodule = %d AND utimestamp > %d
AND utimestamp <= %d ', $id_agent_module, $datelimit, $date); AND utimestamp <= %d ', $id_agent_module, $datelimit, $date);
return events_get_events_grouped($sql_where, 0, 1000); return events_get_events_grouped($sql_where, 0, 1000);
@ -2533,7 +2545,9 @@ function events_clean_tags ($tags) {
*/ */
function events_get_count_events_by_agent ($id_group, $period, $date, function events_get_count_events_by_agent ($id_group, $period, $date,
$filter_event_validated = false, $filter_event_critical = false, $filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false) { $filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
global $config; global $config;
$id_group = groups_safe_acl ($config["id_user"], $id_group, "AR"); $id_group = groups_safe_acl ($config["id_user"], $id_group, "AR");
@ -2564,6 +2578,11 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
$sql_where .= ' AND estado = 0 '; $sql_where .= ' AND estado = 0 ';
} }
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'.
' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")';
}
$sql = sprintf ('SELECT id_agente, $sql = sprintf ('SELECT id_agente,
(SELECT t2.nombre (SELECT t2.nombre
FROM tagente t2 FROM tagente t2
@ -2605,7 +2624,9 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
*/ */
function events_get_count_events_validated_by_user ($filter, $period, $date, function events_get_count_events_validated_by_user ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false, $filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false) { $filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
global $config; global $config;
$sql_filter = ' AND 1=1 '; $sql_filter = ' AND 1=1 ';
@ -2646,6 +2667,11 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
$sql_where .= ' AND estado = 0 '; $sql_where .= ' AND estado = 0 ';
} }
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'.
' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")';
}
$sql = sprintf ('SELECT id_usuario, $sql = sprintf ('SELECT id_usuario,
(SELECT t2.fullname (SELECT t2.fullname
FROM tusuario t2 FROM tusuario t2
@ -2687,7 +2713,9 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
*/ */
function events_get_count_events_by_criticity ($filter, $period, $date, function events_get_count_events_by_criticity ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false, $filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false) { $filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
global $config; global $config;
$sql_filter = ' AND 1=1 '; $sql_filter = ' AND 1=1 ';
@ -2728,6 +2756,11 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
$sql_where .= ' AND estado = 0 '; $sql_where .= ' AND estado = 0 ';
} }
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'.
' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")';
}
$sql = sprintf ('SELECT criticity, $sql = sprintf ('SELECT criticity,
COUNT(*) AS count COUNT(*) AS count
FROM tevento FROM tevento
@ -2762,7 +2795,9 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
*/ */
function events_get_count_events_validated ($filter, $period, $date, function events_get_count_events_validated ($filter, $period, $date,
$filter_event_validated = false, $filter_event_critical = false, $filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false) { $filter_event_warning = false, $filter_event_no_validated = false,
$filter_event_search = false) {
global $config; global $config;
$sql_filter = ' AND 1=1 '; $sql_filter = ' AND 1=1 ';
@ -2803,6 +2838,11 @@ function events_get_count_events_validated ($filter, $period, $date,
$sql_where .= ' AND estado = 0 '; $sql_where .= ' AND estado = 0 ';
} }
if (!empty($filter_event_search)) {
$sql_where .= ' AND (evento LIKE "%%'. io_safe_input($filter_event_search) . '%%"'.
' OR id_evento LIKE "%%' . io_safe_input($filter_event_search) . '%%")';
}
$sql = sprintf ('SELECT estado, $sql = sprintf ('SELECT estado,
COUNT(*) AS count COUNT(*) AS count
FROM tevento FROM tevento

View File

@ -2634,7 +2634,10 @@ function grafico_eventos_usuario ($width, $height) {
* @param integer width graph width * @param integer width graph width
* @param integer Graph type 1 vbar, 2 hbar, 3 pie * @param integer Graph type 1 vbar, 2 hbar, 3 pie
*/ */
function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar', $only_image = false, $homeurl = '', $ttl = 1) { function graph_custom_sql_graph ($id, $width, $height,
$type = 'sql_graph_vbar', $only_image = false, $homeurl = '',
$ttl = 1) {
global $config; global $config;
$report_content = db_get_row ('treport_content', 'id_rc', $id); $report_content = db_get_row ('treport_content', 'id_rc', $id);

View File

@ -2071,7 +2071,7 @@ function modules_relation_exists ($id_module, $id_module_other = false) {
*/ */
function modules_add_relation ($id_module_a, $id_module_b) { function modules_add_relation ($id_module_a, $id_module_b) {
$result = false; $result = false;
if (!modules_relation_exists($id_module_a, $id_module_b) && $id_module_a > 0 && $id_module_b > 0) { if (!modules_relation_exists($id_module_a, $id_module_b) && $id_module_a > 0 && $id_module_b > 0) {
$values = array( $values = array(
'module_a' => $id_module_a, 'module_a' => $id_module_a,
@ -2079,7 +2079,7 @@ function modules_add_relation ($id_module_a, $id_module_b) {
); );
$result = db_process_sql_insert('tmodule_relationship', $values); $result = db_process_sql_insert('tmodule_relationship', $values);
} }
return $result; return $result;
} }
@ -2092,7 +2092,7 @@ function modules_add_relation ($id_module_a, $id_module_b) {
*/ */
function modules_delete_relation ($id_relation) { function modules_delete_relation ($id_relation) {
$result = db_process_sql_delete('tmodule_relationship', array('id' => $id_relation)); $result = db_process_sql_delete('tmodule_relationship', array('id' => $id_relation));
return $result; return $result;
} }
@ -2107,11 +2107,125 @@ function modules_change_relation_lock ($id_relation) {
$old_value = (int) db_get_value('disable_update', 'tmodule_relationship', 'id', $id_relation); $old_value = (int) db_get_value('disable_update', 'tmodule_relationship', 'id', $id_relation);
$new_value = $old_value === 1 ? 0 : 1; $new_value = $old_value === 1 ? 0 : 1;
$result = db_process_sql_update('tmodule_relationship', $result = db_process_sql_update(
array('disable_update' => $new_value), 'tmodule_relationship',
array('id' => $id_relation)); array('disable_update' => $new_value),
array('id' => $id_relation));
return ($result !== false ? $new_value : $old_value); return ($result !== false ? $new_value : $old_value);
} }
function modules_get_count_datas($id_agent_module, $date_init, $date_end) {
$interval = modules_get_interval ($id_agent_module);
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
if (!is_numeric($date_init)) {
$date_init = strtotime($date_init);
}
if (!is_numeric($date_end)) {
$date_end = strtotime($date_end);
}
$first_date = modules_get_first_contact_date($id_agent_module);
if ($date_init < $first_date) {
$date_init = $first_date;
}
$diff = $date_end - $date_init;
return ($diff / $interval);
}
function modules_get_data_with_value($id_agent_module, $date_init,
$date_end, $value, $split_interval = false) {
global $config;
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
// TODO FOR OTHER KIND OF DATA
if (!is_numeric($date_init)) {
$date_init = strtotime($date_init);
}
if (!is_numeric($date_end)) {
$date_end = strtotime($date_end);
}
$sql = "
SELECT *
FROM tagente_datos
WHERE
datos = " . (int)$value . "
AND id_agente_modulo = " . (int)$id_agent_module . "
AND (utimestamp >= " . $date_init . " AND utimestamp <= " . $date_end . ")";
$data = db_get_all_rows_sql($sql,
$config['history_db_enabled']);
if (empty($data)) {
$data = array();
}
if ($split_interval) {
$temp = array();
$previous_utimestamp = false;
foreach ($data as $row) {
if ($previous_utimestamp === false) {
$previous_utimestamp = $row['utimestamp'];
$temp[] = $row;
}
else {
$diff = $row['utimestamp'] - $previous_utimestamp;
$interval = modules_get_interval($id_agent_module);
if ($diff > $interval) {
$fake_count = (int)($diff / $interval);
$fake = $row;
for ($iterator = 1; $iterator <= $fake_count; $iterator++) {
$fake['utimestamp'] = $previous_utimestamp + ($iterator * $interval);
$temp[] = $fake;
}
}
else {
$temp[] = $row;
}
$previous_utimestamp = $row['utimestamp'];
$data = $temp;
}
}
}
return $data;
}
function modules_get_first_contact_date($id_agent_module) {
global $config;
// TODO REMOVE THE TIME IN PLANNED DOWNTIME
// TODO FOR OTHER KIND OF DATA
$sql = "
SELECT utimestamp
FROM tagente_datos
WHERE id_agente_modulo = " . (int)($id_agent_module) . "
ORDER BY utimestamp ASC
LIMIT 1";
$first_date = db_get_sql($sql, 0, $config['history_db_enabled']);
return $first_date;
}
?> ?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,10 @@ function reports_get_report ($id_report, $filter = false, $fields = false) {
* *
* @return array An array with all the reports the user can view. * @return array An array with all the reports the user can view.
*/ */
function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'RR', $group = false, $strict_user) { function reports_get_reports ($filter = false, $fields = false,
$returnAllGroup = true, $privileges = 'RR', $group = false,
$strict_user = false) {
global $config; global $config;
if (! is_array ($filter)) if (! is_array ($filter))
@ -578,7 +581,8 @@ function reports_get_report_types ($template = false, $not_editor = false) {
'name' => __('Top n')); 'name' => __('Top n'));
$types['network_interfaces_report'] = array('optgroup' => __('Grouped'), $types['network_interfaces_report'] = array('optgroup' => __('Grouped'),
'name' => __('Network interfaces')); 'name' => __('Network interfaces'));
$types['availability'] = array('optgroup' => __('Grouped'),
'name' => __('Availability'));
$types['text'] = array('optgroup' => __('Text/HTML '), $types['text'] = array('optgroup' => __('Text/HTML '),

View File

@ -1,171 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// 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
// 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.
include_once("include/functions_modules.php");
include_once("include/functions_events.php");
include_once ('include/functions_groups.php');
include_once ('include/functions_netflow.php');
//xml con los datos de un agente
function xml_file_agent_data ($agent_data = array(), $file_temp) {
$file = fopen($file_temp, 'a+');
$content_report = " <name>". $agent_data['nombre']."</name>\n";
$content_report .= " <description>". $agent_data['comentarios']."</description>\n";
$content_report .= " <main_ipaddress>".$agent_data['direccion']."</main_ipaddress>\n";
$content_report .= " <group>".$agent_data['id_grupo']."</group>\n";
$content_report .= " <interval>". $agent_data['intervalo']."</interval>\n";
$sql = "SELECT t1.description, t2.name
FROM tagent_custom_data t1, tagent_custom_fields t2
WHERE t1.id_agent=".$agent_data['id_agente']."
AND t1.id_field=t2.id_field";
$custom_fields = db_get_all_rows_sql($sql);
if ($custom_fields !== false) {
foreach ($custom_fields as $field) {
$field['name'] = io_safe_output($field['name']);
//remove blank
$field['name'] = preg_replace('/\s/', '_', $field['name']);
$content_report .= " <".$field['name'].">".$field['description']."</".$field['name'].">\n";
}
}
$content_report .= " <os_type>".$agent_data['id_os']."</os_type>\n";
$content_report .= " <parent>". agents_get_name ($agent_data['id_parent'])."</parent>\n";
$content_report .= " <extra_id>".$agent_data['id_extra']."</extra_id>\n";
$content_report .= " <disabled>".$agent_data['disabled']."</disabled>\n";
$result = fwrite($file, $content_report);
$position++;
fclose($file);
return $position;
}
//xml con los datos de módulos de un agente
function xml_file_agent_conf ($modules = array(), $file_temp, $position = 0, $id_agent) {
$file = fopen($file_temp, 'a+');
foreach ($modules as $module) {
$content_report = " <object id=\"$position\">\n";
$content_report .= " <name>".$module['nombre']."</name>\n";
$content_report .= " <id>".$module['id_agente_modulo']."</id>\n";
$content_report .= " <type>".$module['id_tipo_modulo']."</type>\n";
$content_report .= " <description>".$module['descripcion']."</description>\n";
$content_report .= " <extended_info>". $module['extended_info']."</extended_info>\n";
$content_report .= " <unit>". $module['unit']."</unit>\n";
$content_report .= " <max>". $module['max']."</max>\n";
$content_report .= " <min>".$module['min']."</min>\n";
$content_report .= " <interval>". $module['module_interval']."</interval>\n";
$content_report .= " <ff_interval>". $module['module_ff_interval']."</ff_interval>\n";
$content_report .= " <tcp_port>". $module['tcp_port']."</tcp_port>\n";
$content_report .= " <tcp_send>". $module['tcp_send']."</tcp_send>\n";
$content_report .= " <tcp_rcv>". $module['tcp_rcv']."</tcp_rcv>\n";
$content_report .= " <snmp_community>". $module['snmp_community']."</snmp_community>\n";
$content_report .= " <snmp_oid>".$module['snmp_oid']."</snmp_oid>\n";
$content_report .= " <ip>". $module['ip_target']."</ip>\n";
$content_report .= " <module_group>".$module['id_module_group']."</module_group>\n";
$content_report .= " <disabled>". $module['disabled']."</disabled>\n";
$content_report .= " <id_plugin>".$module['id_plugin']."</id_plugin>\n";
$content_report .= " <post_process>". $module['post_process']."</post_process>\n";
$content_report .= " <min_warning>". $module['min_warning']."</min_warning>\n";
$content_report .= " <max_warning>". $module['max_warning']."</max_warning>\n";
$content_report .= " <str_warning>". $module['str_warning']."</str_warning>\n";
$content_report .= " <min_critical>". $module['min_critical']."</min_critical>\n";
$content_report .= " <max_critical>".$module['max_critical']."</max_critical>\n";
$content_report .= " <str_critical>". $module['str_critical']."</str_critical>\n";
$content_report .= " <id_policy_module>". $module['id_policy_module']."</id_policy_module>\n";
$content_report .= " <wizard_level>".$module['wizard_level']."</wizard_level>\n";
$content_report .= " <critical_instructions>". $module['critical_instructions']."</critical_instructions>\n";
$content_report .= " <warning_instructions>". $module['warning_instructions']."</warning_instructions>\n";
$content_report .= " <unknown_instructions>".$module['unknown_instructions']."</unknown_instructions>\n";
$content_report .= " </object>\n";
$result = fwrite($file, $content_report);
$position++;
}
fclose($file);
return $position;
}
// xml eventos
function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent) {
$file = fopen($file_temp, 'a+');
foreach ($events as $event) {
$content_report = " <object id=\"$position\">\n";
$content_report .= " <event>" . io_safe_output($event['evento']) . "</event>\n";
$content_report .= " <event_type>" . $event['event_type'] . "</event_type>\n";
$content_report .= " <criticity>" . get_priority_name($event['criticity']) . "</criticity>\n";
$content_report .= " <count>" . $event['count_rep'] . "</count>\n";
$content_report .= " <timestamp>" . $event['time2'] . "</timestamp>\n";
$content_report .= " <module_name>" . io_safe_output(modules_get_agentmodule_name ($event['id_agentmodule'])) . "</module_name>\n";
$content_report .= " <agent_name>" . io_safe_output(agents_get_name ($id_agent)) . "</agent_name>\n";
if ($event['estado'] == 0)
$status = __('New');
else if ($event['estado'] == 1)
$status = __('Validated');
else if ($event['estado'] == 2)
$status = __('In process');
else
$status = "";
$content_report .= " <event_status>".$status."</event_status>\n";
$content_report .= " <user_comment>".$event['user_comment']."</user_comment>\n";
$content_report .= " <tags>".$event['tags']."</tags>\n";
$content_report .= " <event_source>".$event['source']."</event_source>\n";
$content_report .= " <extra_id>".$event['id_extra']."</extra_id>\n";
$content_report .= " <user_validation>".$event['owner_user']."</user_validation>\n";
$content_report .= " </object>\n";
$result = fwrite($file, $content_report);
$position++;
}
fclose($file);
return $position;
}
//xml graph
function xml_file_graph ($data_module = array(), $file_temp, $position = 0) {
$file = fopen($file_temp, 'a+');
foreach ($data_module as $data_m) {
$content_report = " <object id=\"$position\">\n";
$content_report .= " <timestamp>".date ('Y-m-d H:i:s', $data_m['utimestamp'])."</timestamp>\n";
$content_report .= " <utimestamp>".$data_m['utimestamp']."</utimestamp>\n";
$content_report .= " <data>".$data_m['datos']."</data>\n";
$content_report .= " </object>\n";
$result = fwrite($file, $content_report);
$position++;
}
fclose($file);
return $position;
}
?>

View File

@ -129,7 +129,7 @@ $(document).ready (function () {
resizable: true, resizable: true,
draggable: true, draggable: true,
modal: true, modal: true,
height: 260, height: 360,
width: 590, width: 590,
overlay: { overlay: {
opacity: 0.5, opacity: 0.5,

View File

@ -153,11 +153,12 @@ $change_pass = get_parameter_post('renew_password', 0);
if ($change_pass == 1) { if ($change_pass == 1) {
$password_old = (string) get_parameter_post ('old_password', '');
$password_new = (string) get_parameter_post ('new_password', ''); $password_new = (string) get_parameter_post ('new_password', '');
$password_confirm = (string) get_parameter_post ('confirm_new_password', ''); $password_confirm = (string) get_parameter_post ('confirm_new_password', '');
$id = (string) get_parameter_post ('login', ''); $id = (string) get_parameter_post ('login', '');
$changed_pass = login_update_password_check ($password_new, $password_confirm, $id); $changed_pass = login_update_password_check ($password_old, $password_new, $password_confirm, $id);
} }
$searchPage = false; $searchPage = false;

View File

@ -63,7 +63,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.0dev'; $version = '6.0dev';
$build = '150514'; $build = '150519';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -24,45 +24,49 @@ $id_report = (int) get_parameter ('id');
if (! $id_report) { if (! $id_report) {
db_pandora_audit("HACK Attempt", db_pandora_audit("HACK Attempt",
"Trying to access graph viewer withoud ID"); "Trying to access report viewer withoud ID");
include ("general/noaccess.php"); include ("general/noaccess.php");
return; return;
} }
// Get Report record (to get id_group) // Include with the functions to calculate each kind of report.
$report = db_get_row ('treport', 'id_report', $id_report); require_once ($config['homedir'] . '/include/functions_reporting.php');
require_once ($config['homedir'] . '/include/functions_reporting_html.php');
require_once ($config['homedir'] . '/include/functions_groups.php');
enterprise_include_once("include/functions_reporting.php");
// Check ACL on the report to see if user has access to the report.
if (empty($report) || ! check_acl ($config['id_user'], $report['id_group'], "RR")) { if (!reporting_user_can_see_report($id_report)) {
db_pandora_audit("ACL Violation","Trying to access graph reader"); db_pandora_audit("ACL Violation", "Trying to access report viewer");
include ("general/noaccess.php"); include ("general/noaccess.php");
exit; exit;
} }
// Include with the functions to calculate each kind of report.
require_once ($config['homedir'] . '/include/functions_reporting.php');
require_once ($config['homedir'] . '/include/functions_groups.php');
enterprise_include("include/functions_reporting.php");
$pure = get_parameter('pure',0);
// Get different date to search the report. // Get different date to search the report.
$date = (string) get_parameter ('date', date(DATE_FORMAT)); $date = (string) get_parameter ('date', date(DATE_FORMAT));
$time = (string) get_parameter ('time', date(TIME_FORMAT)); $time = (string) get_parameter ('time', date(TIME_FORMAT));
$datetime = strtotime ($date . ' ' . $time); $datetime = strtotime ($date . ' ' . $time);
$report["datetime"] = $datetime;
// Calculations in order to modify init date of the report // Calculations in order to modify init date of the report
$date_init_less = strtotime(date('Y-m-j')) - SECONDS_1DAY; $date_init_less = strtotime(date('Y-m-j')) - SECONDS_1DAY;
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less)); $date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less)); $time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime ($date_init.' '.$time_init); $datetime_init = strtotime ($date_init . ' ' . $time_init);
$enable_init_date = get_parameter('enable_init_date', 0); $enable_init_date = get_parameter('enable_init_date', 0);
$pure = (int)get_parameter('pure', 0);
// Standard header $period = null;
// Calculate new inteval for all reports
if ($enable_init_date) {
if ($datetime_init >= $datetime) {
$datetime_init = $date_init_less;
}
$period = $datetime - $datetime_init;
}
//------------------- INIT HEADER --------------------------------------
$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time&pure=$pure"; $url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time&pure=$pure";
$options = array(); $options = array();
@ -120,23 +124,30 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
ui_meta_print_header(__('Reporting'), "", $options); ui_meta_print_header(__('Reporting'), "", $options);
} }
else { else {
ui_print_page_header (__('Reporting'). " &raquo; ". __('Custom reporting'). " - ".$report["name"], ui_print_page_header (
__('Reporting') .
" &raquo; " .
__('Custom reporting') .
" - " .
reporting_get_name($id_report),
"images/op_reporting.png", false, "", false, $options); "images/op_reporting.png", false, "", false, $options);
} }
//------------------- END HEADER ---------------------------------------
if ($enable_init_date) {
if ($datetime_init > $datetime) {
ui_print_error_message ("Invalid date selected. Initial date must be before end date.");
}
}
//------------------------ INIT FORM -----------------------------------
$table->id = 'controls_table'; $table->id = 'controls_table';
$table->width = '99%'; $table->width = '99%';
$table->class = 'databox'; $table->class = 'databox';
if (defined("METACONSOLE")){ if (defined("METACONSOLE")) {
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
$table->head[0] = __('View Report'); $table->head[0] = __('View Report');
$table->head_colspan[0] = 5; $table->head_colspan[0] = 5;
$table->headstyle[0] = 'text-align: center'; $table->headstyle[0] = 'text-align: center';
@ -172,14 +183,14 @@ if (defined("METACONSOLE")) {
else { else {
$table->data[0][1] = '<div style="">' . __("Name: ") . $report['name'] . '</div>'; $table->data[0][1] = '<div style="">' . __("Name: ") . $report['name'] . '</div>';
} }
$table->data[0][1] .= '<div style=" width:100%;">'.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true); $table->data[0][1] .= '<div style=" width:100%;">'.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true);
$html_enterprise = enterprise_hook('reporting_print_button_PDF', array($id_report)); $html_enterprise = enterprise_hook('reporting_print_button_PDF', array($id_report));
if ($html_enterprise !== ENTERPRISE_NOT_HOOK) { if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
$table->data[0][1] .= $html_enterprise; $table->data[0][1] .= $html_enterprise;
} }
$table->data[0][1] .= '</div>'; $table->data[0][1] .= '</div>';
$table->data[1][1] = '<div style="">' . __('From') . ': '; $table->data[1][1] = '<div style="">' . __('From') . ': ';
$table->data[1][1] .= html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' '; $table->data[1][1] .= html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' ';
$table->data[1][1] .= html_print_input_text ('time_init', $time_init, '', 10, 7, true). ' </div>'; $table->data[1][1] .= html_print_input_text ('time_init', $time_init, '', 10, 7, true). ' </div>';
@ -192,21 +203,23 @@ if (defined("METACONSOLE")) {
$table->data[1][2] .= html_print_input_text ('time', $time, '', 10, 7, true) . ' '; $table->data[1][2] .= html_print_input_text ('time', $time, '', 10, 7, true) . ' ';
$table->data[1][2] .= html_print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true) . ' </div>'; $table->data[1][2] .= html_print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true) . ' </div>';
} }
else{ else {
if ($report['description'] != '') { if (reporting_get_description($id_report)) {
$table->data[0][1] = '<div style="float:left">'.$report['description'].'</div>'; $table->data[0][1] = '<div style="float:left">' .
reporting_get_description($id_report) . '</div>';
} }
else { else {
$table->data[0][1] = '<div style="float:left">'.$report['name'].'</div>'; $table->data[0][1] = '<div style="float:left">' .
reporting_get_name($id_report) . '</div>';
} }
$table->data[0][1] .= '<div style="text-align:right; width:100%; margin-right:50px">'.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true); $table->data[0][1] .= '<div style="text-align:right; width:100%; margin-right:50px">'.__('Set initial date') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true);
$html_enterprise = enterprise_hook('reporting_print_button_PDF', array($id_report)); $html_enterprise = enterprise_hook('reporting_print_button_PDF', array($id_report));
if ($html_enterprise !== ENTERPRISE_NOT_HOOK) { if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
$table->data[0][1] .= $html_enterprise; $table->data[0][1] .= $html_enterprise;
} }
$table->data[0][1] .= '</div>'; $table->data[0][1] .= '</div>';
$table->data[1][1] = '<div style="float:left;padding-top:3px;">' . __('From') . ': </div>'; $table->data[1][1] = '<div style="float:left;padding-top:3px;">' . __('From') . ': </div>';
$table->data[1][1] .= html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' '; $table->data[1][1] .= html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' ';
$table->data[1][1] .= html_print_input_text ('time_init', $time_init, '', 10, 7, true). ' '; $table->data[1][1] .= html_print_input_text ('time_init', $time_init, '', 10, 7, true). ' ';
@ -218,10 +231,37 @@ else{
} }
echo '<form method="post" action="'.$url.'&pure='.$config["pure"].'" style="margin-right: 0px;">'; echo '<form method="post" action="' . $url . '&pure=' . $config["pure"] . '" style="margin-right: 0px;">';
html_print_table ($table); html_print_table ($table);
html_print_input_hidden ('id_report', $id_report); html_print_input_hidden ('id_report', $id_report);
echo '</form>'; echo '</form>';
//------------------------ END FORM ------------------------------------
if ($enable_init_date) {
if ($datetime_init > $datetime) {
ui_print_error_message(
__("Invalid date selected. Initial date must be before end date."));
}
}
$report = reporting_make_reporting_data($id_report, $date, $time, $period, 'dinamic');
reporting_html_print_report($report);
echo "<br>";
//----------------------------------------------------------------------
// Get Report record (to get id_group)
$report = db_get_row ('treport', 'id_report', $id_report);
$report["datetime"] = $datetime;
// The rowspan of the first row is only 2 in controls table. Why is used the same code here and in the items?? // The rowspan of the first row is only 2 in controls table. Why is used the same code here and in the items??
$table->rowspan[0][0] = 1; $table->rowspan[0][0] = 1;
@ -312,67 +352,5 @@ if ($datetime === false || $datetime == -1) {
return; return;
} }
// TODO: Evaluate if it's better to render blocks when are calculated
// (enabling realtime flush) or if it's better to wait report to be
// finished before showing anything (this could break the execution
// by overflowing the running PHP memory on HUGE reports).
$table->size = array ();
$table->style = array ();
$table->width = '98%';
$table->class = 'databox';
$table->rowclass = array ();
$table->rowclass[0] = 'datos3';
$report["group_name"] = groups_get_name ($report['id_group']);
switch ($config["dbtype"]) {
case "mysql":
$contents = db_get_all_rows_field_filter ("treport_content",
"id_report", $id_report, "`order`");
break;
case "postgresql":
$contents = db_get_all_rows_field_filter ("treport_content",
"id_report", $id_report, '"order"');
break;
case "oracle":
$contents = db_get_all_rows_field_filter ("treport_content",
"id_report", $id_report, '"order"');
break;
}
if ($contents === false) {
return;
}
foreach ($contents as $content) {
$table->data = array ();
$table->head = array ();
$table->style = array ();
$table->colspan = array ();
$table->rowstyle = array ();
// Calculate new inteval for all reports
if ($enable_init_date){
if ($datetime_init >= $datetime) {
$datetime_init = $date_init_less;
}
$new_interval = $report['datetime'] - $datetime_init;
$content['period'] = $new_interval;
}
reporting_render_report_html_item ($content, $table, $report);
if ($content['type'] == 'agent_module')
echo '<div style="width: 99%; overflow: auto;">';
html_print_table ($table);
if ($content['type'] == 'agent_module')
echo '</div>';
flush ();
}
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?> ?>

1456
pandora_console/operation/reporting/reporting_xml.php Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0dev %define version 6.0dev
%define release 150514 %define release 150519
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0dev %define version 6.0dev
%define release 150514 %define release 150519
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'), ('graph_res','5'),
('step_compact','1'), ('step_compact','1'),
('db_scheme_version','6.0dev'), ('db_scheme_version','6.0dev'),
('db_scheme_build','PD150514'), ('db_scheme_build','PD150519'),
('show_unknown','0'), ('show_unknown','0'),
('show_lastalerts','1'), ('show_lastalerts','1'),
('style','pandora'), ('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 6.0dev-150514 Version: 6.0dev-150519
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0dev-150514" pandora_version="6.0dev-150519"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "6.0dev"; my $pandora_version = "6.0dev";
my $pandora_build = "150514"; my $pandora_build = "150519";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0dev %define version 6.0dev
%define release 150514 %define release 150519
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0dev %define version 6.0dev
%define release 150514 %define release 150519
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "6.0dev PS150514"; my $version = "6.0dev PS150519";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "6.0dev PS150514"; my $version = "6.0dev PS150519";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);