Merge remote-tracking branch 'origin/develop' into 2784-Pantalla_por_dispositivos_filtrado_por_custom_fields

This commit is contained in:
daniel 2018-11-07 13:30:19 +01:00
commit 218bf81fa1
37 changed files with 218 additions and 188 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.728-181105 Version: 7.0NG.728-181107
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="7.0NG.728-181105" pandora_version="7.0NG.728-181107"
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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.728'; use constant AGENT_VERSION => '7.0NG.728';
use constant AGENT_BUILD => '181105'; use constant AGENT_BUILD => '181107';
# 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;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.728 %define version 7.0NG.728
%define release 181105 %define release 181107
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -95,7 +95,8 @@ if [ ! -e /etc/pandora/plugins ]; then
fi fi
if [ ! -e /etc/pandora/collections ]; then if [ ! -e /etc/pandora/collections ]; then
mkdir -p /etc/pandora/collections mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi fi
mkdir -p /var/spool/pandora/data_out mkdir -p /var/spool/pandora/data_out

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.728 %define version 7.0NG.728
%define release 181105 %define release 181107
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="7.0NG.728" PI_VERSION="7.0NG.728"
PI_BUILD="181105" PI_BUILD="181107"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -25,12 +25,33 @@
############################################################################### ###############################################################################
use strict; use strict;
use warnings;
# Retrieve information from all filesystems # Retrieve information from all filesystems
my $all_filesystems = 0; my $all_filesystems = 0;
# Regex flag # Regex flag
my $regex_mode = 0; my $regex_mode = 0;
my $inode_mode = 0;
# Exclusion
my @exclude_fs = ();
my $cmd = undef;
sub in_array {
my ($array, $value) = @_;
if (!defined($value)) {
return 0;
}
my %params = map { $_ => 1 } @{$array};
if (exists($params{$value})) {
return 1;
}
return 0;
}
sub check_re($$){ sub check_re($$){
my $item = shift; my $item = shift;
@ -65,10 +86,24 @@ if ($#ARGV < 0) {
$all_filesystems = 1; $all_filesystems = 1;
} }
# Check if regex mode is enabled while ($#ARGV >= 0) {
if ($ARGV[0] eq "-r") { my $param = shift @ARGV;
$regex_mode = 1; if ($param eq '-r') {
shift @ARGV; $regex_mode = 1;
shift @ARGV;
}
elsif ($param eq '-i') {
$inode_mode = 1;
}
elsif ($param eq '-exclude_fs') {
my $_tmp = shift @ARGV;
chomp ($_tmp);
@exclude_fs = split /,/, $_tmp;
}
elsif ($param eq '-custom_cmd') {
$cmd = shift @ARGV;
chomp ($cmd);
}
} }
# Parse command line parameters # Parse command line parameters
@ -90,7 +125,15 @@ if ($onlyexclude) {
# Retrieve filesystem information # Retrieve filesystem information
# -P use the POSIX output format for portability # -P use the POSIX output format for portability
my @df = `df -P`;
$cmd = 'df -PT' unless defined($cmd);
if ($inode_mode > 0) {
$cmd = 'df -PTi';
}
my @df = `$cmd`;
shift (@df); shift (@df);
# No filesystems? Something went wrong. # No filesystems? Something went wrong.
@ -102,9 +145,13 @@ my %out;
# Parse filesystem usage # Parse filesystem usage
foreach my $row (@df) { foreach my $row (@df) {
my @columns = split (' ', $row); my @columns = split (' ', $row);
exit 1 if ($#columns < 4); exit 1 if ($#columns < 5);
if (check_in (\%filesystems,$columns[0]) || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0]) )) {
$out{$columns[0]} = $columns[4] ; next if (in_array(\@exclude_fs, $columns[1]) > 0);
if (check_in (\%filesystems,$columns[0])
|| ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0])) ){
$out{$columns[0]} = $columns[5] ;
} }
} }
@ -115,7 +162,7 @@ while (my ($filesystem, $use) = each (%out)) {
# Print module output # Print module output
print "<module>\n"; print "<module>\n";
print "<name><![CDATA[" . $filesystem . "]]></name>\n"; print "<name><![CDATA[" . ($inode_mode > 0 ? 'Inodes:' : '') . $filesystem . "]]></name>\n";
print "<type><![CDATA[generic_data]]></type>\n"; print "<type><![CDATA[generic_data]]></type>\n";
print "<data><![CDATA[" . $use . "]]></data>\n"; print "<data><![CDATA[" . $use . "]]></data>\n";
print "<description><![CDATA[% of usage in this volume]]></description>\n"; print "<description><![CDATA[% of usage in this volume]]></description>\n";

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{181105} {181107}
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 ("7.0NG.728(Build 181105)") #define PANDORA_VERSION ("7.0NG.728(Build 181107)")
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", "(7.0NG.728(Build 181105))" VALUE "ProductVersion", "(7.0NG.728(Build 181107))"
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: 7.0NG.728-181105 Version: 7.0NG.728-181107
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="7.0NG.728-181105" pandora_version="7.0NG.728-181107"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -604,12 +604,13 @@ if ($list_modules) {
AND delete_pending = 0 AND delete_pending = 0
AND disabled = 0 AND disabled = 0
AND $status_filter_sql AND $status_filter_sql
AND $status_module_group_filter
$tags_sql $tags_sql
AND tagente_estado.estado != $monitor_filter AND tagente_estado.estado != $monitor_filter
GROUP BY tagente_modulo.id_agente_modulo
"; ";
$count_modules = db_get_all_rows_sql('SELECT COUNT(*)' . $sql_condition); $count_modules = db_get_all_rows_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_condition);
if (isset($count_modules[0])) if (isset($count_modules[0]))
$count_modules = reset($count_modules[0]); $count_modules = reset($count_modules[0]);
else else
@ -617,7 +618,9 @@ if ($list_modules) {
//Get monitors/modules //Get monitors/modules
// Get all module from agent // Get all module from agent
$sql_modules_info = 'SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*' . $sql_condition; $sql_modules_info = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
$sql_condition
GROUP BY tagente_modulo.id_agente_modulo ORDER BY $order_sql";
if ($monitors_change_filter) { if ($monitors_change_filter) {
$limit = " LIMIT " . $config['block_size'] . " OFFSET 0"; $limit = " LIMIT " . $config['block_size'] . " OFFSET 0";

View File

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

View File

@ -1377,7 +1377,7 @@ function is_management_allowed($hkey = '') {
global $config; global $config;
return ( (is_metaconsole() && $config["centralized_management"]) return ( (is_metaconsole() && $config["centralized_management"])
|| (!is_metaconsole() && !$config["centralized_management"]) || (!is_metaconsole() && !$config["centralized_management"])
|| (!is_metaconsole() && $config["centralized_management"]) && $hkey == hash('sha256', db_get_value ('value', 'tupdate_settings', 'token', 'customer_key'))); || (!is_metaconsole() && $config["centralized_management"]) && $hkey == generate_hash_to_api());
} }
/** /**
@ -3388,4 +3388,8 @@ function validate_csrf_code() {
return isset($code) && isset($_SESSION['csrf_code']) return isset($code) && isset($_SESSION['csrf_code'])
&& $_SESSION['csrf_code'] == $code; && $_SESSION['csrf_code'] == $code;
} }
function generate_hash_to_api(){
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
}
?> ?>

View File

@ -921,6 +921,10 @@ function agents_get_group_agents (
unset ($search["alias"]); unset ($search["alias"]);
} }
if (isset($search['id_os'])) {
$filter[] = "id_os = ". $search['id_os'];
}
if (isset($search['status'])) { if (isset($search['status'])) {
switch ($search['status']) { switch ($search['status']) {
case AGENT_STATUS_NORMAL: case AGENT_STATUS_NORMAL:

View File

@ -5411,7 +5411,8 @@ function api_set_planned_downtimes_created ($id, $thrash1, $other, $thrash3) {
'periodically_day_to' => $other['data'][14], 'periodically_day_to' => $other['data'][14],
'type_downtime' => $other['data'][15], 'type_downtime' => $other['data'][15],
'type_execution' => $other['data'][16], 'type_execution' => $other['data'][16],
'type_periodicity' => $other['data'][17] 'type_periodicity' => $other['data'][17],
'id_user' => $other['data'][18]
); );
$returned = planned_downtimes_created($values); $returned = planned_downtimes_created($values);
@ -10869,12 +10870,17 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
else else
db_pandora_audit("Report management", "Failed to create cluster agent $name"); db_pandora_audit("Report management", "Failed to create cluster agent $name");
returnData('string', if ($id_cluster !== false)
array('type' => 'string', 'data' => (int)$id_cluster)); returnData('string',
array('type' => 'string', 'data' => (int)$id_cluster));
else
returnError('error_set_new_cluster', __('Failed to create cluster.'));
} else { } else {
returnError('error_set_new_cluster', __('Agent name cannot be empty.')); returnError('error_set_new_cluster', __('Agent name cannot be empty.'));
return; return;
} }
return;
} }
function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) { function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) {

View File

@ -666,6 +666,7 @@ function planned_downtimes_stop ($downtime) {
function planned_downtimes_created ($values) { function planned_downtimes_created ($values) {
global $config; global $config;
$check_id_user = (bool) db_get_value ('id_user', 'tusuario', 'id_user', $values['id_user']);
$check_group = (bool) db_get_value ('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']); $check_group = (bool) db_get_value ('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']);
$check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']); $check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']);
@ -703,6 +704,26 @@ function planned_downtimes_created ($values) {
'message' => __('Not created. Error inserting data') . ". " 'message' => __('Not created. Error inserting data') . ". "
. __('The end day must be higher than the start day')); . __('The end day must be higher than the start day'));
} }
else if ($values['type_downtime'] !== 'quiet' && $values['type_downtime'] !== 'disable_agents' && $values['type_downtime'] !== 'disable_agents_alerts') {
return array('return' => false,
'message' => __('Not created. Error inserting data') . ". "
. __('The downtime must be quiet, disable_agents or disable_agents_alerts'));
}
else if ($values['type_execution'] !== 'periodically' && $values['type_execution'] !== 'once' ) {
return array('return' => false,
'message' => __('Not created. Error inserting data') . ". "
. __('The execution must be once or periodically'));
}
else if ($values['type_periodicity'] !== 'weekly' && $values['type_periodicity'] !== 'monthly' ) {
return array('return' => false,
'message' => __('Not created. Error inserting data') . ". "
. __('The periodicity must be weekly or monthly'));
}
else if (!$check_id_user){
return array('return' => false,
'message' => __('Not created. Error inserting data') . ". "
. __('User not exist'));
}
else if (!$check_group && $values['id_group'] != 0) { else if (!$check_group && $values['id_group'] != 0) {
return array('return' => false, return array('return' => false,
'message' => __('Not created. Error inserting data') . ". " 'message' => __('Not created. Error inserting data') . ". "

View File

@ -480,8 +480,8 @@ function reporting_html_SLA($table, $item, $mini) {
$row[] = $sla['module']; $row[] = $sla['module'];
if(is_numeric($sla['dinamic_text'])){ if(is_numeric($sla['dinamic_text'])){
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " . $row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
sla_truncate($sla['min'], $config['graph_precision']); sla_truncate($sla['min'], $config['graph_precision']);
} }
else{ else{
$row[] = $sla['dinamic_text']; $row[] = $sla['dinamic_text'];
@ -489,14 +489,6 @@ function reporting_html_SLA($table, $item, $mini) {
$row[] = round($sla['sla_limit'], 2) . "%"; $row[] = round($sla['sla_limit'], 2) . "%";
if (!$hide_notinit_agent) { if (!$hide_notinit_agent) {
if(is_numeric($sla['dinamic_text'])){
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
sla_truncate($sla['min'], $config['graph_precision']);
}
else{
$row[] = $sla['dinamic_text'];
}
$row[] = round($sla['sla_limit'], 2) . "%";
if (reporting_sla_is_not_init_from_array($sla)) { if (reporting_sla_is_not_init_from_array($sla)) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' . $row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .

View File

@ -530,7 +530,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
$hashdata = $user.$pwd_deserialiced['auth_token']; $hashdata = $user.$pwd_deserialiced['auth_token'];
$hashdata = md5($hashdata); $hashdata = md5($hashdata);
$url = "//" . $server_data["server_url"] . "/index.php?" . $url = $server_data["server_url"] . "/index.php?" .
"sec=estado&" . "sec=estado&" .
"sec2=operation/agentes/ver_agente&" . "sec2=operation/agentes/ver_agente&" .
"id_agente=" . $agent["id_agente"] . "&" . "id_agente=" . $agent["id_agente"] . "&" .
@ -616,7 +616,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
$go_to_agent = '<div style="text-align: right;">'; $go_to_agent = '<div style="text-align: right;">';
if($agent["id_os"] != 100){ if($agent["id_os"] != 100){
$go_to_agent .= '<a target=_blank href="' . "//" . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">'; $go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true); $go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
} }
else{ else{

View File

@ -452,6 +452,7 @@ if (! isset ($config['id_user'])) {
$id_dashboard_select = $id_dashboard_select =
db_get_value('id', 'tdashboard', 'name', $home_url); db_get_value('id', 'tdashboard', 'name', $home_url);
$_GET['id_dashboard_select'] = $id_dashboard_select; $_GET['id_dashboard_select'] = $id_dashboard_select;
$_GET['d_from_main_page'] = 1;
break; break;
case 'Visual console': case 'Visual console':
$_GET["sec"] = "network"; $_GET["sec"] = "network";
@ -1057,9 +1058,8 @@ else {
$_GET['sec2'] = 'general/logon_ok'; $_GET['sec2'] = 'general/logon_ok';
break; break;
case 'Dashboard': case 'Dashboard':
$dashboard_from_main_page = 1;
$id_dashboard = db_get_value('id', 'tdashboard', 'name', $home_url); $id_dashboard = db_get_value('id', 'tdashboard', 'name', $home_url);
$str = 'sec=reporting&sec2='.ENTERPRISE_DIR.'/dashboard/main_dashboard&id='.$id_dashboard; $str = 'sec=reporting&sec2='.ENTERPRISE_DIR.'/dashboard/main_dashboard&id='.$id_dashboard.'&d_from_main_page=1';
parse_str($str, $res); parse_str($str, $res);
foreach ($res as $key => $param) { foreach ($res as $key => $param) {
$_GET[$key] = $param; $_GET[$key] = $param;

View File

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

View File

@ -623,7 +623,7 @@ foreach ($agents as $agent) {
$data[0] = '<div class="left_' . $agent["id_agente"] . '">'; $data[0] = '<div class="left_' . $agent["id_agente"] . '">';
$data[0] .= '<span>'; $data[0] .= '<span>';
$data[0] .= '<a href="index.php?sec=view&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agent["nombre"]. '">'.$agent["alias"].'</span></a>'; $data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agent["nombre"]. '">'.$agent["alias"].'</span></a>';
$data[0] .= '</span>'; $data[0] .= '</span>';
if ($agent['quiet']) { if ($agent['quiet']) {
@ -642,7 +642,7 @@ foreach ($agents as $agent) {
$data[0] .= '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>'; $data[0] .= '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id='.$cluster['id'].'">'.__('View').'</a>';
} }
else{ else{
$data[0] .= '<a href="index.php?sec=view&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'">'.__('View').'</a>'; $data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'">'.__('View').'</a>';
} }
if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) { if (check_acl ($config['id_user'], $agent["id_grupo"], "AW")) {

View File

@ -343,7 +343,7 @@ if (!empty($result_groups)) {
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_NORMAL ."'>"; href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_NORMAL ."'>";
} else { } else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_NORMAL ."'>"; href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_NORMAL ."'>";
} }
if (($data["_id_"] == 0) && ($agents_ok != 0)) { if (($data["_id_"] == 0) && ($agents_ok != 0)) {
echo $link . $agents_ok . "</a>"; echo $link . $agents_ok . "</a>";
@ -361,7 +361,7 @@ if (!empty($result_groups)) {
href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_WARNING ."'>"; href='index.php?sec=monitoring&sec2=operation/tree&tag_id=".$data['_id_']. "&status=" . AGENT_STATUS_WARNING ."'>";
} else { } else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_WARNING ."'>"; href='index.php?sec=view&sec2=operation/agentes/estado_agente&group_id=".$data['_id_']."&status=" . AGENT_STATUS_WARNING ."'>";
} }
if (($data["_id_"] == 0) && ($agents_warning != 0)) { if (($data["_id_"] == 0) && ($agents_warning != 0)) {
echo $link . $agents_warning . "</a>"; echo $link . $agents_warning . "</a>";
@ -394,10 +394,10 @@ if (!empty($result_groups)) {
echo "<td class='group_view_data group_view_data_unk $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>"; echo "<td class='group_view_data group_view_data_unk $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (!isset($data['_is_tag_'])) { if (!isset($data['_is_tag_'])) {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_UNKNOWN . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_UNKNOWN . "'>";
} else { } else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_UNKNOWN . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_UNKNOWN . "'>";
} }
if (($data["_id_"] == 0) && ($monitor_unknown != 0)) { if (($data["_id_"] == 0) && ($monitor_unknown != 0)) {
echo $link . $monitor_unknown . "</a>"; echo $link . $monitor_unknown . "</a>";
@ -411,10 +411,10 @@ if (!empty($result_groups)) {
echo "<td class='group_view_data group_view_data_unk $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>"; echo "<td class='group_view_data group_view_data_unk $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (!isset($data['_is_tag_'])) { if (!isset($data['_is_tag_'])) {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NOT_INIT . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NOT_INIT . "'>";
} else { } else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NOT_INIT . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NOT_INIT . "'>";
} }
if (($data["_id_"] == 0) && ($monitor_not_init != 0)) { if (($data["_id_"] == 0) && ($monitor_not_init != 0)) {
echo $link . $monitor_not_init . "</a>"; echo $link . $monitor_not_init . "</a>";
@ -428,10 +428,10 @@ if (!empty($result_groups)) {
echo "<td class='group_view_data group_view_data_ok $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>"; echo "<td class='group_view_data group_view_data_ok $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (!isset($data['_is_tag_'])) { if (!isset($data['_is_tag_'])) {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NORMAL . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NORMAL . "'>";
} else { } else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NORMAL . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_NORMAL . "'>";
} }
if (($data["_id_"] == 0) && ($monitor_ok != 0)) { if (($data["_id_"] == 0) && ($monitor_ok != 0)) {
echo $link . $monitor_ok . "</a>"; echo $link . $monitor_ok . "</a>";
@ -445,10 +445,10 @@ if (!empty($result_groups)) {
echo "<td class='group_view_data group_view_data_warn $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>"; echo "<td class='group_view_data group_view_data_warn $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (!isset($data['_is_tag_'])) { if (!isset($data['_is_tag_'])) {
$link = "<a class='group_view_data group_view_data_warn $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data group_view_data_warn $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_WARNING . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_WARNING . "'>";
} else { } else {
$link = "<a class='group_view_data group_view_data_warn $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data group_view_data_warn $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_WARNING . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_WARNING . "'>";
} }
if (($data["_id_"] == 0) && ($monitor_warning != 0)) { if (($data["_id_"] == 0) && ($monitor_warning != 0)) {
echo $link . $monitor_warning . "</a>"; echo $link . $monitor_warning . "</a>";
@ -462,10 +462,10 @@ if (!empty($result_groups)) {
echo "<td class='group_view_data group_view_data_crit $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>"; echo "<td class='group_view_data group_view_data_crit $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'>";
if (!isset($data['_is_tag_'])) { if (!isset($data['_is_tag_'])) {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&ag_group=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "'>";
} else { } else {
$link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;' $link = "<a class='group_view_data $color_class' style='font-weight: bold; font-size: 18px; text-align: center;'
href='index.php?sec=estado&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "'>"; href='index.php?sec=view&sec2=operation/agentes/status_monitor&tag_filter=".$data['_id_']."&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "'>";
} }
if (($data["_id_"] == 0) && ($monitor_critical != 0)) { if (($data["_id_"] == 0) && ($monitor_critical != 0)) {
echo $link . $monitor_critical . "</a>"; echo $link . $monitor_critical . "</a>";

View File

@ -60,26 +60,9 @@ if (is_ajax ()) {
$keys_prefix = (string) get_parameter ('keys_prefix', ''); $keys_prefix = (string) get_parameter ('keys_prefix', '');
$status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL); $status_agents = (int)get_parameter('status_agents', AGENT_STATUS_ALL);
if ($id_group > 0) {
$groups = array($id_group);
if ($recursion === 'true' || $recursion == 1 ) {
$groups = array_merge($groups,
groups_get_id_recursive($id_group, true));
}
}
else {
$groups_orig = users_get_groups(false, $privilege, false);
$groups = array_keys($groups_orig);
}
// Build filter // Build filter
$filter = array(); $filter = array();
// Group filter (primary and secondary)
$filter[] = "(" .db_format_array_where_clause_sql(
array('id_grupo' => $groups, 'id_group' => $groups),
'OR'
) . ")";
if (!empty($id_os)) if (!empty($id_os))
$filter['id_os'] = $id_os; $filter['id_os'] = $id_os;
if (!empty($agent_name)) if (!empty($agent_name))
@ -87,44 +70,7 @@ if (is_ajax ()) {
if (!empty($agent_alias)) if (!empty($agent_alias))
$filter['alias'] = '%' . $agent_alias . '%'; $filter['alias'] = '%' . $agent_alias . '%';
switch ($status_agents) { $filter['status'] = $status_agents;
case AGENT_STATUS_NORMAL:
$filter[] = "(
critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND normal_count > 0)";
break;
case AGENT_STATUS_WARNING:
$filter[] = "(
critical_count = 0
AND warning_count > 0
AND total_count > 0)";
break;
case AGENT_STATUS_CRITICAL:
$filter[] = "(critical_count > 0)";
break;
case AGENT_STATUS_UNKNOWN:
$filter[] = "(
critical_count = 0
AND warning_count = 0
AND unknown_count > 0)";
break;
case AGENT_STATUS_NOT_NORMAL:
$filter[] = "(
critical_count > 0
OR warning_count > 0
OR unknown_count > 0
OR total_count = 0
OR total_count = notinit_count)";
break;
case AGENT_STATUS_NOT_INIT:
$filter[] = "(
total_count = 0
OR total_count = notinit_count)";
break;
}
$filter['order'] = "alias ASC";
if($cluster_mode){ if($cluster_mode){
@ -162,28 +108,18 @@ if (is_ajax ()) {
} }
} }
$filter['group'] = 'id_agente';
// Build fields
$fields = array('id_agente', 'alias');
// Perform search // Perform search
$agents = db_get_all_rows_filter( $agents = agents_get_group_agents($id_group,$filter,"lower",false,false,false,'|',$cluster_mode);
'tagente LEFT JOIN tagent_secondary_group ON id_agente=id_agent',
$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 !== '') {
$i = 0;
foreach ($agents as $k => $v) { foreach ($agents as $k => $v) {
$agents[$keys_prefix . $k] = io_safe_output($v); $agents[$keys_prefix . $i] = array('id_agente' => $k, 'alias' => io_safe_output($v));
unset($agents[$k]); unset($agents[$k]);
$i++;
} }
} }

View File

@ -130,36 +130,58 @@ if (isset ($_GET["modified"]) && !$view_mode) {
if ($return) { if ($return) {
$return2 = save_pass_history($id, $password_new); $return2 = save_pass_history($id, $password_new);
} }
ui_print_result_message ($return, /*ui_print_result_message ($return,
__('Password successfully updated'), __('Password successfully updated'),
__('Error updating passwords: %s', $config['auth_error'])); __('Error updating passwords: %s', $config['auth_error']));*/
} }
} }
else { else {
$return = update_user_password ($id, $password_new); $return = update_user_password ($id, $password_new);
ui_print_result_message ($return, /*ui_print_result_message ($return,
__('Password successfully updated'), __('Password successfully updated'),
__('Error updating passwords: %s', $config['auth_error'])); __('Error updating passwords: %s', $config['auth_error']));*/
} }
} }
elseif ($password_new !== "NON-INIT") { elseif ($password_new !== "NON-INIT") {
ui_print_error_message (__('Passwords didn\'t match or other problem encountered while updating passwords')); // ui_print_error_message (__('Passwords didn\'t match or other problem encountered while updating passwords'));
$error_msg = __('Passwords didn\'t match or other problem encountered while updating passwords');
} }
} }
elseif(empty($password_new) && empty($password_confirm)){
$return=true;
}
elseif(empty($password_new) || empty($password_confirm)){
$return=false;
}
// No need to display "error" here, because when no update is needed (no changes in data) // No need to display "error" here, because when no update is needed (no changes in data)
// SQL function returns 0 (FALSE), but is not an error, just no change. Previous error // SQL function returns 0 (FALSE), but is not an error, just no change. Previous error
// message could be confussing to the user. // message could be confussing to the user.
$return = update_user ($id, $upd_info); if($return){
if ($return > 0) { $success_msg = __('Password successfully updated');
ui_print_result_message ($return,
__('User info successfully updated'), $return_update_user = update_user ($id, $upd_info);
__('Error updating user info'));
if ($return_update_user === false) {
$error_msg = __('Error updating user info');
}
elseif($return_update_user == true){
$success_msg = __('User info successfully updated');
}
$user_info = $upd_info;
} }
else{
$user_info = $upd_info; if(!$error_msg){
$error_msg = __('Error updating passwords: ');
}
$user_auth_error= $config['auth_error'];
}
ui_print_result_message ($return, $success_msg, $error_msg,$user_auth_error);
} }
// Prints action status for current message // Prints action status for current message

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.728 %define version 7.0NG.728
%define release 181105 %define release 181107
# 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 7.0NG.728 %define version 7.0NG.728
%define release 181105 %define release 181107
%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

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.728-181105 Version: 7.0NG.728-181107
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="7.0NG.728-181105" pandora_version="7.0NG.728-181107"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -45,7 +45,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 = "7.0NG.728"; my $pandora_version = "7.0NG.728";
my $pandora_build = "181105"; my $pandora_build = "181107";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# 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 = "7.0NG.728"; my $pandora_version = "7.0NG.728";
my $pandora_build = "181105"; my $pandora_build = "181107";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -1917,16 +1917,18 @@ sub snmp_walk {
$timeout = $snmp->{timeout}; $timeout = $snmp->{timeout};
} }
$snmp->{extra} = '' unless defined $snmp->{extra};
if ( defined ($snmp->{version} ) if ( defined ($snmp->{version} )
&& (($snmp->{version} eq "1") && (($snmp->{version} eq "1")
|| ($snmp->{version} eq "2") || ($snmp->{version} eq "2")
|| ($snmp->{version} eq "2c"))) { || ($snmp->{version} eq "2c"))) {
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}";
} }
} }
@ -1937,42 +1939,42 @@ sub snmp_walk {
# $securityLevel = (noAuthNoPriv|authNoPriv|authPriv); # $securityLevel = (noAuthNoPriv|authNoPriv|authPriv);
# unauthenticated request # unauthenticated request
# Ex. snmpwalk -t $timeout -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime # Ex. snmpwalk -t $timeout $snmp->{extra} -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime
# authenticated request # authenticated request
# Ex. snmpwalk -t $timeout -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime # Ex. snmpwalk -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime
# authenticated and encrypted request # authenticated and encrypted request
# Ex. snmpwalk -t $timeout -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system # Ex. snmpwalk -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system
if ($snmp->{securityLevel} =~ /^noAuthNoPriv$/i){ if ($snmp->{securityLevel} =~ /^noAuthNoPriv$/i){
# Unauthenticated request # Unauthenticated request
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}";
} }
} }
elsif ($snmp->{securityLevel} =~ /^authNoPriv$/i){ elsif ($snmp->{securityLevel} =~ /^authNoPriv$/i){
# Authenticated request # Authenticated request
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}";
} }
} }
elsif ($snmp->{securityLevel} =~ /^authPriv$/i){ elsif ($snmp->{securityLevel} =~ /^authPriv$/i){
# Authenticated and encrypted request # Authenticated and encrypted request
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpwalk -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}"; $cmd = "snmpwalk -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}";
} }
} }
} }
@ -2028,16 +2030,18 @@ sub snmp_get {
$timeout = $snmp->{timeout}; $timeout = $snmp->{timeout};
} }
$snmp->{extra} = '' unless defined $snmp->{extra};
if ( defined ($snmp->{version} ) if ( defined ($snmp->{version} )
&& (($snmp->{version} eq "1") && (($snmp->{version} eq "1")
|| ($snmp->{version} eq "2") || ($snmp->{version} eq "2")
|| ($snmp->{version} eq "2c"))) { || ($snmp->{version} eq "2c"))) {
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -c $snmp->{community} $snmp->{host} $snmp->{oid}";
} }
} }
@ -2048,42 +2052,42 @@ sub snmp_get {
# $securityLevel = (noAuthNoPriv|authNoPriv|authPriv); # $securityLevel = (noAuthNoPriv|authNoPriv|authPriv);
# unauthenticated request # unauthenticated request
# Ex. snmpget -r $retries -t $timeout -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime # Ex. snmpget -r $retries -t $timeout $snmp->{extra} -On -v 3 -n "" -u noAuthUser -l noAuthNoPriv test.net-snmp.org sysUpTime
# authenticated request # authenticated request
# Ex. snmpget -r $retries -t $timeout -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime # Ex. snmpget -r $retries -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5User -a MD5 -A "The Net-SNMP Demo Password" -l authNoPriv test.net-snmp.org sysUpTime
# authenticated and encrypted request # authenticated and encrypted request
# Ex. snmpget -r $retries -t $timeout -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system # Ex. snmpget -r $retries -t $timeout $snmp->{extra} -On -v 3 -n "" -u MD5DESUser -a MD5 -A "The Net-SNMP Demo Password" -x DES -X "The Net-SNMP Demo Password" -l authPriv test.net-snmp.org system
if ($snmp->{securityLevel} =~ /^noAuthNoPriv$/i){ if ($snmp->{securityLevel} =~ /^noAuthNoPriv$/i){
# Unauthenticated request # Unauthenticated request
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}";
} }
} }
elsif ($snmp->{securityLevel} =~ /^authNoPriv$/i){ elsif ($snmp->{securityLevel} =~ /^authNoPriv$/i){
# Authenticated request # Authenticated request
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -a $snmp->{authProtocol} -A $snmp->{authKey} -l $snmp->{securityLevel} $snmp->{host} $snmp->{oid}";
} }
} }
elsif ($snmp->{securityLevel} =~ /^authPriv$/i){ elsif ($snmp->{securityLevel} =~ /^authPriv$/i){
# Authenticated and encrypted request # Authenticated and encrypted request
if (defined $snmp->{port}){ if (defined $snmp->{port}){
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host}:$snmp->{port} $snmp->{oid}";
} }
else { else {
$cmd = "snmpget -r $retries -t $timeout -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}"; $cmd = "snmpget -r $retries -t $timeout $snmp->{extra} -On -v $snmp->{version} -n \"$snmp->{context}\" -u $snmp->{securityName} -l $snmp->{securityLevel} -a $snmp->{authProtocol} -A $snmp->{authKey} -x $snmp->{privProtocol} -X $snmp->{privKey} $snmp->{host} $snmp->{oid}";
} }
} }
} }

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.728 %define version 7.0NG.728
%define release 181105 %define release 181107
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 7.0NG.728 %define version 7.0NG.728
%define release 181105 %define release 181107
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.728 PS181105"; my $version = "7.0NG.728 PS181107";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -292,22 +292,12 @@ sub pandora_purgedb ($$) {
# Delete pending modules # Delete pending modules
log_message ('PURGE', "Deleting pending delete modules (data table).", ''); log_message ('PURGE', "Deleting pending delete modules (data table).", '');
my @deleted_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 1'); my @deleted_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 1');
my @all_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo, parent_module_id FROM tagente_modulo');
foreach my $module (@deleted_modules) { foreach my $module (@deleted_modules) {
my $buffer = 1000; my $buffer = 1000;
my $id_module = $module->{'id_agente_modulo'}; my $id_module = $module->{'id_agente_modulo'};
foreach my $m (@all_modules) {
my $id_parent = $m->{'parent_module_id'};
my $id_module_fetched = $m->{'id_agente_modulo'};
if ($id_parent == $id_module) {
db_do ($dbh, 'UPDATE tagente_modulo SET parent_module_id=0 WHERE id_agente_modulo=?', $id_module_fetched);
}
}
log_message ('', "."); log_message ('', ".");
while(1) { while(1) {

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.728 PS181105"; my $version = "7.0NG.728 PS181107";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -112,7 +112,7 @@ sub help_screen{
help_screen_line('--delete_group', '<group_name>', 'Delete an agent group'); help_screen_line('--delete_group', '<group_name>', 'Delete an agent group');
help_screen_line('--update_group', '<group_id>','[<group_name> <parent_group_name> <icon> <description>]', 'Update an agent group'); help_screen_line('--update_group', '<group_id>','[<group_name> <parent_group_name> <icon> <description>]', 'Update an agent group');
help_screen_line('--stop_downtime', '<downtime_name>', 'Stop a planned downtime'); help_screen_line('--stop_downtime', '<downtime_name>', 'Stop a planned downtime');
help_screen_line('--create_downtime', "<downtime_name> <description> <date_from> <date_to> <id_group> <monday> <tuesday>\n\t <wednesday> <thursday> <friday> <saturday> <sunday> <periodically_time_from>\n\t <periodically_time_to> <periodically_day_from> <periodically_day_to> <type_downtime> <type_execution> <type_periodicity>", 'Create a planned downtime'); help_screen_line('--create_downtime', "<downtime_name> <description> <date_from> <date_to> <id_group> <monday> <tuesday>\n\t <wednesday> <thursday> <friday> <saturday> <sunday> <periodically_time_from>\n\t <periodically_time_to> <periodically_day_from> <periodically_day_to> <type_downtime> <type_execution> <type_periodicity> <id_user>", 'Create a planned downtime');
help_screen_line('--add_item_planned_downtime', "<id_downtime> <id_agente1,id_agente2,id_agente3...id_agenteN> <name_module1,name_module2,name_module3...name_moduleN> ", 'Add a items planned downtime'); help_screen_line('--add_item_planned_downtime', "<id_downtime> <id_agente1,id_agente2,id_agente3...id_agenteN> <name_module1,name_module2,name_module3...name_moduleN> ", 'Add a items planned downtime');
help_screen_line('--get_all_planned_downtimes', '<name> [<id_group> <type_downtime> <type_execution> <type_periodicity>]', 'Get all planned downtime'); help_screen_line('--get_all_planned_downtimes', '<name> [<id_group> <type_downtime> <type_execution> <type_periodicity>]', 'Get all planned downtime');
help_screen_line('--get_planned_downtimes_items', '<name> [<id_group> <type_downtime> <type_execution> <type_periodicity>]', 'Get all items of planned downtimes'); help_screen_line('--get_planned_downtimes_items', '<name> [<id_group> <type_downtime> <type_execution> <type_periodicity>]', 'Get all items of planned downtimes');
@ -4095,7 +4095,7 @@ sub cli_policy_add_agent() {
sub cli_create_planned_downtime() { sub cli_create_planned_downtime() {
my $name = @ARGV[2]; my $name = @ARGV[2];
my @todo = @ARGV[3..20]; my @todo = @ARGV[3..21];
my $other = join('|', @todo); my $other = join('|', @todo);
my $result = api_call(\%conf,'set', 'planned_downtimes_created', $name, undef, "$other"); my $result = api_call(\%conf,'set', 'planned_downtimes_created', $name, undef, "$other");
@ -6035,7 +6035,7 @@ sub pandora_manage_main ($$$) {
cli_add_tag_to_module(); cli_add_tag_to_module();
} }
elsif ($param eq '--create_downtime') { elsif ($param eq '--create_downtime') {
param_check($ltotal, 19); param_check($ltotal, 20);
cli_create_planned_downtime(); cli_create_planned_downtime();
} }
elsif ($param eq '--add_item_downtime') { elsif ($param eq '--add_item_downtime') {