Merge branch 'develop' into 1632-Pandora_FMS_charts

This commit is contained in:
daniel 2017-12-13 17:18:36 +01:00
commit d7d1cfe81b
42 changed files with 422 additions and 152 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.716-171205
Version: 7.0NG.716-171213
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.716';
use constant AGENT_BUILD => '171205';
use constant AGENT_BUILD => '171213';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.716
%define release 171205
%define release 171213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.716
%define release 171205
%define release 171213
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.716"
PI_BUILD="171205"
PI_BUILD="171213"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{171205}
{171213}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.716(Build 171205)")
#define PANDORA_VERSION ("7.0NG.716(Build 171213)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.716(Build 171205))"
VALUE "ProductVersion", "(7.0NG.716(Build 171213))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.716-171205
Version: 7.0NG.716-171213
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.716-171205"
pandora_version="7.0NG.716-171213"
package_pear=0
package_pandora=1

View File

@ -2,6 +2,11 @@ START TRANSACTION;
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
ALTER TABLE treport_content_template ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0;
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
UPDATE tgraph_source c, (SELECT @n := 0) m SET c.field_order = @n := @n + 1;
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
COMMIT;

View File

@ -1263,6 +1263,7 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tnetflow_filter`
@ -1434,7 +1435,7 @@ ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default ''
-- ---------------------------------------------------------------------
ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0;
ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0;
ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tserver_export_data`

View File

