Merge branch 'develop' of https://192.168.50.5:8081/artica/pandorafms into develop

This commit is contained in:
enriquecd 2016-11-16 19:03:42 +01:00
commit a89eb4ecf9
42 changed files with 355 additions and 155 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.1dev-161114 Version: 6.1dev-161116
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.1dev-161114" pandora_version="6.1dev-161116"
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.1dev'; use constant AGENT_VERSION => '6.1dev';
use constant AGENT_BUILD => '161114'; use constant AGENT_BUILD => '161116';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -2346,12 +2346,15 @@ while (1) {
if(defined($Conf{'address'})) { if(defined($Conf{'address'})) {
# Check if address is auto to get the local ip # Check if address is auto to get the local ip
if ($Conf{'address'} eq 'auto') { if ($Conf{'address'} eq 'auto') {
# Tested on Ubuntu, debian, Suse, Solaris 10 and AIX 5.1 my @address_list;
my @address_list = `ifconfig -a 2>$DevNull | grep -v '127.0.0' | grep '[0-9]*\\.[0-9]*\\.[0-9]*' | awk '{ print \$2 }' | awk -F':' '{ print \$2 }'`;
if ($#address_list < 0) { if( -x "/bin/ip" || -x "/sbin/ip" || -x "/usr/sbin/ip" ) {
# Tested on Red Hat 7 @address_list = `ip addr show 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/\\/.*//'`;
@address_list = `ip addr show 2>$DevNull | grep -v '127.0.0' | grep '[0-9]*\\.[0-9]*\\.[0-9]*' | awk '{print \$2}' | cut -d/ -f1`;
} }
else {
@address_list = `ifconfig -a 2>$DevNull | sed -e '/127.0.0/d' -e '/[0-9]*\\.[0-9]*\\.[0-9]*/!d' -e 's/^[ \\t]*\\([^ \\t]*\\)[ \\t]*\\([^ \\t]*\\)[ \\t].*/\\2/' -e 's/.*://'`;
}
for (my $i = 0; $i <= $#address_list; $i++) { for (my $i = 0; $i <= $#address_list; $i++) {
chomp($address_list[$i]); chomp($address_list[$i]);
if ($i > 0) { if ($i > 0) {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.1dev %define version 6.1dev
%define release 161114 %define release 161116
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.1dev %define version 6.1dev
%define release 161114 %define release 161116
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.1dev" PI_VERSION="6.1dev"
PI_BUILD="161114" PI_BUILD="161116"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{161114} {161116}
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.1dev(Build 161114)") #define PANDORA_VERSION ("6.1dev(Build 161116)")
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.1dev(Build 161114))" VALUE "ProductVersion", "(6.1dev(Build 161116))"
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.1dev-161114 Version: 6.1dev-161116
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.1dev-161114" pandora_version="6.1dev-161116"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -32,12 +32,12 @@ require_once ("../include/functions_html.php");
$id = get_parameter ('id'); $id = get_parameter ('id');
if (! isset($_SESSION['id_usuario'])) { if (! isset($_SESSION[$config['homeurl_static']]['id_usuario'])) {
session_start(); session_start();
session_write_close(); session_write_close();
} }
$user_language = get_user_language ($_SESSION['id_usuario']); $user_language = get_user_language ($_SESSION[$config['homeurl_static']]['id_usuario']);
if (file_exists ('../include/languages/'.$user_language.'.mo')) { if (file_exists ('../include/languages/'.$user_language.'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('../include/languages/'.$user_language.'.mo')); $l10n = new gettext_reader (new CachedFileReader ('../include/languages/'.$user_language.'.mo'));

View File

@ -140,6 +140,7 @@ switch ($action) {
case 'general': case 'general':
case 'network_interfaces_report': case 'network_interfaces_report':
case 'availability': case 'availability':
case 'agent_module':
$get_data_editor = true; $get_data_editor = true;
break; break;
@ -514,8 +515,18 @@ switch ($action) {
break; break;
case 'agent_module': case 'agent_module':
$description = $item['description']; $description = $item['description'];
$es = json_decode($item['external_source'], true);
$agents_id = get_parameter('id_agents');
if ((count($es['module']) == 1) && ($es['module'][0] == 0)) {
$module = "";
}
else {
$module = $es['module'];
}
$group = $item['id_group']; $group = $item['id_group'];
$modulegroup = $item['id_module_group']; $modulegroup = $item['id_module_group'];
$idAgentModule = $module;
break; break;
case 'inventory': case 'inventory':
$description = $item['description']; $description = $item['description'];
@ -982,6 +993,39 @@ You can of course remove the warnings, that's why we include the source and do n
</td> </td>
</tr> </tr>
<tr id="agents_row" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
<td>
<?php
$agents = agents_get_group_agents($group);
if ((empty($agents)) || $agents == -1) $agents = array();
$agents_select = array();
foreach ($id_agents as $id) {
foreach ($agents as $key => $a) {
if ($key == (int)$id) {
$agents_select[$key] = $key;
}
}
}
html_print_select($agents, 'id_agents[]', $agents_id, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
?>
</td>
</tr>
<tr id="modules_row" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Modules'); ?></td>
<td>
<?php
$all_modules = array();
foreach ($module as $id_modul) {
$all_modules[] = modules_get_agentmodule_name($id_modul);
}
html_print_select($all_modules, 'module[]', $module, $script = '', __('None'), 0, false, true, true, '', false, "min-width: 180px");
?>
</td>
</tr>
<tr id="row_agent_multi" style="" class="datos"> <tr id="row_agent_multi" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td> <td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
<td> <td>
@ -1790,6 +1834,78 @@ $(document).ready (function () {
chooseType(); chooseType();
chooseSQLquery(); chooseSQLquery();
$("#id_agents").change(agent_changed_by_multiple_agents);
$("#combo_group").change (
function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
"id_group" : this.value,
"privilege" : "AW",
"keys_prefix" : "_"
},
function (data, status) {
$("#id_agents").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["nombre"]);
$("#id_agents").append (option);
});
},
"json"
);
}
);
$("#combo_modulegroup").change (
function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : this.value,
"id_agents" : $("#id_agents").val()
},
function (data, status) {
$("#module").html('');
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
},
"json"
);
}
);
$("#id_agents").change (
function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_modules_group_json" : 1,
"id_module_group" : $("#combo_modulegroup").val(),
"id_agents" : $("#id_agents").val()
},
function (data, status) {
$("#module").html('');
jQuery.each (data, function (id, value) {
option = $("<option></option>")
.attr ("value", value["id_agente_modulo"])
.html (value["nombre"]);
$("#module").append (option);
});
},
"json"
);
}
);
$("#text-time_to, #text-time_from").timepicker({ $("#text-time_to, #text-time_from").timepicker({
showSecond: true, showSecond: true,
timeFormat: '<?php echo TIME_FORMAT_JS; ?>', timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
@ -1817,7 +1933,6 @@ $(document).ready (function () {
async: false, async: false,
timeout: 10000, timeout: 10000,
success: function (data) { success: function (data) {
console.log(data);
switch (data) { switch (data) {
case 'boolean': case 'boolean':
case 'sparse': case 'sparse':
@ -1831,7 +1946,6 @@ $(document).ready (function () {
}); });
}); });
}); });
function create_custom_graph() { function create_custom_graph() {
@ -2328,6 +2442,8 @@ function chooseType() {
$("#row_last_value").hide(); $("#row_last_value").hide();
$("#row_filter_search").hide(); $("#row_filter_search").hide();
$("#row_percentil").hide(); $("#row_percentil").hide();
$("#agents_row").hide();
$("#modules_row").hide();
// SLA list default state // SLA list default state
$("#sla_list").hide(); $("#sla_list").hide();
@ -2717,6 +2833,8 @@ function chooseType() {
$("#row_description").show(); $("#row_description").show();
$("#row_group").show(); $("#row_group").show();
$("#row_module_group").show(); $("#row_module_group").show();
$("#agents_row").show();
$("#modules_row").show();
break; break;
case 'inventory_changes': case 'inventory_changes':

View File

@ -944,6 +944,12 @@ switch ($action) {
$values['text'] = get_parameter('text'); $values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options'); $values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true;
break;
case 'agent_module':
$es['id_agents'] = get_parameter('id_agents');
$es['module'] = get_parameter('module', "");
$values['external_source'] = json_encode($es);
$good_format = true; $good_format = true;
break; break;
case 'inventory': case 'inventory':
@ -1259,6 +1265,12 @@ switch ($action) {
$values['external_source'] = json_encode($es); $values['external_source'] = json_encode($es);
$good_format = true; $good_format = true;
break; break;
case 'agent_module':
$es['id_agents'] = get_parameter('id_agents');
$es['module'] = get_parameter('module', "");
$values['external_source'] = json_encode($es);
$good_format = true;
break;
case 'inventory_changes': case 'inventory_changes':
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$es['id_agents'] = get_parameter('id_agents'); $es['id_agents'] = get_parameter('id_agents');

View File

@ -447,6 +447,14 @@ $table_chars->data[$row][1] .= __('Line').'&nbsp;' .
$config["type_module_charts"] != 'area', true); $config["type_module_charts"] != 'area', true);
$row++; $row++;
$table_chars->data[$row][0] = __('Show only average');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Allows only show the average in graphs'), true);
$table_chars->data[$row][1] = __('Yes').'&nbsp;' .
html_print_radio_button ('only_average', 1, '', $config["only_average"], true).'&nbsp;&nbsp;';
$table_chars->data[$row][1] .= __('No').'&nbsp;' .
html_print_radio_button ('only_average', 0, '', $config["only_average"], true);
$row++;
echo "<fieldset>"; echo "<fieldset>";
echo "<legend>" . __('Charts configuration') . "</legend>"; echo "<legend>" . __('Charts configuration') . "</legend>";
html_print_table ($table_chars); html_print_table ($table_chars);

View File

@ -783,9 +783,6 @@ if ($list_modules) {
} }
} }
} }
else {
$data[0] = '';
}
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($module["id_policy_module"] != 0) { if ($module["id_policy_module"] != 0) {

View File

@ -341,15 +341,17 @@ switch ($action) {
break; break;
} }
$returnValue_value = explode('&nbsp;', $returnValue); //~ $returnValue_value = explode('&nbsp;', $returnValue);
$return = array(); $return = array();
if ($returnValue_value[1] != "") { if ($returnValue_value[1] != "") {
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1]; //~ $return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
} }
else { else {
$return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])); //~ $return['value'] = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
} }
$return['value'] = $returnValue;
$return['max_percentile'] = $layoutData['height']; $return['max_percentile'] = $layoutData['height'];
$return['width_percentile'] = $layoutData['width']; $return['width_percentile'] = $layoutData['width'];
$return['unit_text'] = $unit_text; $return['unit_text'] = $unit_text;

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC161114'; $build_version = 'PC161116';
$pandora_version = 'v6.1dev'; $pandora_version = 'v6.1dev';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
@ -112,6 +112,9 @@ require_once ($ownDir. 'functions_config.php');
// We need a timezone BEFORE calling config_process_config. // We need a timezone BEFORE calling config_process_config.
// If not we will get ugly warnings. Set Europe/Madrid by default // If not we will get ugly warnings. Set Europe/Madrid by default
// Later will be replaced by the good one. // Later will be replaced by the good one.
if (!isset($config["homeurl_static"])) {
$config["homeurl_static"] = $config["homeurl"];
}
date_default_timezone_set("Europe/Madrid"); date_default_timezone_set("Europe/Madrid");
@ -124,11 +127,6 @@ if(session_id() == '') {
$resultado = session_start(); $resultado = session_start();
} }
if (!isset($config["homeurl_static"])) {
$config["homeurl_static"] = $config["homeurl"];
}
// Set a the system timezone default // Set a the system timezone default
if ((!isset($config["timezone"])) OR ($config["timezone"] == "")) { if ((!isset($config["timezone"])) OR ($config["timezone"] == "")) {
$config["timezone"] = "Europe/Berlin"; $config["timezone"] = "Europe/Berlin";

View File

@ -244,7 +244,7 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands
$number = $number / 1000; $number = $number / 1000;
} }
return format_numeric ($number, $decimals). $shorts[$pos]; //This will actually do the rounding and the decimals return remove_right_zeros(format_numeric ($number, $decimals)). $shorts[$pos]; //This will actually do the rounding and the decimals
} }
function human_milliseconds_to_string($seconds) { function human_milliseconds_to_string($seconds) {

View File

@ -514,6 +514,8 @@ function config_update_config () {
$error_update[] = __('Default line thickness for the Custom Graph.'); $error_update[] = __('Default line thickness for the Custom Graph.');
if (!config_update_value ('type_module_charts', (string) get_parameter('type_module_charts', 'area'))) if (!config_update_value ('type_module_charts', (string) get_parameter('type_module_charts', 'area')))
$error_update[] = __('Default type of module charts.'); $error_update[] = __('Default type of module charts.');
if (!config_update_value ('only_average', (bool) get_parameter('only_average', false)))
$error_update[] = __('Default show only average or min and max');
if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false))) if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false)))
$error_update[] = __('Display data of proc modules in other format'); $error_update[] = __('Display data of proc modules in other format');
if (!config_update_value ('render_proc_ok', (string) get_parameter('render_proc_ok', __('Ok') ))) if (!config_update_value ('render_proc_ok', (string) get_parameter('render_proc_ok', __('Ok') )))