@ -61,10 +61,10 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
$items = db_get_all_rows_sql('
SELECT id_gs, `order`
SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = ' . $id_graph . '
ORDER BY `order`');
ORDER BY `field_order`');
break;
}
@ -77,7 +77,7 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
db_process_sql_update('tgraph_source',
array('`order`' => $order_temp),
array('`field_order`' => $order_temp),
array('id_gs' => $item['id_rc']));
break;
}
@ -89,10 +89,10 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
$items = db_get_all_rows_sql('
SELECT id_gs, `order`
SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = ' . $id_graph . '
ORDER BY `order`');
ORDER BY `field_order`');
break;
}
@ -106,7 +106,7 @@ switch ($action) {
foreach ($items as $item) {
//Remove the contents from the block to sort
if (array_search($item['id_gs'], $ids) === false) {
$temp[$item['order']] = $item['id_gs'];
$temp[$item['field_order']] = $item['id_gs'];
}
}
$items = $temp;
@ -142,7 +142,7 @@ switch ($action) {
case "mysql":
db_process_sql_update('tgraph_source',
array('`order`' => ($order + 1)),
array('`field_order`' => ($order + 1)),
array('id_gs' => $id));
break;
}
@ -166,7 +166,7 @@ if ($editGraph) {
WHERE t2.id_agente_modulo = t1.id_agent_module))
AS agent_name
FROM tgraph_source t1
WHERE t1.id_graph = " . $id_graph . " order by `order`");
WHERE t1.id_graph = " . $id_graph . " order by `field_order`");
$position_array = array();
$module_array = array();
$weight_array = array();
@ -183,7 +183,7 @@ if ($editGraph) {
$weight_array[] = $graphRow['weight'];
$label_array[] = $graphRow['label'];
$agent_array[] = $graphRow['agent_name'];
$position_array[] = $graphRow['order'];
$position_array[] = $graphRow['field_order'];
}
$graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph);
@ -280,9 +280,9 @@ if (defined("METACONSOLE")) {
else {
$table->data[0][0] = "<b>". __("Sort items") . "</b>";
}
$table->data[1][0] = __('Sort selected items from position: ');
$table->data[1][0] = __('Sort selected items');
$table->data[1][1] = html_print_select_style(
array('before' => __('Move before to'), 'after' => __('Move after to')), 'move_to',
array('before' => __('before to'), 'after' => __('after to')), 'move_to',
'', '', '', '', 0, true);
$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1,
'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true);

View File

@ -66,6 +66,9 @@ if ($edit_graph) {
$height = $graphInTgraph['height'];
$check = false;
$percentil = $graphInTgraph['percentil'];
$summatory_series = $graphInTgraph['summatory_series'];
$average_series = $graphInTgraph['average_series'];
$modules_series = $graphInTgraph['modules_series'];
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = CUSTOM_GRAPH_BULLET_CHART;
@ -84,6 +87,9 @@ else {
$stacked = 4;
$check = false;
$percentil = 0;
$summatory_series = 0;
$average_series = 0;
$modules_series = 0;
}
@ -177,6 +183,16 @@ echo "</div></td>";
echo "<tr><td class='datos2'><b>".__('Percentil')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("percentil", 1, $percentil, true) . "</td></tr>";
echo "<tr><td class='datos2'><b>".__('Add summatory series') .
ui_print_help_tip (__("Adds synthetic series to the graph, using all module
values to calculate the summation and/or average in each time interval.
This feature could be used instead of synthetic modules if you only want to see a graph."), true) . "</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . "</td>
<td class='datos2'><b>".__('Add average series')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("average_series", 1, $average_series, true) . "</td></tr>";
echo "<tr><td class='datos2'><b>".__('Modules and series')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("modules_series", 1, $modules_series, true) . "</td></tr>";
echo "</table>";
if ($edit_graph) {
@ -195,6 +211,12 @@ echo '<script type="text/javascript">
}else{
$("#thresholdDiv").hide();
}
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
$("#stacked").change(function(){
@ -214,6 +236,24 @@ echo '<script type="text/javascript">
$("#thresholdDiv").hide();
}
});
$("#checkbox-summatory_series").change(function() {
if($("#checkbox-summatory_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-average_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
$("#checkbox-average_series").change(function() {
if($("#checkbox-average_series").is(":checked") && $("#checkbox-modules_series").is(":disabled")) {
$("#checkbox-modules_series").removeAttr("disabled");
} else if(!$("#checkbox-summatory_series").is(":checked")) {
$("#checkbox-modules_series").attr("disabled", true);
$("#checkbox-modules_series").attr("checked", false);
}
});
</script>';
?>

View File

@ -87,6 +87,9 @@ if ($add_graph) {
$period = get_parameter_post ("period");
$threshold = get_parameter('threshold');
$percentil = get_parameter ("percentil", 0);
$summatory_series = get_parameter ("summatory_series", 0);
$average_series = get_parameter ("average_series", 0);
$modules_series = get_parameter ("modules_series", 0);
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = $threshold;
@ -103,7 +106,10 @@ if ($add_graph) {
'private' => 0,
'id_group' => $idGroup,
'stacked' => $stacked,
'percentil' => $percentil
'percentil' => $percentil,
'summatory_series' => $summatory_series,
'average_series' => $average_series,
'modules_series' => $modules_series
);
if (trim($name) != "") {
@ -131,6 +137,9 @@ if ($update_graph) {
$period = get_parameter('period');
$stacked = get_parameter('stacked');
$percentil = get_parameter('percentil');
$summatory_series = get_parameter ("summatory_series");
$average_series = get_parameter ("average_series");
$modules_series = get_parameter ("modules_series");
$alerts = get_parameter('alerts');
$threshold = get_parameter('threshold');
@ -141,7 +150,10 @@ if ($update_graph) {
if (trim($name) != "") {
$success = db_process_sql_update('tgraph',
array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ),
array('name' => $name, 'id_group' => $id_group, 'description' => $description,
'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked,
'percentil' => $percentil, 'summatory_series' => $summatory_series,
'average_series' => $average_series, 'modules_series' => $modules_series),
array('id_graph' => $id_graph));
if ($success !== false)
db_pandora_audit("Report management", "Update graph #$id_graph");
@ -179,10 +191,14 @@ if ($add_module) {
implode("','", $id_modules).
"')");
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
foreach($id_agent_modules as $id_agent_module)
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
}
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
$order = $order['field_order'];
foreach($id_agent_modules as $id_agent_module){
$order++;
$result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order));
}
}
else
$result = false;
}

View File

@ -60,7 +60,6 @@ if ($update_snmp_translation) {
if ($delete_snmp_filter) {
$filter_id = get_parameter('filter_id');
html_debug($filter_id, true);
db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $filter_id));
return;

View File

@ -709,36 +709,52 @@ function ldap_process_user_login ($login, $password) {
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")";
$justthese = array("objectclass=group");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login));
if (!$sr == false){
$user_dn=$sr["dn"];
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$memberof = ldap_get_entries($ds, $sr);
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) {
$correct = true;
}
} else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
}
}
@ldap_close ($ds);
return false;
}
else {
$memberof = $memberof[0];
}
unset($memberof["count"]);
} else {
$sr = ldap_search($ds, $dc, $filter, $justthese);
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
$correct = true;
}
}
else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
}
}
@ldap_close ($ds);
$memberof = ldap_get_entries($ds, $sr);
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
@ldap_close ($ds);
return false;
} else {
$memberof = $memberof[0];
}
unset($memberof["count"]);
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
$correct = true;
}
} else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
}
}
@ldap_close ($ds);
}
if ($correct) {
return true;
}
@ -802,22 +818,26 @@ function get_ldap_login_attr ($login) {
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("mail");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'],io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login));
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
if (!$sr == false){
$id_user=$sr["mail"];
@ldap_close ($ds);
} else {
$sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0 ,2);
$info = ldap_get_entries($ds, $sr);
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
@ldap_close ($ds);
return $id_user;
} else {
$info = $info[0];
}
$id_user = $info['mail'][0];
@ldap_close ($ds);
return $id_user;
}
else {
$info = $info[0];
}
$id_user = $info['mail'][0];
@ldap_close ($ds);
break;
}
@ -904,39 +924,58 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password,
#Search group of this user it belong.
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("objectclass=group");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$memberof = ldap_get_entries($ds, $sr);
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
@ldap_close ($ds);
return false;
}
else {
$memberof = $memberof[0];
}
unset($memberof["count"]);
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
$correct = true;
}
}
else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
}
}
if (!$correct) {
@ldap_close ($ds);
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user));
return false;
if (!$sr == false) {
$user_dn=$sr["dn"];
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) {
$correct = true;
}
} else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
}
}
if (!$correct) {
@ldap_close ($ds);
return false;
}
} else {
$sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2);
$memberof = ldap_get_entries($ds, $sr);
if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
@ldap_close ($ds);
return false;
} else {
$memberof = $memberof[0];
}
unset($memberof["count"]);
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
$correct = false;
if(!empty($ldap_base_dn)) {
if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
$correct = true;
}
} else {
if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
$correct = true;
}
}
if (!$correct) {
@ldap_close ($ds);
return false;
}
}
$permissions = array();
@ -1014,21 +1053,27 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password,
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("mail");
$sr = ldap_search($ds, $dc, $filter, $justthese);
$sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user));
if (!$sr == false){
$id_user=$sr["mail"];
$user_info['fullname']=$sr["mail"];
} else {
$sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2);
$info = ldap_get_entries($ds, $sr);
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
@ldap_close ($ds);
return false;
} else {
$info = $info[0];
}
$id_user = $info['mail'][0];
$user_info['fullname'] = $id_user;
}
$info = ldap_get_entries($ds, $sr);
if ($info["count"] == 0 && !isset($info[0]["mail"])) {
@ldap_close ($ds);
return false;
}
else {
$info = $info[0];
}
$id_user = $info['mail'][0];
$user_info['fullname'] = $id_user;
break;
}
}
@ -1341,6 +1386,35 @@ function delete_user_pass_ldap ($id_user) {
return;
}
function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $access_attr, $ldap_admin_user, $ldap_admin_pass, $user) {
$filter="(" . $access_attr . "=" . $user . ")";
$shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x -h ' . $ldap_host . ' -p ' . $ldap_port . ' -P ' . $ldap_version . ' -E pr=10000/noprompt -D "' . $ldap_admin_user . '" -w ' . $ldap_admin_pass . ' -b "' . $dn . '" -s sub "' . $filter . '" | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'));
foreach($shell_ldap_search as $line) {
$values = explode("=>", $line);
if(!empty($values[0]) && !empty($values[1])) {
$user_attr[$values[0]] = $values[1];
}
}
if (empty($user_attr)) {
return false;
}
$user_dn = safe_output_accute(base64_decode($user_attr["dn"]));
if(strlen($user_dn) > 0) {
$user_attr["dn"]=$user_dn;
}
return $user_attr;
}
function safe_output_accute($string) {
$no_allowed= array ("á","é","í","ó","ú","Á","É","Í","Ó","Ú","ñ","Ñ");
$allowed= array ("a","e","i","o","u","A","E","I","O","U","n","N");
$result = str_replace($no_allowed, $allowed ,$string);
return $result;
}
//Reference the global use authorization error to last auth error.
$config["auth_error"] = &$mysql_cache["auth_error"];
?>

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC171205';
$build_version = 'PC171213';
$pandora_version = 'v7.0NG.716';
// Do not overwrite default timezone set if defined.

View File

@ -202,6 +202,11 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',
$id_graph);
$series = db_get_all_rows_sql('SELECT summatory_series,average_series,modules_series FROM tgraph WHERE id_graph = '.$id_graph);
$summatory = $series[0]['summatory_series'];
$average = $series[0]['average_series'];
$modules_series = $series[0]['modules_series'];
$modules = array ();
$weights = array ();
$labels = array ();
@ -262,7 +267,10 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$percentil,
$from_interface,
$id_widget_dashboard,
$fullscale);
$fullscale,
$summatory,
$average,
$modules_series);
if ($return)
return $output;

View File

@ -573,14 +573,17 @@ function gis_get_agent_icon_map($idAgent, $state = false, $status = null) {
switch ($status) {
case 1:
case 4:
case 100:
//Critical (BAD or ALERT)
$state = ".bad";
break;
case 0:
case 300:
//Normal (OK)
$state = ".ok";
break;
case 2:
case 200:
//Warning
$state = ".warning";
break;

View File

@ -1125,11 +1125,11 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
$vconsole = false, $percentil = null, $from_interface = false,
$id_widget_dashboard=false, $fullscale = false) {
$id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0, $modules_series = 0) {
global $config;
global $graphic_type;
if(!$fullscale){
$time_format_2 = '';
$temp_range = $period;
@ -1216,7 +1216,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$weight_list[$i] = 1;
}
}
$aux_array = array();
// Set data containers
for ($i = 0; $i < $resolution; $i++) {
$timestamp = $datelimit + ($interval * $i);/*
@ -1268,12 +1269,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// If its a projection graph,
// first module will be data and second will be the projection
if ($projection != false && $i != 0) {
if ($automatic_custom_graph_meta)
$agent_module_id = $module_list[0]['module'];
else
$agent_module_id = $module_list[0];
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type);
@ -1284,7 +1285,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else
$agent_module_id = $module_list[$i];
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type);
@ -1358,6 +1358,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
continue;
}
// if(empty($aux_array)){
// foreach ($data as $key => $value) {
// $aux_array[$value['utimestamp']] = $value['datos'];
// }
// } else {
// foreach ($data as $key => $value) {
// if(array_key_exists($value['utimestamp'],$aux_array)){
// $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos'];
// } else {
// $aux_array[$value['utimestamp']] = $value['datos'];
// }
// }
// }
// html_debug($aux_array);
if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) {
if ($labels[$agent_module_id] != '')
$module_name_list[$i] = $labels[$agent_module_id];
@ -2150,7 +2165,91 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$threshold_data['red_inverse'] = (bool)$red_inverse;
}
}
//summatory and average series
if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) {
if($summatory && $average) {
foreach ($graph_values as $key => $value) {
$cont = count($value);
$summ = array_sum($value);
array_push($value,$summ);
array_push($value,$summ/$cont);
$graph_values[$key] = $value;
if(!$modules_series) {
array_splice($graph_values[$key],0,count($graph_values[$key])-2);
}
}
if(!$modules_series) {
if(is_null($percentil)) {
array_splice($module_name_list,0,count($module_name_list));
} else {
array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
}
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
if(is_null($percentil)) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
}
}
} elseif($summatory) {
foreach ($graph_values as $key => $value) {
array_push($value,array_sum($value));
$graph_values[$key] = $value;
if(!$modules_series){
array_splice($graph_values[$key],0,count($graph_values[$key])-1);
}
}
if(!$modules_series) {
if(is_null($percentil)) {
array_splice($module_name_list,0,count($module_name_list));
} else {
array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
}
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} else {
if(is_null($percentil)) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('summatory'). '</span>');
}
}
} elseif($average) {
foreach ($graph_values as $key => $value) {
$summ = array_sum($value) / count($value);
array_push($value,$summ);
$graph_values[$key] = $value;
if(!$modules_series){
array_splice($graph_values[$key],0,count($graph_values[$key])-1);
}
}
if(!$modules_series) {
if(is_null($percentil)) {
array_splice($module_name_list,0,count($module_name_list));
} else {
array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
}
array_unshift($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
if(is_null($percentil)) {
array_push($module_name_list,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
} else {
array_splice($module_name_list,(count($module_name_list)/2),0,'<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . __('average'). '</span>');
}
}
}
}
switch ($stacked) {
case CUSTOM_GRAPH_AREA:
return area_graph($flash_charts, $graph_values, $width,

View File

@ -998,6 +998,7 @@ function modules_is_string($id_agentmodule) {
function modules_is_boolean_type ($id_type) {
$type_name = modules_get_type_name($id_type);
if ($type_name === "keep_alive") return true;
return (bool)preg_match('/_proc$/', $type_name);
}

View File

@ -185,7 +185,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
include_javascript_dependencies_flot_graph();
$menu = (int)$menu;
// Get a unique identifier to graph
$graph_id = uniqid('graph_');
@ -500,6 +499,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
$short_data = false;
}
// Javascript code
$return .= "<script type='text/javascript'>";
$return .= "$(document).ready( function () {";

View File

@ -286,7 +286,7 @@ function EventZoomEnd (evt,zoom = map.zoom) {
* @return none
*/
function changeShowStatus(newShowStatus) {
statusShow = newShowStatus;
statusShow = newShowStatus;
hideAgentsStatus();
EventZoomEnd(null,map.zoom);
js_refreshParentLines();
@ -305,19 +305,19 @@ function hideFeatureByStatus(feature, status) {
switch (statusShow) {
case 'bad':
if ((status == 1) || (status == 4))
if ((status == 1) || (status == 4) || (status == 100))
feature.style.display = '';
break;
case 'warning':
if (status == 2)
if ((status == 2) || (status == 200))
feature.style.display = '';
break;
case 'ok':
if (status == 0)
if ((status == 0) || (status == 300))
feature.style.display = '';
break;
case 'default':
if ((status != 1) && (status != 4) && (status != 2) && (status != 0))
if ((status != 1) && (status != 4) && (status != 2) && (status != 0) && (status != 100) && (status != 200) && (status != 300))
feature.style.display = '';
break;
case 'all':
@ -337,19 +337,19 @@ function isHideFeatureByStatus(status) {
switch (statusShow) {
case 'bad':
if ((status == 1) || (status == 4))
if ((status == 1) || (status == 4) || (status == 100))
returnVar = false;
break;
case 'warning':
if (status == 2)
if ((status == 2) || (status == 200))
returnVar = false;
break;
case 'ok':
if (status == 0)
if ((status == 0) || (status == 300))
returnVar = false;
break;
case 'default':
if ((status != 1) && (status != 4) && (status != 2) && (status != 0))
if ((status != 1) && (status != 4) && (status != 2) && (status != 0) && (status != 100) && (status != 200) && (status != 300))
returnVar = false;
break;
case 'all':

View File

@ -719,6 +719,29 @@ if (! isset ($config['id_user'])) {
}
}
else {
if ( ($_GET["loginhash_data"]) && ($_GET["loginhash_data"])) {
$loginhash_data = get_parameter("loginhash_data", "");
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
$iduser = $_SESSION["id_usuario"];
//logoff_db ($iduser, $_SERVER["REMOTE_ADDR"]); check why is not available
unset($_SESSION["id_usuario"]);
unset($iduser);
if ($config["loginhash_pwd"] != "" && $loginhash_data == md5($loginhash_user.io_output_password($config["loginhash_pwd"]))) {
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $loginhash_user;
$config["id_user"] = $loginhash_user;
}
else {
require_once ('general/login_page.php');
db_pandora_audit("Logon Failed (loginhash", "", "system");
while (@ob_end_flush ());
exit ("</html>");
}
}
$user_in_db = db_get_row_filter('tusuario',
array('id_user' => $config['id_user']), '*');
if ($user_in_db == false) {

View File

@ -71,7 +71,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.716';
$build = '171205';
$build = '171213';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.716
%define release 171205
%define release 171213
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.716
%define release 171205
%define release 171213
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1192,6 +1192,7 @@ CREATE TABLE IF NOT EXISTS `tgraph` (
`percentil` tinyint(1) UNSIGNED NOT NULL default 0,
`summatory_series` tinyint(1) UNSIGNED NOT NULL default 0,
`average_series` tinyint(1) UNSIGNED NOT NULL default 0,
`modules_series` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_graph`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -1205,7 +1206,7 @@ CREATE TABLE IF NOT EXISTS `tgraph_source` (
`id_agent_module` int(11) NOT NULL default 0,
`weight` float(8,3) NOT NULL DEFAULT 0,
`label` varchar(150) DEFAULT '',
`order` int(10) DEFAULT 0,
`field_order` int(10) DEFAULT 0,
PRIMARY KEY(`id_gs`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -17,8 +17,8 @@ function help {
echo " "
echo "This plugin is used to check performance of Volumes and Instances in the EC2 Cloud"
echo "Syntax:"
echo -e "\t\t-A Access KEY ID, p.e AKIAILTVJ3S26GTKLD4A"
echo -e "\t\t-S Secret Access Key, p.e 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"
echo -e "\t\t-A Access KEY ID, p.e AKIAILTVCAS26GTKLD4A"
echo -e "\t\t-S Secret Access Key, p.e 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"
echo -e "\t\t-R Region, p.e us-east-1"
echo -e "\t\t-m Metric to gather (see doc for a metric list) "
echo -e "\t\t-n Namespace (p.e: AWS/EC2, AWS/EBS) "
@ -27,7 +27,7 @@ function help {
echo -e "\t\t-z Show default metrics "
echo -e "\t\t-h Show this messages "
echo "Samples:"
echo " ./ec2_plugin.sh -A AKIAILTVJ3S26GTKLD4A -S CgmQ6DxUWES05txfe+juJLoM57acDudHogkLotWk -i i-9d0b4af1 -n AWS/EC2 -m CPUUtilization"
echo " ./ec2_plugin.sh -A AKIAILTVCAS26GTKLD4A -S CgmQ6DxUWES05txju+alJLoM57acDudHogkLotWk -i i-9d0b4af1 -n AWS/EC2 -m CPUUtilization"
echo
exit 0

View File

@ -20,8 +20,8 @@ function help {
echo " ./$progname [-A access-key -S secret-key][-R region] -f config -i instance-id -n field-name"
echo -e "\t\t-f path of configu file"
echo -e "\t\t-R Region, p.e us-east-1"
echo -e "\t\t-A Access KEY ID, p.e AKIAILTVJ3S26GTKLD4A"
echo -e "\t\t-S Secret Access Key, p.e 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"
echo -e "\t\t-A Access KEY ID, p.e AKIAILTVCAS26GTKLD4A"
echo -e "\t\t-S Secret Access Key, p.e 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"
echo -e "\t\t-i Instance ID, p.e i-9d0b4af1"
echo -e "\t\t-n Field Name, p.e type, public-dns, .."
echo -e "\t\t-h Show this messages"

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.716-171205
Version: 7.0NG.716-171213
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.716-171205"
pandora_version="7.0NG.716-171213"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.716";
my $pandora_build = "171205";
my $pandora_build = "171213";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -37,7 +37,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.716";
my $pandora_build = "171205";
my $pandora_build = "171213";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -887,14 +887,14 @@ sub disk_free ($) {
# Check relative path
my $unit;
if ($target =~ m/^([a-zA-Z]):/gi) {
$unit = $1/(1024*1024);
$unit = $1;
} else {
return;
}
# Get the free space of unit found
my $all_disk_info = `wmic logicaldisk get caption, freespace`;
if ($all_disk_info =~ m/$unit:\D*(\d+)/gmi){
return $1;
return $1/(1024*1024);
}
return;
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.716
%define release 171205
%define release 171213
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.716
%define release 171205
%define release 171213
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.716"
PI_BUILD="171205"
PI_BUILD="171213"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.716 PS171205";
my $version = "7.0NG.716 PS171213";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.716 PS171205";
my $version = "7.0NG.716 PS171213";
# save program name for logging
my $progname = basename($0);