View File

@ -30,7 +30,7 @@ function post_process_get_custom_values() {
} }
else { else {
$return = json_decode( $return = json_decode(
$config['post_process_custom_values'], true); io_safe_output($config['post_process_custom_values']), true);
} }
if (empty($return)) { if (empty($return)) {

View File

@ -1505,13 +1505,15 @@ function reporting_inventory($report, $content, $type) {
function reporting_agent_module($report, $content) { function reporting_agent_module($report, $content) {
global $config; global $config;
$agents_and_modules = json_decode($content['external_source'], true);
$agents = array();
$agents = $agents_and_modules['id_agents'];
$modules = $agents_and_modules['module'];
$id_group = $content['id_group']; $id_group = $content['id_group'];
$id_module_group = $content['id_module_group']; $id_module_group = $content['id_module_group'];
$return['type'] = 'agent_module'; $return['type'] = 'agent_module';
if (empty($content['name'])) { if (empty($content['name'])) {
$content['name'] = __('Agent/Modules'); $content['name'] = __('Agent/Modules');
} }
@ -1532,54 +1534,25 @@ function reporting_agent_module($report, $content) {
$return["data"] = array(); $return["data"] = array();
$agents = array();
if ($id_group > 0) {
$agents = agents_get_group_agents($id_group);
$agents = array_keys($agents);
}
$filter_module_groups = false;
if ($id_module_group > 0) {
$filter_module_groups['id_module_group'] = $id_module_group;
}
$all_modules = agents_get_modules($agents, false,
$filter_module_groups, true, false);
$modules_by_name = array(); $modules_by_name = array();
$name = '';
$cont = 0; $cont = 0;
foreach ($all_modules as $key => $module) { foreach ($modules as $modul_id) {
if ($module == $name) { $modules_by_name[$cont]['name'] = io_safe_output(modules_get_agentmodule_name($modul_id));
$modules_by_name[$cont - 1]['id'][] = $key; $modules_by_name[$cont]['id'][] = $modul_id;
}
else {
$name = $module;
$modules_by_name[$cont]['name'] = $name;
$modules_by_name[$cont]['id'][] = $key;
$cont ++; $cont ++;
} }
} if ($modules_by_name == false || $agents == false) {
$filter_groups = array();
if ($id_group > 0) {
$filter_groups['id_grupo'] = $id_group;
}
$agents = agents_get_agents ($filter_groups);
$nagents = count($agents);
if ($all_modules == false || $agents == false) {
$return['failed'] = __('There are no agents with modules'); $return['failed'] = __('There are no agents with modules');
} }
else { else {
foreach ($agents as $agent) { foreach ($agents as $agent) {
$row = array(); $row = array();
$row['agent_status'][$agent['id_agente']] = $row['agent_status'][$agent] =
agents_get_status($agent['id_agente']); agents_get_status($agent);
$row['agent_name'] = $agent['nombre']; $row['agent_name'] = agents_get_name($agent);
$agent_modules = agents_get_modules($agent['id_agente']); $agent_modules = agents_get_modules($agent);
$row['modules'] = array(); $row['modules'] = array();
foreach ($modules_by_name as $module) { foreach ($modules_by_name as $module) {

View File

@ -815,7 +815,6 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
// Force alert execution // Force alert execution
$data[$index['force_execution']] = '';
if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM")) { if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM")) {
if ($alert["force_execution"] == 0) { if ($alert["force_execution"] == 0) {
$data[$index['force_execution']] = $data[$index['force_execution']] =

View File

@ -1013,19 +1013,20 @@ function visual_map_print_item($mode = "read", $layoutData,
global $config; global $config;
if ($type == SIMPLE_VALUE) { if ($type == SIMPLE_VALUE) {
$returnValue_value = explode('&nbsp;', $value); //~ $returnValue_value = explode('&nbsp;', $value);
//~ if ($returnValue_value[1] != "") {
//~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
//~ }
//~ else {
//~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
//~ }
if ($returnValue_value[1] != "") {
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1];
}
else {
$value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision']));
}
} }
else { else {
// If the value is a string, dont format it // If the value is a string, dont format it
if (!is_string($value)) { if (!is_string($value)) {
$value = remove_right_zeros(format_for_graph($value, $config['graph_precision'])); //~ $value = remove_right_zeros(format_for_graph($value, $config['graph_precision']));
} }
} }
@ -1144,6 +1145,8 @@ function visual_map_get_simple_value_type($process_simple_value) {
* @return string value retrieved with units * @return string value retrieved with units
*/ */
function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY) { function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY) {
global $config;
$unit_text = db_get_sql ('SELECT unit $unit_text = db_get_sql ('SELECT unit
FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module); FROM tagente_modulo WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text)); $unit_text = trim(io_safe_output($unit_text));
@ -1157,7 +1160,7 @@ function visual_map_get_simple_value($type, $id_module, $period = SECONDS_1DAY)
} }
else { else {
if ( is_numeric($value) ) if ( is_numeric($value) )
$value = format_for_graph($value, 2); $value = format_for_graph($value, $config['graph_precision']);
if (!empty($unit_text)) { if (!empty($unit_text)) {
$value .= " " . $unit_text; $value .= " " . $unit_text;
} }

View File

@ -1703,6 +1703,16 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
var y = series.data[j][1]; var y = series.data[j][1];
var how_bigger = "";
if (y > 1000000) {
how_bigger = "M";
y = y / 1000000;
}
else if (y > 1000) {
how_bigger = "K";
y = y / 1000;
}
if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) { if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) {
$('#timestamp_'+graph_id).show(); $('#timestamp_'+graph_id).show();
// If no legend, the timestamp labels are short and with value // If no legend, the timestamp labels are short and with value
@ -1741,7 +1751,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// The graphs of points type and unknown graphs will dont be updated // The graphs of points type and unknown graphs will dont be updated
if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) { if (serie_types[i] != 'points' && series.label != $('#hidden-unknown_text').val()) {
$('#legend_' + graph_id + ' .legendLabel') $('#legend_' + graph_id + ' .legendLabel')
.eq(i).html(label_aux + '= ' + parseFloat(y).toFixed(2) + ' ' + unit); .eq(i).html(label_aux + '= ' + parseFloat(y).toFixed(precision_graph) + how_bigger + ' ' + unit);
console.log($('#legend_' + graph_id + ' .legendLabel')); console.log($('#legend_' + graph_id + ' .legendLabel'));
} }

View File

@ -71,7 +71,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.1dev'; $version = '6.1dev';
$build = '161114'; $build = '161116';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -91,11 +91,11 @@ $id = get_parameter('id');
}; };
function show_others() { function show_others() {
if (!$("#checkbox-avg_only").attr('checked')) { if ($('#checkbox-avg_only').is(":checked") == true) {
$("#hidden-show_other").val(0); $("#hidden-show_other").val(1);
} }
else { else {
$("#hidden-show_other").val(1); $("#hidden-show_other").val(0);
} }
} }
//--> //-->
@ -134,11 +134,19 @@ $id = get_parameter('id');
} }
$draw_alerts = get_parameter("draw_alerts", 0); $draw_alerts = get_parameter("draw_alerts", 0);
$avg_only = get_parameter ("avg_only", 1);
$show_other = (bool)get_parameter('show_other', false); if(isset($config['only_average'])){
if ($show_other) { $avg_only = 1;
}
else {
$avg_only = 0; $avg_only = 0;
} }
$show_other = get_parameter('show_other');
if (isset($show_other)) {
$avg_only = $show_other;
}
$period = get_parameter ("period", SECONDS_1DAY); $period = get_parameter ("period", SECONDS_1DAY);
$id = get_parameter ("id", 0); $id = get_parameter ("id", 0);
$width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH); $width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH);

View File

@ -60,6 +60,7 @@ $sort = get_parameter('sort', 'none');
//When the previous page was a visualmap and show only one module //When the previous page was a visualmap and show only one module
$id_module = (int) get_parameter('id_module', 0); $id_module = (int) get_parameter('id_module', 0);
$ag_custom_fields = (array) get_parameter('ag_custom_fields', array()); $ag_custom_fields = (array) get_parameter('ag_custom_fields', array());
$module_option = (int) get_parameter('module_option', 0);
if (!is_metaconsole()) { if (!is_metaconsole()) {
$ag_group = (int) get_parameter ('ag_group', 0); $ag_group = (int) get_parameter ('ag_group', 0);
@ -95,7 +96,7 @@ $sql_from = ' FROM ttipo_modulo,tagente, tagente_modulo, tagente_estado,tmodule
$sql_conditions_base = ' WHERE tagente.id_agente = tagente_modulo.id_agente $sql_conditions_base = ' WHERE tagente.id_agente = tagente_modulo.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo AND tmodule.id_module = tagente_modulo.id_modulo'; AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo AND tmodule.id_module = tagente_modulo.id_modulo';
$sql_conditions = ' AND tagente_modulo.disabled = 0 AND tagente.disabled = 0'; $sql_conditions = ' AND tagente.disabled = 0';
if (is_numeric($ag_group)) { if (is_numeric($ag_group)) {
$id_ag_group = 0; $id_ag_group = 0;
@ -140,6 +141,16 @@ if ($ag_modulename != '') {
$ag_modulename); $ag_modulename);
} }
if ($module_option !== 0) {
if ($module_option == 1) {
// Only enabled
$sql_conditions .= sprintf (' AND tagente_modulo.disabled = 0');
}
else if ($module_option == 2) {
// Only disabled
$sql_conditions .= sprintf (' AND tagente_modulo.disabled = 1');
}
}
if ($datatype != '') { if ($datatype != '') {
$sql_conditions .= sprintf (' AND ttipo_modulo.id_tipo =' .$datatype); $sql_conditions .= sprintf (' AND ttipo_modulo.id_tipo =' .$datatype);
@ -383,17 +394,22 @@ else {
$table->data[2][1] = html_print_select ($typemodules, 'moduletype',$moduletype, '', __('All'),'', true, false, true, '', false, 'width: 150px;'); $table->data[2][1] = html_print_select ($typemodules, 'moduletype',$moduletype, '', __('All'),'', true, false, true, '', false, 'width: 150px;');
$monitor_options = array(0 => __('Everyone'), 1 => __('Only enabled'), 2 => __('Only disabled'));
$table->data[2][2] = '<span id="datatypetittle" '; $table->data[2][2] = '<span>'.__('Show monitors...').'</span>';
$table->data[2][3] = html_print_select ($monitor_options, 'module_option', $module_option, '', '','', true, false, true, '', false, 'width: 150px;');
$table->data[2][4] = '<span id="datatypetittle" ';
if(!$_GET['sort']){ if(!$_GET['sort']){
$table->data[2][2] .= 'style="display:none"'; $table->data[2][4] .= 'style="display:none"';
} }
$table->data[2][2] .= '>'.__('Data type').'</span>'; $table->data[2][4] .= '>'.__('Data type').'</span>';
$table->data[2][3] .='<div id="datatypebox">'; $table->data[2][5] .='<div id="datatypebox">';
switch ($moduletype) switch ($moduletype)
@ -435,33 +451,33 @@ else {
} }
$a = db_get_all_rows_sql($sql); $a = db_get_all_rows_sql($sql);
$table->data[2][3] .= '<select id="datatype" name="datatype" '; $table->data[2][5] .= '<select id="datatype" name="datatype" ';
if(!$_GET['sort']){ if(!$_GET['sort']){
$table->data[2][3] .= 'style="display:none"'; $table->data[2][5] .= 'style="display:none"';
} }
$table->data[2][3] .= '>'; $table->data[2][5] .= '>';
$table->data[2][3] .= '<option name="datatype" value="">'.__("All").'</option>'; $table->data[2][5] .= '<option name="datatype" value="">'.__("All").'</option>';
foreach ($a as $valor) { foreach ($a as $valor) {
$table->data[2][3] .= '<option name="datatype" value="'.$valor['id_tipo'].'" '; $table->data[2][5] .= '<option name="datatype" value="'.$valor['id_tipo'].'" ';
if($valor['id_tipo'] == $datatype){ if($valor['id_tipo'] == $datatype){
$table->data[2][3] .= 'selected'; $table->data[2][5] .= 'selected';
} }
$table->data[2][3] .= '>'.$valor['descripcion'].'</option>'; $table->data[2][5] .= '>'.$valor['descripcion'].'</option>';
} }
$table->data[2][3] .= '</select>'; $table->data[2][5] .= '</select>';
$table->data[2][3] .= '</div>'; $table->data[2][5] .= '</div>';
$table_custom_fields = new stdClass(); $table_custom_fields = new stdClass();
@ -502,7 +518,7 @@ foreach ($custom_fields as $custom_field) {
$filters = '<form method="post" action="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;ag_group=' . $filters = '<form method="post" action="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;ag_group=' .
$ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;moduletype=' . $moduletype . '&amp;datatype=' . $datatype . '&amp;status=' . $status . '&amp;sort_field=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;module_option=' . $module_option . '&amp;ag_modulename=' . $ag_modulename . '&amp;moduletype=' . $moduletype . '&amp;datatype=' . $datatype . '&amp;status=' . $status . '&amp;sort_field=' .
$sortField . '&amp;sort=' . $sort .'&amp;pure=' . $config['pure'] . $ag_custom_fields_params . '">'; $sortField . '&amp;sort=' . $sort .'&amp;pure=' . $config['pure'] . $ag_custom_fields_params . '">';
if (is_metaconsole()) { if (is_metaconsole()) {
$table->colspan[3][0] = 7; $table->colspan[3][0] = 7;
@ -828,7 +844,6 @@ switch ($config['dbtype']) {
break; break;
} }
if (! defined ('METACONSOLE')) { if (! defined ('METACONSOLE')) {
$result = db_get_all_rows_sql ($sql); $result = db_get_all_rows_sql ($sql);
@ -927,43 +942,31 @@ if (!empty($result)) {
$table->head[0] = '<span title=\'' . __('Policy') . '\'>' . __('P.') . '</span>'; $table->head[0] = '<span title=\'' . __('Policy') . '\'>' . __('P.') . '</span>';
$table->head[1] = __('Agent'); $table->head[1] = __('Agent');
if (!is_metaconsole()) {
$table->head[1] .=' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectAgentNameUp, 'alt' => 'up')) . '</a>' . $table->head[1] .=' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectAgentNameUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectAgentNameDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=' . $refr . '&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=agent_name&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectAgentNameDown, 'alt' => 'down')) . '</a>';
}
$table->head[2] = __('Data Type'); $table->head[2] = __('Data Type');
if (!is_metaconsole()) {
$table->head[2] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '</a>' . $table->head[2] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . '</a>';
}
$table->align[2] = 'left'; $table->align[2] = 'left';
$table->head[3] = __('Module name'); $table->head[3] = __('Module name');
if (!is_metaconsole()) {
$table->head[3] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' . $table->head[3] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
}
$table->head[4] = __('Server type'); $table->head[4] = __('Server type');
if (!is_metaconsole()) {
$table->head[4] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' . $table->head[4] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
}
$table->head[5] = __('Interval'); $table->head[5] = __('Interval');
if (!is_metaconsole()) {
$table->head[5] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '</a>' . $table->head[5] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . '</a>';
$table->align[5] = 'left'; $table->align[5] = 'left';
}
$table->head[6] = __('Status'); $table->head[6] = __('Status');
if (!is_metaconsole()) {
$table->head[6] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '</a>' . $table->head[6] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=status&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . '</a>';
}
$table->align[6] = 'left'; $table->align[6] = 'left';
@ -981,11 +984,9 @@ if (!empty($result)) {
} }
$table->head[10] = __('Timestamp'); $table->head[10] = __('Timestamp');
if (!is_metaconsole()) {
$table->head[10] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=timestamp&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectTimestampUp, 'alt' => 'up')) . '</a>' . $table->head[10] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=timestamp&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectTimestampUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=timestamp&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectTimestampDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=timestamp&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectTimestampDown, 'alt' => 'down')) . '</a>';
$table->align[10] = 'left'; $table->align[10] = 'left';
}
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo', $id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
'nombre', 'web_content_string'); 'nombre', 'web_content_string');

View File

@ -35,6 +35,7 @@ if (is_ajax ()) {
$get_agent_modules_json = (bool) get_parameter ('get_agent_modules_json'); $get_agent_modules_json = (bool) get_parameter ('get_agent_modules_json');
$get_agent_status_tooltip = (bool) get_parameter ("get_agent_status_tooltip"); $get_agent_status_tooltip = (bool) get_parameter ("get_agent_status_tooltip");
$get_agents_group_json = (bool) get_parameter ("get_agents_group_json"); $get_agents_group_json = (bool) get_parameter ("get_agents_group_json");
$get_modules_group_json = (bool) get_parameter ("get_modules_group_json");
$get_agent_modules_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_json_for_multiple_agents"); $get_agent_modules_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_json_for_multiple_agents");
$get_agent_modules_alerts_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_alerts_json_for_multiple_agents"); $get_agent_modules_alerts_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_alerts_json_for_multiple_agents");
$get_agents_json_for_multiple_modules = (bool) get_parameter("get_agents_json_for_multiple_modules"); $get_agents_json_for_multiple_modules = (bool) get_parameter("get_agents_json_for_multiple_modules");
@ -104,10 +105,14 @@ if (is_ajax ()) {
$agents = db_get_all_rows_filter('tagente', $filter, $fields); $agents = db_get_all_rows_filter('tagente', $filter, $fields);
if (empty($agents)) $agents = array(); if (empty($agents)) $agents = array();
foreach ($agents as $k => $v) {
$agents[$k] = io_safe_output($v);
}
// Add keys prefix // Add keys prefix
if ($keys_prefix !== '') { if ($keys_prefix !== '') {
foreach ($agents as $k => $v) { foreach ($agents as $k => $v) {
$agents[$keys_prefix . $k] = $v; $agents[$keys_prefix . $k] = io_safe_output($v);
unset($agents[$k]); unset($agents[$k]);
} }
} }
@ -116,6 +121,34 @@ if (is_ajax ()) {
return; return;
} }
if ($get_modules_group_json) {
$id_group = (int) get_parameter('id_module_group');
$id_agents = get_parameter('id_agents');
$agents = implode(",", $id_agents);
$filter_group = "";
$filter_agent = "";
if ($id_group != 0) {
$filter_group = " AND id_module_group = ". $id_group;
}
if ($agents != null) {
$filter_agent = " AND id_agente IN (" . $agents . ")";
}
$modules = db_get_all_rows_sql("SELECT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
if (empty($modules)) $modules = array();
foreach ($modules as $k => $v) {
$modules[$k] = io_safe_output($v);
}
echo json_encode($modules);
return;
}
if ($get_agent_json) { if ($get_agent_json) {
$id_agent = (int) get_parameter ('id_agent'); $id_agent = (int) get_parameter ('id_agent');
@ -135,7 +168,7 @@ if (is_ajax ()) {
$return = array(); $return = array();
foreach ($modules as $module) { foreach ($modules as $module) {
$return[$module['id_agente_modulo']] = $module['nombre']; $return[$module['id_agente_modulo']] = io_safe_output($module['nombre']);
} }
echo json_encode($return); echo json_encode($return);

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.1dev %define version 6.1dev
%define release 161114 %define release 161116
# 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.1dev %define version 6.1dev
%define release 161114 %define release 161116
%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

@ -66,7 +66,7 @@ INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
INSERT INTO tconfig (token, value) VALUES ('step_compact','1'); INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc'); INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.1dev'); INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.1dev');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD161114'); INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD161116');
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0'); INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1'); INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora'); INSERT INTO tconfig (token, value) VALUES ('style','pandora');

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 6.1dev-161114 Version: 6.1dev-161116
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.1dev-161114" pandora_version="6.1dev-161116"
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.1dev"; my $pandora_version = "6.1dev";
my $pandora_build = "161114"; my $pandora_build = "161116";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -426,6 +426,9 @@ sub pandora_load_config {
$pa_config->{"warmup_unknown_on"} = 1; # 6.1 $pa_config->{"warmup_unknown_on"} = 1; # 6.1
#$pa_config->{'include_agents'} = 0; #6.1 #$pa_config->{'include_agents'} = 0; #6.1
#
# External .enc files for XML::Parser.
$pa_config->{"enc_dir"} = ""; # > 6.0SP4
# Check for UID0 # Check for UID0
if ($pa_config->{"quiet"} != 0){ if ($pa_config->{"quiet"} != 0){
@ -956,6 +959,9 @@ sub pandora_load_config {
#elsif ($parametro =~ m/^include_agents\s+([0-1])/i) { #elsif ($parametro =~ m/^include_agents\s+([0-1])/i) {
# $pa_config->{'include_agents'}= clean_blank($1); # $pa_config->{'include_agents'}= clean_blank($1);
#} #}
elsif ($parametro =~ m/^enc_dir\s+(.*)/i) {
$pa_config->{'enc_dir'} = clean_blank($1);
}
} # end of loop for parameter # } # end of loop for parameter #
# Set to RDBMS' standard port # Set to RDBMS' standard port

View File

@ -2697,6 +2697,9 @@ sub pandora_create_module_from_hash ($$$) {
if (defined $parameters->{'id_network_component_group'}) { if (defined $parameters->{'id_network_component_group'}) {
delete $parameters->{'id_network_component_group'}; delete $parameters->{'id_network_component_group'};
} }
if (defined $parameters->{'timestamp'}) {
delete $parameters->{'timestamp'};
}
# Encrypt plug-in passwords. # Encrypt plug-in passwords.
if (defined($parameters->{'plugin_pass'})) { if (defined($parameters->{'plugin_pass'})) {

View File

@ -25,6 +25,7 @@ use threads::shared;
use Thread::Semaphore; use Thread::Semaphore;
use Time::Local; use Time::Local;
use XML::Parser::Expat;
use XML::Simple; use XML::Simple;
use POSIX qw(setsid strftime); use POSIX qw(setsid strftime);
@ -71,6 +72,29 @@ sub new ($$;$) {
# Call the constructor of the parent class # Call the constructor of the parent class
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh); my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
# Load external .enc files for XML::Parser.
if ($config->{'enc_dir'} ne '') {
if (opendir(my $dh, $config->{'enc_dir'})) {
while (my $enc_file = readdir($dh)) {
# Ignore unknown files.
next unless ($enc_file =~ m/.enc$/);
# Load the .enc file.
eval {
local $SIG{__DIE__} = {};
XML::Parser::Expat::load_encoding($config->{'enc_dir'} . '/' . $enc_file);
};
if ($@) {
print_message ($config, " [WARNING] Error loading encoding file: $enc_file", 1);
}
}
closedir($dh);
} else {
print_message($config, " [WARNING] Error opening directory " . $config->{'enc_dir'} . ": $!", 1);
}
}
bless $self, $class; bless $self, $class;
return $self; return $self;
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.1dev %define version 6.1dev
%define release 161114 %define release 161116
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.1dev %define version 6.1dev
%define release 161114 %define release 161116
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="6.1dev" PI_VERSION="6.1dev"
PI_BUILD="161114" PI_BUILD="161116"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

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.1dev PS161114"; my $version = "6.1dev PS161116";
# 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.1dev PS161114"; my $version = "6.1dev PS161116";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);