Merge branch 'develop' into feature/NewTreeView

This commit is contained in:
Alejandro Gallardo Escobar 2015-01-26 17:51:39 +01:00
commit c765f6c957
60 changed files with 1836 additions and 423 deletions

View File

@ -101,8 +101,10 @@ noscript {
.termframe {
float: left;
background-color: #567953;
padding: 0.2ex;
background-color: none repeat scroll 0% 0% #82B92E;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
}
.termframe p {

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.0dev-150119
Version: 6.0dev-150126
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="6.0dev-150119"
pandora_version="6.0dev-150126"
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 => '6.0dev';
use constant AGENT_BUILD => '150119';
use constant AGENT_BUILD => '150126';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {

View File

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

View File

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

View File

@ -34,7 +34,7 @@ if ($#ARGV < 0) {
# Parse command line parameters
my %filesystems;
foreach my $fs (@ARGV) {
$filesystems{$fs} = '-1%';
$filesystems{$fs} = '0%';
}
# Retrieve filesystem information
@ -51,7 +51,7 @@ if ($#df < 0) {
foreach my $row (@df) {
my @columns = split (' ', $row);
exit 1 if ($#columns < 4);
$filesystems{$columns[5]} = $columns[4] if (defined ($filesystems{$columns[0]}) || $all_filesystems == 1);
$filesystems{$columns[5]} = $columns[4] if (defined ($filesystems{$columns[5]}) || $all_filesystems == 1);
}
my $free;

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150119}
{150126}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0dev(Build 150119)")
#define PANDORA_VERSION ("6.0dev(Build 150126)")
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", "(6.0dev(Build 150119))"
VALUE "ProductVersion", "(6.0dev(Build 150126))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150119
Version: 6.0dev-150126
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="6.0dev-150119"
pandora_version="6.0dev-150126"
package_pear=0
package_pandora=1

View File

@ -0,0 +1,366 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/*
function extension_db_status_extension_tables() {
return array(
'tbackup',
'tfiles_repo',
'tfiles_repo_group',
'tipam_ip',
'tipam_network',
'tuser_task',
'tuser_task_scheduled',
);
}
*/
function extension_db_status() {
global $config;
$db_user = get_parameter('db_user', '');
$db_password = get_parameter('db_password', '');
$db_host = get_parameter('db_host', '');
$db_name = get_parameter('db_name', '');
$db_status_execute = (bool)get_parameter('db_status_execute', false);
ui_print_page_header (__("DB Status"),
"images/extensions.png", false, "", true, "");
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation",
"Trying to access db status");
require ("general/noaccess.php");
return;
}
ui_print_info_message(
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.'));
ui_print_info_message(
__('At the moment the checks is for MySQL/MariaDB.'));
echo "<form method='post'>";
echo "<fieldset>";
echo "<legend>" . __('DB settings') . "</legend>";
$table = null;
$table->data = array();
$row = array();
$row[] = __("DB User with privileges");
$row[] = html_print_input_text('db_user', $db_user, '', 50, 255, true);
$row[] = __("DB Password for this user");
$row[] = html_print_input_password('db_password', $db_password, '', 50, 255, true);
$table->data[] = $row;
$row = array();
$row[] = __("DB Hostname");
$row[] = html_print_input_text('db_host', $db_host, '', 50, 255, true);
$row[] = __("DB Name (temporal for testing)");
$row[] = html_print_input_text('db_name', $db_name, '', 50, 255, true);
$table->data[] = $row;
html_print_table($table);
echo "</fieldset>";
echo "<div style='text-align: right;'>";
html_print_input_hidden('db_status_execute', 1);
html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub"');
echo "</div>";
echo "</form>";
if ($db_status_execute) {
extension_db_status_execute_checks($db_user, $db_password,
$db_host, $db_name);
}
}
function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) {
global $config;
$connection_system = $config['dbconnection'];
// Avoid SQL injection
$db_name = io_safe_output($db_name);
$db_name = str_replace(';', ' ', $db_name);
$db_name = explode(" ", $db_name);
$db_name = $db_name[0];
$connection_test = mysql_connect ($db_host, $db_user, $db_password);
if (!$connection_test) {
ui_print_error_message(
__('Unsuccessful connected to the DB'));
}
else {
$create_db = mysql_query ("CREATE DATABASE `$db_name`");
if (!$create_db) {
ui_print_error_message(
__('Unsuccessful created the testing DB'));
}
else {
mysql_select_db($db_name, $connection_test);
$install_tables = extension_db_status_execute_sql_file(
$config['homedir'] . "/pandoradb.sql",
$connection_test);
if (!$install_tables) {
ui_print_error_message(
__('Unsuccessful installed tables into the testing DB'));
}
else {
if (enterprise_installed()) {
$install_tables_enterprise =
extension_db_status_execute_sql_file(
$config['homedir'] . "/enterprise/pandoradb.sql",
$connection_test);
if (!$install_tables_enterprise) {
ui_print_error_message(
__('Unsuccessful installed enterprise tables into the testing DB'));
}
}
extension_db_check_tables_differences(
$connection_test,
$connection_system,
$db_name,
$config['dbname']);
//extension_db_check_data_differences();
}
mysql_select_db($db_name, $connection_test);
mysql_query ("DROP DATABASE IF EXISTS `$db_name`");
}
}
}
function extension_db_check_tables_differences($connection_test,
$connection_system, $db_name_test, $db_name_system) {
global $config;
// --------- Check the tables --------------------------------------
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query("SHOW TABLES", $connection_test);
$tables_test = array();
while ($row = mysql_fetch_array ($result)) {
$tables_test[] = $row[0];
}
mysql_free_result ($result);
//~ $tables_test = array_merge($tables_test,
//~ extension_db_status_extension_tables());
mysql_select_db($db_name_system, $connection_system);
$result = mysql_query("SHOW TABLES", $connection_system);
$tables_system = array();
while ($row = mysql_fetch_array ($result)) {
$tables_system[] = $row[0];
}
mysql_free_result ($result);
$diff_tables = array_diff($tables_test, $tables_system);
//~ html_debug_print($tables_test);
//~ html_debug_print($tables_system);
//~ html_debug_print($diff_tables);
ui_print_result_message(
empty($diff_tables),
__('Successful the DB Pandora has all tables'),
__('Unsuccessful the DB Pandora has not all tables. The tables lost are (%s)',
implode(", ", $diff_tables)));
if (!empty($diff_tables)) {
foreach ($diff_tables as $table) {
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
$tables_test = array();
while ($row = mysql_fetch_array ($result)) {
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
$row[1] .
'</pre>'
);
}
mysql_free_result ($result);
}
}
// --------------- Check the fields -------------------------------
$correct_fields = true;
foreach ($tables_system as $table) {
mysql_select_db($db_name_test, $connection_test);
$result = mysql_query("EXPLAIN " . $table, $connection_test);
$fields_test = array();
if (!empty($result)) {
while ($row = mysql_fetch_array ($result)) {
$fields_test[$row[0]] = array(
'field ' => $row[0],
'type' => $row[1],
'null' => $row[2],
'key' => $row[3],
'default' => $row[4],
'extra' => $row[5]);
}
mysql_free_result ($result);
}
mysql_select_db($db_name_system, $connection_system);
$result = mysql_query("EXPLAIN " . $table, $connection_system);
$fields_system = array();
if (!empty($result)) {
while ($row = mysql_fetch_array ($result)) {
$fields_system[$row[0]] = array(
'field ' => $row[0],
'type' => $row[1],
'null' => $row[2],
'key' => $row[3],
'default' => $row[4],
'extra' => $row[5]);
}
mysql_free_result ($result);
}
foreach ($fields_test as $name_field => $field_test) {
if (!isset($fields_system[$name_field])) {
$correct_fields = false;
ui_print_error_message(
__('Unsuccessful the table %s has not the field %s',
$table, $name_field));
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " ADD COLUMN " . $name_field . " text;" .
'</pre>'
);
}
else {
$correct_fields = false;
$field_system = $fields_system[$name_field];
$diff = array_diff($field_test, $field_system);
if (!empty($diff)) {
foreach ($diff as $config_field => $value) {
switch ($config_field) {
case 'type':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the type with %s.',
$name_field, $table, $value));
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $field . " " . $value . ";" .
'</pre>'
);
break;
case 'null':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the null values with %s.',
$name_field, $table, $value));
if ($value == "no") {
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $field . "INT NULL;" .
'</pre>'
);
}
else {
ui_print_info_message(
__('You can execute this SQL query for to fix.') . "<br />" .
'<pre>' .
"ALTER TABLE " . $table . " MODIFY COLUMN " . $field . "INT NOT NULL;" .
'</pre>'
);
}
break;
case 'key':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the key as defined in the SQL file.',
$name_field, $table));
ui_print_info_message(
__('Please check the SQL file for to know the kind of key needed.'));
break;
case 'default':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the default value as %s.',
$name_field, $table, $value));
ui_print_info_message(
__('Please check the SQL file for to know the kind of default value needed.'));
break;
case 'extra':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted as defined in the SQL file.',
$name_field, $table));
ui_print_info_message(
__('Please check the SQL file for to know the kind of extra config needed.'));
break;
}
}
}
}
}
}
if ($correct_fields) {
ui_print_success_message(
__('Successful all the tables have the correct fields')
);
}
}
function extension_db_status_execute_sql_file($url, $connection) {
if (file_exists($url)) {
$file_content = file($url);
$query = "";
foreach ($file_content as $sql_line) {
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
$query .= $sql_line;
if (preg_match("/;[\040]*\$/", $sql_line)) {
if (!$result = mysql_query($query, $connection)) {
echo mysql_error(); //Uncomment for debug
echo "<i><br>$query<br></i>";
return 0;
}
$query = "";
}
}
}
return 1;
}
else
return 0;
}
extensions_add_godmode_function('extension_db_status');
extensions_add_godmode_menu_option(__('DB Status'), 'PM', 'gdbman', null, "v1r1");
?>

View File

@ -33,6 +33,7 @@ $alert = alerts_get_alert_agent_module($id_alert);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$actions = alerts_get_alert_agent_module_actions ($id_alert);
$agent_name = modules_get_agentmodule_agent_name ($alert['id_agent_module']);
$agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$module_name = modules_get_agentmodule_name ($alert['id_agent_module']);
// Default action
@ -57,8 +58,14 @@ $table_details->style = array();
$table_details->style[0] = 'font-weight: bold;';
$data = array();
$data[0] = __('List alerts');
$data[1] ='<a style=" font-size: 7pt;" href="index.php?sec=galertas&sec2=godmode/alerts/alert_list" title="'.__('List alerts').
'"><b><span style=" font-size: 7pt;">'.__('List alerts').'</span></b></a>';
$table_details->data[] = $data;
$data[0] = __('Agent');
$data[1] = $agent_name;
$data[1] ='<a style=" font-size: 7pt;" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent.
'" title="'.$agent_name.'"><b><span style=" font-size: 7pt;">'.$agent_name.'</span></b></a>';
$table_details->data[] = $data;
$data[0] = __('Module');

View File

@ -92,7 +92,7 @@ if ($fields_selected[0]!='') {
$result = __('Alert');
break;
case 'criticity':
$result = __('Criticity');
$result = __('Severity');
break;
case 'user_comment':
$result = __('Comment');

View File

@ -0,0 +1,249 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
db_pandora_audit("ACL Violation",
"Trying to access massive tag addition");
require ("general/noaccess.php");
return;
}
require_once ('include/functions_agents.php');
require_once ('include/functions_tags.php');
function process_manage_add ($id_agents, $modules, $id_tags) {
if (empty ($id_agents) || $id_agents[0] == 0) {
ui_print_error_message(__('No agents selected'));
return false;
}
if (empty ($modules)) {
ui_print_error_message(__('No modules selected'));
return false;
}
if (empty ($id_tags)) {
ui_print_error_message(__('No tags selected'));
return false;
}
$modules_id = array();
foreach ($modules as $module) {
foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
if (count($modules) == 1 && $modules[0] == '0') {
foreach ($id_agents as $id_agent) {
$modules_temp = agents_get_modules($id_agent);
foreach ($modules_temp as $id_module => $name_module) {
$modules_id[] = $id_module;
}
}
}
$conttotal = 0;
$contsuccess = 0;
foreach ($modules_id as $id_module) {
$err_count = tags_insert_module_tag($id_module, $id_tags);
if ($err_count == 0) {
$contsuccess ++;
}
$conttotal ++;
}
if ($contsuccess > 0) {
db_pandora_audit("Massive management", "Add tags", false, false,
"");
}
else {
db_pandora_audit("Massive management", "Fail try to add tags",
false, false, "");
}
ui_print_result_message ($contsuccess > 0,
__('Successfully added') . "(" . $contsuccess . "/" . $conttotal . ")",
__('Could not be added'));
}
$id_agents = get_parameter ('id_agents');
$id_tags = get_parameter ('id_tags');
$modules = get_parameter ('module');
$add = (bool) get_parameter_post ('add');
if ($add) {
process_manage_add ($id_agents, $modules, $id_tags);
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
$table->id = 'add_table';
$table->width = '98%';
$table->data = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align:top';
$table->style[2] = 'font-weight: bold; vertical-align:top';
$table->size = array ();
$table->size[0] = '15%';
$table->size[1] = '40%';
$table->size[2] = '15%';
$table->size[3] = '40%';
$table->data = array ();
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(false, "AW",
$return_all_group, 'id_group', 0, '', 'Select', -1, true, false,
true, '', false, 'width:180px;');
$table->data[1][0] = __('Agents');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= html_print_image('images/spinner.png', true);
$table->data[1][0] .= '</span>';
$agents = agents_get_group_agents(
array_keys(users_get_groups ($config["id_user"], "AW", false)));
$table->data[1][1] = html_print_select ($agents,
'id_agents[]', '', '', '', '', true, true, true, '', false, 'width:180px;');
$table->data[1][2] = __('Modules');
$table->data[1][2] .= '<span id="module_loading" class="invisible">';
$table->data[1][2] .= html_print_image('images/spinner.png', true);
$table->data[1][2] .= '</span>';
$table->data[1][3] = '<input type="hidden" id="modules_selection_mode" value="all" />' .
html_print_select (array(), 'module[]', '', false, '', '', true, true, false, '', false, 'width:180px;');
$table->data[2][0] = __('Tags');
$tags = tags_get_all_tags();
$table->data[2][1] = html_print_select ($tags,
'id_tags[]', '', '', '', '', true, true, true, '', false, 'width:180px;');
echo '<form method="post"
id="form_tags"
action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=add_tags">';
html_print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden ('add', 1);
html_print_submit_button (__('Add'), 'go', false, 'class="sub add"');
echo '</div>';
echo '</form>';
// TODO: Change to iu_print_error system
echo '<h3 class="error invisible" id="message"> </h3>';
//Hack to translate text "none" in PHP to javascript
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
ui_require_jquery_file ('form');
ui_require_jquery_file ('pandora.controls');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#checkbox-recursion").click(function () {
$("#id_group").trigger("change");
});
$("#id_agents").change(agent_changed_by_multiple_agents);
$("#id_group").change (function () {
var $select = $("#id_agents").enable ();
$("#agent_loading").show ();
$("option", $select).remove ();
jQuery.post ("ajax.php",
{
"page" : "godmode/massive/massive_add_alerts",
"get_agents" : 1,
"id_group" : this.value,
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
// Add a key prefix to avoid auto sorting in js object conversion
"keys_prefix" : "_"
},
function (data, status) {
options = "";
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
options += "<option value=\""+id+"\">"+value+"</option>";
});
$("#id_agents").append (options);
$("#agent_loading").hide ();
$select.enable ();
},
"json"
);
});
$("#id_group").value = "0";
$("#id_group").click (
function () {
$(this).css ("width", "auto");
});
$("#id_group").blur (function () {
$(this).css ("width", "180px");
});
$("#id_agents").click (
function () {
$(this).css ("width", "auto");
});
$("#id_agents").blur (function () {
$(this).css ("width", "180px");
});
$("#module").click (
function () {
$(this).css ("width", "auto");
});
$("#module").blur (function () {
$(this).css ("width", "180px");
});
$("#modules_selection_mode").change (function() {
$("#id_agents").trigger('change');
});
});
/* ]]> */
</script>

View File

@ -0,0 +1,305 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
check_login ();
if (! check_acl ($config['id_user'], 0, "AW")) {
db_pandora_audit("ACL Violation",
"Trying to access massive tag deletion");
require ("general/noaccess.php");
return;
}
require_once ('include/functions_agents.php');
require_once ('include/functions_tags.php');
if (is_ajax ()) {
$get_agents = (bool)get_parameter('get_agents', false);
$get_modules = (bool)get_parameter('get_modules', false);
if ($get_agents) {
$id_tag = (int)get_parameter('id_tag', 0);
$agents = tags_get_agents($id_tag);
if (!empty($agents)) {
$temp = array();
foreach ($agents as $id_agent) {
$temp[$id_agent] = agents_get_name($id_agent);
}
$agents = $temp;
}
echo json_encode($agents);
return;
}
if ($get_modules) {
$id_tag = (int)get_parameter('id_tag', 0);
$id_agents = (array)get_parameter('id_agents', array());
if (!empty($id_agents)) {
foreach ($id_agents as $key => $id) {
$id_agents[$key] = (int)$id;
}
$data = db_get_all_rows_sql("
SELECT nombre
FROM tagente_modulo
WHERE id_agente IN (" . implode(',', $id_agents) . ")
AND id_agente_modulo IN (
SELECT t1.id_agente_modulo
FROM ttag_module AS t1
WHERE id_tag = " . $id_tag . "
AND id_policy_module = 0)
GROUP BY nombre;");
if (empty($data)) {
echo json_encode(array());
}
else {
$modules = array();
foreach ($data as $row) {
$modules[] = $row['nombre'];
}
echo json_encode($modules);
}
}
else {
echo json_encode(array());
}
return;
}
return;
}
function process_manage_delete ($id_agents, $modules, $id_tag) {
if (empty ($id_agents) || $id_agents[0] == 0) {
ui_print_error_message(__('No agents selected'));
return false;
}
if (empty ($modules) || $modules[0] == "0") {
ui_print_error_message(__('No modules selected'));
return false;
}
if (empty ($id_tag)) {
ui_print_error_message(__('No tag selected'));
return false;
}
$modules_id = array();
foreach ($modules as $module) {
$data = db_get_all_rows_sql("
SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre = '" . $module . "'
AND id_agente IN (" . implode(",", $id_agents) . ")
");
if (empty($data)) {
$data = array();
}
foreach ($data as $row) {
$modules_id[$row['id_agente_modulo']] = $row['id_agente_modulo'];
}
}
$conttotal = 0;
$contsuccess = 0;
foreach ($modules_id as $id_module) {
$success = tags_remove_tag($id_tag, $id_module);
if ($success) {
$contsuccess ++;
}
$conttotal ++;
}
if ($contsuccess > 0) {
db_pandora_audit("Massive management", "Delete tags", false, false,
"");
}
else {
db_pandora_audit("Massive management", "Fail try to delete tags",
false, false, "");
}
ui_print_result_message ($contsuccess > 0,
__('Successfully deleted') . "(" . $contsuccess . "/" . $conttotal . ")",
__('Could not be deleted'));
}
$id_agents = get_parameter ('id_agents');
$id_tag = (int)get_parameter ('id_tag');
$modules = get_parameter ('modules');
$delete = (bool) get_parameter_post ('delete');
if ($delete) {
process_manage_delete ($id_agents, $modules, $id_tag);
}
$groups = users_get_groups ();
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
$table->id = 'add_table';
$table->width = '98%';
$table->data = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align:top';
$table->style[2] = 'font-weight: bold; vertical-align:top';
$table->size = array ();
$table->size[0] = '15%';
$table->size[1] = '40%';
$table->size[2] = '15%';
$table->size[3] = '40%';
$table->data = array ();
$table->data[0][0] = __('Tags');
$tags = tags_get_all_tags();
$table->data[0][1] = html_print_select ($tags,
'id_tag', '', '', '', '', true, false, true, '', false, 'min-width:180px;');
$table->data[1][0] = __('Agents');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= html_print_image('images/spinner.png', true);
$table->data[1][0] .= '</span>';
$table->data[1][1] = html_print_select (array(),
'id_agents[]', '', '', '', '', true, true, true, '', false, 'min-width:180px;');
$table->data[2][0] = __('Modules');
$table->data[2][0] .= '<span id="modules_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$table->data[2][1] = '<input type="hidden" id="modules_selection_mode" value="all" />' .
html_print_select (array(), 'modules[]', '', false, '', '', true, true, false, '', false, 'min-width:180px;');
echo '<form method="post"
id="form_tags"
action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_tags">';
html_print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
html_print_input_hidden ('delete', 1);
html_print_submit_button (__('Delete'), 'go', false, 'class="sub delete"');
echo '</div>';
echo '</form>';
// TODO: Change to iu_print_error system
echo '<h3 class="error invisible" id="message"> </h3>';
//Hack to translate text "none" in PHP to javascript
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';
ui_require_jquery_file ('form');
ui_require_jquery_file ('pandora.controls');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#id_tag").change(function() {
$("#agent_loading").show();
jQuery.post ("ajax.php",
{
"page" : "godmode/massive/massive_delete_tags",
"get_agents" : 1,
"id_tag" : this.value,
},
function (data, status) {
$("#id_agents").empty();
options = "";
jQuery.each (data, function (id, value) {
options += "<option value=\""+id+"\">"+value+"</option>";
});
if (options == "") {
$("#id_agents").append(
"<option value=\"0\"><?php echo __('None');?></option>");
}
else {
$("#id_agents").append (options);
}
$("#agent_loading").hide ();
$("#id_agents").trigger('change');
},
"json"
);
});
//~ $("#id_agents").change(agent_changed_by_multiple_agents);
$("#id_agents").change(function() {
//Fill modules
$("#modules_loading").show();
jQuery.post ("ajax.php",
{
"page" : "godmode/massive/massive_delete_tags",
"get_modules" : 1,
"id_tag": $("#id_tag").val(),
"id_agents[]" : $("#id_agents").val(),
},
function (data, status) {
$("#modules").empty();
options = "";
jQuery.each (data, function (id, value) {
options += "<option value=\""+value+"\">"+value+"</option>";
});
if (options == "") {
$("#modules").append(
"<option value=\"0\"><?php echo __('None');?></option>");
}
else {
$("#modules").append (options);
}
$("#modules_loading").hide ();
},
"json"
);
});
$("#id_tag").trigger('change');
});
/* ]]> */
</script>

View File

@ -40,6 +40,11 @@ $options_alerts = array(
'enable_disable_alerts' => __('Massive alert enable/disable'),
'standby_alerts' => __('Massive alert setting standby'));
$options_tags = array(
'add_tags' => __('Massive tags addition'),
'delete_tags' => __('Massive tags deletion')
);
$options_agents = array(
'edit_agents' => __('Massive agents edition'),
'delete_agents' => __('Massive agents deletion'));
@ -89,6 +94,9 @@ if ($satellite_options != ENTERPRISE_NOT_HOOK) {
if (in_array($option, array_keys($options_alerts))) {
$tab = 'massive_alerts';
}
elseif (in_array($option, array_keys($options_tags))) {
$tab = 'massive_tags';
}
elseif (in_array($option, array_keys($options_agents))) {
$tab = 'massive_agents';
}
@ -112,6 +120,9 @@ else {
}
switch ($tab) {
case 'massive_tags':
$options = $options_tags;
break;
case 'massive_alerts':
$options = $options_alerts;
break;
@ -140,9 +151,18 @@ if ($option == '') {
$option = array_shift(array_keys($options));
}
$alertstab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts">'
. html_print_image ('images/op_alerts.png', true, array ('title' => __('Alerts operations')))
. '</a>', 'active' => $tab == 'massive_alerts');
$tagstab = array('text' =>
'<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_tags">' .
html_print_image ('images/tag.png', true,
array('title' => __('Tags operations'))) . '</a>',
'active' => $tab == 'massive_tags');
$alertstab = array('text' =>
'<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts">' .
html_print_image ('images/op_alerts.png', true,
array('title' => __('Alerts operations'))) . '</a>',
'active' => $tab == 'massive_alerts');
$userstab = array('text' => '<a href="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_users">'
. html_print_image ('images/op_workspace.png', true, array ('title' => __('Users operations')))
@ -180,6 +200,7 @@ $onheader['massive_modules'] = $modulestab;
if (check_acl ($config['id_user'], 0, "PM")) {
$onheader['user_agents'] = $userstab;
}
$onheader['massive_tags'] = $tagstab;
$onheader['massive_alerts'] = $alertstab;
$onheader['policies'] = $policiestab;
$onheader['snmp'] = $snmptab;
@ -292,6 +313,12 @@ switch ($option) {
case 'copy_modules':
require_once ('godmode/massive/massive_copy_modules.php');
break;
case 'add_tags':
require_once ('godmode/massive/massive_add_tags.php');
break;
case 'delete_tags':
require_once ('godmode/massive/massive_delete_tags.php');
break;
default:
if (!enterprise_hook('massive_operations', array($option))) {
require_once ('godmode/massive/massive_config.php');

View File

@ -64,6 +64,7 @@ if (check_acl ($config['id_user'], 0, "AW")) {
$sub["godmode/massive/massive_operations&amp;tab=massive_users"]["text"] = __('Users operations');
}
$sub["godmode/massive/massive_operations&amp;tab=massive_alerts"]["text"] = __('Alerts operations');
$sub["godmode/massive/massive_operations&amp;tab=massive_tags"]["text"] = __('Tags operations');
enterprise_hook('massivepolicies_submenu');
enterprise_hook('massivesnmp_submenu');
enterprise_hook('massivesatellite_submenu');

View File

@ -44,7 +44,7 @@ $data[3] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version,
push_table_row ($data, 'snmp_port');
$data = array ();
$data[0] = __('SNMP OID');
$data[0] = __('SNMP Enterprise String');
$data[1] = html_print_input_text ('snmp_oid', $snmp_oid, '', 30, 400, true);
//$table->colspan['snmp_2'][1] = 3;
$data[2] = __('SNMP community');

118
pandora_console/godmode/snmpconsole/snmp_alert.php Normal file → Executable file
View File

@ -515,7 +515,7 @@ if ($create_alert || $update_alert) {
//echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>';
// OID
echo '<tr id="tr-oid"><td class="datos2">'.__('OID').'</td><td class="datos2">';
echo '<tr id="tr-oid"><td class="datos2">'.__('Enterprise String').'</td><td class="datos2">';
html_print_input_text ("oid", $oid, '', 50, 255);
echo '</td></tr>';
@ -548,18 +548,20 @@ if ($create_alert || $update_alert) {
html_print_input_text ("single_value", $single_value, '', 20);
echo '</td></tr>';
// Custom OID/Data #1
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
echo ui_print_help_icon ("field_match_snmp", true);
echo '</td><td class="datos">';
// Variable bindings/Data #1
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data') .
ui_print_help_icon ("field_match_snmp", true) .
'</td>' .
'<td class="datos">';
echo '#';
html_print_input_text ("order_1", $order_1, '', 4);
html_print_input_text ("custom_oid_data_1", $custom_oid_data_1, '', 60);
echo '</td></tr>';
// Custom OID/Data #2
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #2
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Variable bindings/Data');
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
@ -568,8 +570,8 @@ if ($create_alert || $update_alert) {
html_print_input_text ("custom_oid_data_2", $custom_oid_data_2, '', 60);
echo '</td></tr>';
// Custom OID/Data #3
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #3
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Variable bindings/Data');
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
@ -578,8 +580,10 @@ if ($create_alert || $update_alert) {
html_print_input_text ("custom_oid_data_3", $custom_oid_data_3, '', 60);
echo '</td></tr>';
// Custom OID/Data #4
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #4
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
@ -588,8 +592,10 @@ if ($create_alert || $update_alert) {
html_print_input_text ("custom_oid_data_4", $custom_oid_data_4, '', 60);
echo '</td></tr>';
// Custom OID/Data #5
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #5
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
@ -598,8 +604,10 @@ if ($create_alert || $update_alert) {
html_print_input_text ("custom_oid_data_5", $custom_oid_data_5, '', 60);
echo '</td></tr>';
// Custom OID/Data #6
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #6
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
//echo ui_print_help_icon ("snmp_alert_custom", true);
echo '</td><td class="datos">';
@ -608,112 +616,128 @@ if ($create_alert || $update_alert) {
html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60);
echo '</td></tr>';
// Custom OID/Data #7
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #7
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_7", $order_7, '', 4);
html_print_input_text ("custom_oid_data_7", $custom_oid_data_7, '', 60);
echo '</td></tr>';
// Custom OID/Data #8
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #8
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_8", $order_8, '', 4);
html_print_input_text ("custom_oid_data_8", $custom_oid_data_8, '', 60);
echo '</td></tr>';
// Custom OID/Data #9
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #9
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_9", $order_9, '', 4);
html_print_input_text ("custom_oid_data_9", $custom_oid_data_9, '', 60);
echo '</td></tr>';
// Custom OID/Data #10
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #10
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_10", $order_10, '', 4);
html_print_input_text ("custom_oid_data_10", $custom_oid_data_10, '', 60);
echo '</td></tr>';
// Custom OID/Data #11
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #11
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_11", $order_11, '', 4);
html_print_input_text ("custom_oid_data_11", $custom_oid_data_11, '', 60);
echo '</td></tr>';
// Custom OID/Data #12
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #12
echo '<tr id="tr-custom_value">' .
'<td class="datos" valign="top">' . __('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_12", $order_12, '', 4);
html_print_input_text ("custom_oid_data_12", $custom_oid_data_12, '', 60);
echo '</td></tr>';
// Custom OID/Data #13
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #13
echo '<tr id="tr-custom_value"><td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_13", $order_13, '', 4);
html_print_input_text ("custom_oid_data_13", $custom_oid_data_13, '', 60);
echo '</td></tr>';
// Custom OID/Data #14
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #14
echo '<tr id="tr-custom_value"><td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_14", $order_14, '', 4);
html_print_input_text ("custom_oid_data_14", $custom_oid_data_14, '', 60);
echo '</td></tr>';
// Custom OID/Data #15
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #15
echo '<tr id="tr-custom_value"><td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_15", $order_15, '', 4);
html_print_input_text ("custom_oid_data_15", $custom_oid_data_15, '', 60);
echo '</td></tr>';
// Custom OID/Data #16
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #16
echo '<tr id="tr-custom_value"><td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_16", $order_16, '', 4);
html_print_input_text ("custom_oid_data_16", $custom_oid_data_16, '', 60);
echo '</td></tr>';
// Custom OID/Data #17
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #17
echo '<tr id="tr-custom_value"><td class="datos" valign="top">' .
__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_17", $order_17, '', 4);
html_print_input_text ("custom_oid_data_17", $custom_oid_data_17, '', 60);
echo '</td></tr>';
// Custom OID/Data #18
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #18
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_18", $order_18, '', 4);
html_print_input_text ("custom_oid_data_18", $custom_oid_data_18, '', 60);
echo '</td></tr>';
// Custom OID/Data #19
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #19
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_19", $order_19, '', 4);
html_print_input_text ("custom_oid_data_19", $custom_oid_data_19, '', 60);
echo '</td></tr>';
// Custom OID/Data #20
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data');
// Variable bindings/Data #20
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Variable bindings/Data');
echo '</td><td class="datos">';
echo '#';
html_print_input_text ("order_20", $order_20, '', 4);
@ -842,7 +866,7 @@ else {
$table_filter->width = "98%";
$table_filter->data = array();
$table_filter->data[0][0] = __('Free search') . ui_print_help_tip(
__('Search by these fields description, OID, Custom Value, SNMP Agent (IP), Single value, each Custom OIDs/Datas.'), true);
__('Search by these fields description, OID, Custom Value, SNMP Agent (IP), Single value, each Variable bindings/Datas.'), true);
$table_filter->data[0][1] =
html_print_input_text('free_search', $free_search, '', 30, 100, true);
$table_filter->data[0][2] = __('Trap type');
@ -954,10 +978,10 @@ else {
$table->size[2] = "90px";
$table->align[2] = 'center';
$table->head[3] = __('OID');
$table->head[3] = __('Enterprise String');
$table->align[3] = 'center';
$table->head[4] = __('Custom Value/OID');
$table->head[4] = __('Custom Value/Enterprise String');
$table->align[4] = 'center';
$table->head[5] = __('Description');

View File

@ -68,7 +68,7 @@ $table->data[0][1] = html_print_input_text('snmp_host_address', $snmp_host_addre
$table->data[1][0] = __('Community');
$table->data[1][1] = html_print_input_text('snmp_community', $snmp_community, '', 50, 255, true);
$table->data[2][0] = __('OID');
$table->data[2][0] = __('Enterprise String');
$table->data[2][1] = html_print_input_text('snmp_oid', $snmp_oid, '', 50, 255, true);
$table->data[3][0] = __('SNMP Agent');

View File

@ -476,6 +476,7 @@ if ($list_modules) {
$status_filter_monitor = (int)get_parameter('status_filter_monitor', -1);
$status_text_monitor = get_parameter('status_text_monitor', '');
$filter_monitors = (bool)get_parameter('filter_monitors', false);
$status_module_group = get_parameter('status_module_group', -1);
$monitors_change_filter = (bool)get_parameter('monitors_change_filter', false);
$status_filter_sql = '1 = 1';
@ -486,6 +487,13 @@ if ($list_modules) {
$status_filter_sql = 'tagente_estado.estado = ' . $status_filter_monitor;
}
if($status_module_group != -1){
$status_module_group_filter = 'id_module_group = ' . $status_module_group;
}
else{
$status_module_group_filter = 'id_module_group >= 0';
}
$status_text_monitor_sql = '%';
if (!empty($status_text_monitor)) {
$status_text_monitor_sql .= $status_text_monitor . '%';
@ -496,19 +504,21 @@ if ($list_modules) {
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf("
SELECT COUNT(*)
FROM tagente_estado,
(SELECT *
FROM tagente_modulo
WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
AND disabled = 0) tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND %s %s
AND tagente_estado.estado != %d
ORDER BY tagente_modulo.id_module_group , %s %s",
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
SELECT COUNT(*)
FROM tagente_estado,
(SELECT *
FROM tagente_modulo
WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
AND disabled = 0 AND %s) tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND %s %s
AND tagente_estado.estado != %d
AND tagente_modulo.%s
ORDER BY tagente_modulo.id_module_group , %s %s",
$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
$status_module_group_filter, $order['field'], $order['order']);
break;
case "postgresql":
$sql = sprintf("
@ -518,22 +528,23 @@ if ($list_modules) {
FROM tagente_modulo
WHERE id_agente = %d AND nombre LIKE '%s'
AND delete_pending = 0
AND disabled = 0) tagente_modulo
AND disabled = 0 AND %s) tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND %s %s
AND tagente_estado.estado != %d
AND tagente_modulo.%s
GROUP BY tagente_modulo.id_module_group,
tagente_modulo.nombre
ORDER BY tagente_modulo.id_module_group , %s %s",
$id_agente, $status_text_monitor_sql, $status_filter_sql,
$tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'],
$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql,
$tags_sql, AGENT_MODULE_STATUS_NO_DATA,$status_module_group_filter,$order['field'],
$order['order']);
break;
case "oracle":
$sql = sprintf ("
SELECT COUNT(*)" .
SELECT COUNT(*)" .
" FROM tagente_estado, tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
@ -544,8 +555,10 @@ if ($list_modules) {
AND tagente_modulo.delete_pending = 0
AND tagente_modulo.disabled = 0
AND tagente_estado.estado != %d
AND tagente_modulo.%s
ORDER BY tagente_modulo.id_module_group , %s %s
", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
$status_module_group_filter,$order['field'], $order['order']);
break;
}
@ -566,14 +579,17 @@ if ($list_modules) {
(SELECT *
FROM tagente_modulo
WHERE id_agente = %d AND nombre LIKE \"%s\" AND delete_pending = 0
AND disabled = 0) tagente_modulo
AND disabled = 0 AND %s) tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND %s %s
AND tagente_estado.estado != %d
AND tagente_modulo.%s
ORDER BY tagente_modulo.id_module_group , %s %s",
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
$status_module_group_filter, $order['field'], $order['order']);
break;
case "postgresql":
$sql = sprintf("
@ -582,14 +598,16 @@ if ($list_modules) {
(SELECT *
FROM tagente_modulo
WHERE id_agente = %d AND nombre LIKE '%s' AND delete_pending = 0
AND disabled = 0) tagente_modulo
AND disabled = 0 AND %s) tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND %s %s
AND tagente_estado.estado != %d
AND tagente_modulo.%s
ORDER BY tagente_modulo.id_module_group , %s %s",
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
$id_agente, $status_text_monitor_sql,$status_module_group_filter,$status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA,
$status_module_group_filter, $order['field'], $order['order']);
break;
// If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table()
case "oracle":
@ -598,7 +616,7 @@ if ($list_modules) {
$fields_tmodule_group = oracle_list_all_field_table('tmodule_group', 'string');
$sql = sprintf ("
SELECT " . $fields_tagente_estado . ', ' . $fields_tagente_modulo . ', ' . $fields_tmodule_group .
SELECT " . $fields_tagente_estado . ', ' . $fields_tagente_modulo . ', ' . $fields_tmodule_group .
" FROM tagente_estado, tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
@ -609,8 +627,10 @@ if ($list_modules) {
AND tagente_modulo.delete_pending = 0
AND tagente_modulo.disabled = 0
AND tagente_estado.estado != %d
AND tagente_modulo.%s
ORDER BY tagente_modulo.id_module_group , %s %s
", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, AGENT_MODULE_STATUS_NO_DATA,
$status_module_group_filter, $order['field'], $order['order']);
break;
}
@ -649,23 +669,24 @@ if ($list_modules) {
}
$table->head[2] = __('Type') . ' ' .
'<a href="' . $url . '&sort_field=type&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=type&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
'<a href="' . $url . '&sort_field=type&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=type&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
$table->head[3] = __('Module name') . ' ' .
'<a href="javascript: order_module_list(\'name\', \'up\');">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
'<a href="javascript: order_module_list(\'name\', \'down\');">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
'<a href="' . $url . '&sort_field=name&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=name&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
$table->head[4] = __('Description');
$table->head[5] = __('Status') . ' ' .
'<a href="' . $url . '&sort_field=status&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=status&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
'<a href="' . $url . '&sort_field=status&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=status&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
$table->head[6] = __('Warn');
$table->head[7] = __('Data') . ' ' .
'<a href="' . $url . '&sort_field=data&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
'<a href="' . $url . '&sort_field=data&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=data&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
$table->head[8] = __('Graph');
$table->head[9] = __('Last contact') . ' ' .
'<a href="' . $url . '&sort_field=last_contact&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=last_contact&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>';
'<a href="' . $url . '&sort_field=last_contact&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=last_contact&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>';
$table->align = array("left", "left", "center", "left", "left", "center");
@ -1011,7 +1032,8 @@ if ($list_modules) {
"id_agente=" . $id_agente . "&" .
"refr=&filter_monitors=1&" .
"status_filter_monitor=" . $status_filter_monitor . "&" .
"status_text_monitor=" . $status_text_monitor;
"status_text_monitor=" . $status_text_monitor . "&".
"status_module_group=" . $status_module_group;
if ($paginate_module) {
ui_pagination ($count_modules, false, 0, 0, false, 'offset',
@ -1036,4 +1058,4 @@ if ($list_modules) {
}
?>
?>

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150119';
$build_version = 'PC150126';
$pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined.
@ -115,6 +115,7 @@ require_once ($ownDir. 'functions_config.php');
date_default_timezone_set("Europe/Madrid");
config_process_config();
if (!isset($config["homeurl_static"])) {
@ -142,32 +143,9 @@ else {
$config["global_block_size"] = $config["block_size"];
$config["global_flash_charts"] = $config["flash_charts"];
if (isset ($config['id_user'])) {
$userinfo = get_user_info ($config['id_user']);
// Refresh the last_connect info in the user table
// if last update was more than 5 minutes ago
if($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
update_user($config['id_user'], array('last_connect' => time()));
}
// If block_size or flash_chart are provided then override global settings
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
$config["block_size"] = $userinfo["block_size"];
if ($userinfo["flash_chart"] != -1)
$config["flash_charts"] = $userinfo["flash_chart"];
// Each user could have it's own timezone)
if (isset($userinfo["timezone"])) {
if ($userinfo["timezone"] != "") {
date_default_timezone_set($userinfo["timezone"]);
}
}
if (defined('METACONSOLE')) {
$config['metaconsole_access'] = $userinfo["metaconsole_access"];
}
config_user_set_custom_config();
}
// Check if inventory_changes_blacklist is setted, if not create it

View File

@ -2177,7 +2177,7 @@ function get_news($arguments) {
$modal = get_argument ('modal', $arguments, false);
$limit = get_argument ('limit', $arguments, 99999999);
$id_group = array_keys(users_get_groups($id_user, 'AR', true));
$id_group = array_keys(users_get_groups($id_user, false, true));
$id_group = implode(',',$id_group);
$current_datetime = date('Y-m-d H:i:s', time());
$modal = (int) $modal;

View File

@ -1007,25 +1007,28 @@ function api_set_delete_agent($id, $thrash1, $thrast2, $thrash3) {
}
/**
* Get all agents, and print all the result like a csv.
* Get all agents, and print all the result like a csv or other type for example json.
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
* example for CSV:
*
* api.php?op=get&op2=all_agents&return_type=csv&other=1|2|warning|j|2|~&other_mode=url_encode_separator_|
*
* @param $thrash3 Don't use.
* example for JSON:
*
* api.php?op=get&op2=all_agents&return_type=json&other=1|2|warning|j|2|~&other_mode=url_encode_separator_|
*
* @param $returnType.
*/
function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$where = '';
if (isset($other['data'][0])) {
// Filter by SO
if ($other['data'][0] != "") {
@ -1138,7 +1141,7 @@ function api_get_all_agents($thrash1, $thrash2, $other, $thrash3) {
if (count($result_agents) > 0 and $result_agents !== false) {
$data = array('type' => 'array', 'data' => $result_agents);
returnData('csv', $data, $separator);
returnData($returnType, $data, $separator);
}
else {
returnError('error_all_agents', 'No agents retrieved.');

View File

@ -1414,8 +1414,8 @@ function config_check () {
function config_return_in_bytes($val) {
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) {
$last = strtolower($val[strlen($val) - 1]);
switch ($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
@ -1424,8 +1424,37 @@ function config_return_in_bytes($val) {
case 'k':
$val *= 1024;
}
return $val;
}
function config_user_set_custom_config() {
global $config;
$userinfo = get_user_info ($config['id_user']);
// Refresh the last_connect info in the user table
// if last update was more than 5 minutes ago
if ($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
update_user($config['id_user'], array('last_connect' => time()));
}
// If block_size or flash_chart are provided then override global settings
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
$config["block_size"] = $userinfo["block_size"];
if ($userinfo["flash_chart"] != -1)
$config["flash_charts"] = $userinfo["flash_chart"];
// Each user could have it's own timezone)
if (isset($userinfo["timezone"])) {
if ($userinfo["timezone"] != "") {
date_default_timezone_set($userinfo["timezone"]);
}
}
if (defined('METACONSOLE')) {
$config['metaconsole_access'] = $userinfo["metaconsole_access"];
}
}
?>

View File

@ -2369,9 +2369,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
}
// Add tags condition to filter
$user_strict = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$acltags = tags_get_user_module_and_tags ($config['id_user'], $access = 'ER', $user_strict);
$tags_condition = " AND (".tags_get_acl_tags_event_condition($acltags, false, $user_strict).")";
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
//This will give the distinct id_agente, give the id_grupo that goes
//with it and then the number of times it occured. GROUP BY statement
@ -2465,9 +2463,7 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200) {
$filter = str_replace ( "\\" , "", $filter);
// Add tags condition to filter
$user_strict = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$acltags = tags_get_user_module_and_tags ($config['id_user'], $access = 'ER', $user_strict);
$tags_condition = " AND (".tags_get_acl_tags_event_condition($acltags, false, $user_strict).")";
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
$filter .= $tags_condition;
$data = array ();

View File

@ -537,12 +537,22 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) {
*
* @return int Status of the agents.
*/
function groups_get_status ($id_group = 0) {
function groups_get_status ($id_group = 0, $strict_user = false) {
global $config;
require_once ($config['homedir'].'/include/functions_reporting.php');
$data = reporting_get_group_stats($id_group);
if ($strict_user) {
$acltags = tags_get_user_module_and_tags ($config['id_user'], 'AR', $strict_user);
$group_status = group_get_data ($config['id_user'], $strict_user, $acltags, false, 'group');
$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
$data['agent_critical'] = $groups_status['_agents_critical_'];
$data['agent_warning'] = $groups_status['_agents_warning_'];
$data['agent_unknown'] = $groups_status['_agents_unknown_'];
} else {
$data = reporting_get_group_stats($id_group);
}
if ($data['monitor_alerts_fired'] > 0) {
return AGENT_STATUS_ALERT_FIRED;
@ -1394,7 +1404,6 @@ function groups_monitor_ok ($group_array, $strict_user = false, $id_group_strict
if ($strict_user) {
$tags_clause = "AND tagente_modulo.id_agente_modulo NOT IN (SELECT id_agente_modulo FROM ttag_module)";
$count = db_get_sql ("SELECT COUNT(*) FROM tagente_modulo, tagente_estado
WHERE tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo
AND tagente_estado.estado = 0
@ -1796,8 +1805,6 @@ function groups_get_tree(&$groups, $parent = false) {
return $return;
}
function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
global $config;
@ -1831,7 +1838,6 @@ function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) {
function group_get_data ($id_user = false, $user_strict = false, $acltags, $returnAllGroup = false, $mode = 'group') {
global $config;
if ($id_user == false) {
$id_user = $config['id_user'];
}
@ -1887,6 +1893,8 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
}
}
$list = array();
if ($list_groups == false) {
$list_groups = array();
}

View File

@ -113,7 +113,7 @@ function networkmap_generate_hash($pandora_name, $group = 0,
$graph = networkmap_generate_dot($pandora_name, $group,
$simple, $font_size, $layout, $nooverlap, $zoom, $ranksep,
$center, $regen, $pure, $id_networkmap, $show_snmp_modules,
$cut_names, $relative, $text_filter);
$cut_names, $relative, $text_filter, false, null, false, $strict_user);
$return = array();
if (!empty($graph)) {
@ -234,7 +234,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
$id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true,
$relative = false, $text_filter = '', $l2_network = false, $ip_mask = null,
$dont_show_subgroups = false) {
$dont_show_subgroups = false, $strict_user = false) {
global $config;
@ -281,12 +281,35 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
//Order by id_parent ascendant for to avoid the bugs
//because the first agents to process in the next
//foreach loop are without parent (id_parent = 0)
// Get agents data
if ($strict_user) {
if ($dont_show_subgroups)
$filter['id_group'] = $group;
else {
if (!empty($childrens)) {
foreach ($childrens as $children) {
$filter_id_groups[$children] = $children;
}
}
$filter_id_groups[$group] = $group;
$filter['id_group'] = implode(',', $filter_id_groups);
}
$filter['group_by'] = 'tagente.id_agente';
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_parent, tagente.id_agente,
tagente.normal_count, tagente.warning_count, tagente.critical_count,
tagente.unknown_count, tagente.total_count, tagente.notinit_count');
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
} else {
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_parent, id_agente,
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'), 'AR',
array('field' => 'id_parent', 'order' => 'ASC'));
}
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_parent, id_agente,
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'), 'AR',
array('field' => 'id_parent', 'order' => 'ASC'));
}
else if ($group == -666) {
$agents = false;
@ -295,22 +318,29 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$agents = networkmap_get_new_nodes_from_ip_mask($ip_mask,
array ('id_grupo, nombre, id_os, id_parent, id_agente,
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'));
unknown_count, total_count, notinit_count'), $strict_user);
}
else {
//Order by id_parent ascendant for to avoid the bugs
//because the first agents to process in the next
//foreach loop are without parent (id_parent = 0)
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_parent, id_agente,
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'), 'AR',
array('field' => 'id_parent', 'order' => 'ASC'));
if ($strict_user) {
$filter['group_by'] = 'tagente.id_agente';
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_parent, tagente.id_agente,
tagente.normal_count, tagente.warning_count, tagente.critical_count,
tagente.unknown_count, tagente.total_count, tagente.notinit_count');
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
} else {
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_parent, id_agente,
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'), 'AR',
array('field' => 'id_parent', 'order' => 'ASC'));
}
}
if ($agents === false)
//return false;
$agents = array();
@ -343,10 +373,14 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$filter = array();
$filter['disabled'] = 0;
// Get agent modules data
$modules = agents_get_modules($agent['id_agente'], '*',
$filter, true, true);
if ($strict_user) {
$modules = tags_get_agent_modules ($agent['id_agente'], $acltags, false, $filter, false);
} else {
$modules = agents_get_modules($agent['id_agente'], '*', $filter, true, true);
}
if ($modules === false)
$modules = array();
@ -611,10 +645,13 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
$zoom = 1, $ranksep = 2.5, $center = 0, $regen = 1, $pure = 0,
$modwithalerts = 0, $module_group = 0, $hidepolicymodules = 0,
$depth = 'all', $id_networkmap = 0, $dont_show_subgroups = 0,
$text_filter = '') {
$text_filter = '', $strict_user = false) {
global $config;
if ($strict_user) {
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
}
$parents = array();
$orphans = array();
@ -654,7 +691,11 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
$filter['id_grupo'] = $id_groups;
}
else {
$groups = db_get_all_rows_in_table ('tgrupo');
if ($strict_user) {
$groups = users_get_groups ($config['id_user'],"AR", false, true);
} else {
$groups = db_get_all_rows_in_table ('tgrupo');
}
if ($groups === false) {
$groups = array();
}
@ -676,7 +717,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
// Add node
$nodes_groups[$group2['id_grupo']] = $group2;
}
$node_count = 0;
$groups_hiden = array();
@ -702,12 +743,19 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
}
if ($depth != 'group') {
if ($strict_user) {
$filter['group_by'] = 'tagente.nombre';
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_agente,
tagente.normal_count, tagente.warning_count, tagente.critical_count,
tagente.unknown_count, tagente.total_count, tagente.notinit_count');
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
} else {
// Get agents data
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_agente,
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'));
}
if ($agents === false)
$agents = array();
@ -741,7 +789,13 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
}
// Get agent modules data
$modules = agents_get_modules ($agent['id_agente'], false, array('disabled' => 0), true, false);
if ($strict_user) {
$filter['disabled'] = 0;
$modules = tags_get_agent_modules ($agent['id_agente'], $acltags, false, $filter, false);
} else {
$modules = agents_get_modules ($agent['id_agente'], false, array('disabled' => 0), true, false);
}
// Parse modules
foreach ($modules as $key => $module) {
$node_count ++;
@ -784,7 +838,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
// Create void statistics array
$stats = array();
// Create nodes
foreach ($nodes as $node_id => $node) {
if ($center > 0 && ! networkmap_is_descendant ($node_id, $center, $parents)) {
@ -795,7 +849,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
}
switch ($node['type']) {
case 'group':
$graph .= networkmap_create_group_node ($node , $simple, $font_size) .
$graph .= networkmap_create_group_node ($node , $simple, $font_size, $metaconsole = false, null, $strict_user) .
"\n\t\t";
$stats['groups'][] = $node['id_grupo'];
break;
@ -878,12 +932,12 @@ function networkmap_create_transparent_edge($head, $tail) {
}
// Returns a group node definition
function networkmap_create_group_node ($group, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null) {
function networkmap_create_group_node ($group, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null, $strict_user = false) {
global $config;
global $hack_networkmap_mobile;
$status = groups_get_status ($group['id_grupo']);
$status = groups_get_status ($group['id_grupo'], $strict_user);
// Set node status
switch ($status) {
case 0:
@ -963,11 +1017,21 @@ function networkmap_create_group_node ($group, $simple = 0, $font_size = 10, $me
}
// Returns a node definition
function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false, $metaconsole = false, $id_server = null) {
function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cut_names = true, $relative = false, $metaconsole = false, $id_server = null, $strict_user = false) {
global $config;
global $hack_networkmap_mobile;
$status = agents_get_status_from_counts($agent);
if ($strict_user) {
$strict_data['normal_count'] = groups_agent_ok ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
$strict_data['warning_count'] = groups_agent_warning ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
$strict_data['critical_count'] = groups_agent_critical ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
$strict_data['unknown_count'] = groups_agent_unknown ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
$strict_data['notinit_count'] = groups_agent_not_init ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
$strict_data['total_count'] = groups_agent_total ($agent['id_grupo'], $strict_user, $agent['id_grupo']);
$status = agents_get_status_from_counts($strict_data);
} else {
$status = agents_get_status_from_counts($agent);
}
if (defined('METACONSOLE')) {
$server_data = db_get_row('tmetaconsole_setup', 'id',
@ -1062,7 +1126,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
$url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'];
}
$node = "\n" . $agent['id_node'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
$node = "\n" . $agent['id_node'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>' . $img_node . '</TD></TR>
<TR><TD>'.io_safe_output($name).'</TD></TR></TABLE>>,
shape="doublecircle", URL="'.$url.'",
tooltip="' . $url_tooltip . '"];' . "\n";
@ -1500,7 +1564,7 @@ function networkmap_get_networkmap ($id_networkmap, $filter = false, $fields = f
*
* @return Networkmap with the given id. False if not available or readable.
*/
function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = true) {
function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = true, $strict_user = false) {
global $config;
if ($id_user == '') {
@ -1527,11 +1591,17 @@ function networkmap_get_networkmaps ($id_user = '', $type = '', $optgrouped = tr
$networkmaps = array();
foreach ($networkmaps_raw as $key => $networkmapitem) {
if ($optgrouped) {
if ((($networkmapitem['type'] == 'policies') || ($networkmapitem['type'] == 'radial_dynamic')) && ($strict_user)) {
continue;
}
$networkmaps[$networkmapitem['id_networkmap']] =
array('name' => $networkmapitem['name'],
'optgroup' => $networkmapitem['type']);
}
else {
if ((($networkmapitem['type'] == 'policies') || ($networkmapitem['type'] == 'radial_dynamic')) && ($strict_user)) {
continue;
}
$networkmaps[$networkmapitem['id_networkmap']] =
$networkmapitem['name'];
}
@ -1600,7 +1670,7 @@ function networkmap_update_networkmap ($id_networkmap, $values) {
*
* @return Array Networkmap diferent types.
*/
function networkmap_get_types () {
function networkmap_get_types ($strict_user = false) {
$networkmap_types = array();
$is_enterprise = enterprise_include_once('include/functions_policies.php');
@ -1608,9 +1678,11 @@ function networkmap_get_types () {
$networkmap_types['topology'] = __('Create a new topology map');
$networkmap_types['groups'] = __('Create a new group map');
$networkmap_types['dinamic'] = __('Create a new dynamic map');
$networkmap_types['radial_dynamic'] = __('Create a new radial dynamic map');
if (!$strict_user) {
$networkmap_types['radial_dynamic'] = __('Create a new radial dynamic map');
}
if ($is_enterprise !== ENTERPRISE_NOT_HOOK) {
if (($is_enterprise !== ENTERPRISE_NOT_HOOK) && (!$strict_user)) {
$enterprise_types = enterprise_hook('policies_get_networkmap_types');
$networkmap_types = array_merge($networkmap_types, $enterprise_types);
@ -1624,7 +1696,7 @@ function networkmap_get_types () {
*
* @return Array Networkmap diferent types.
*/
function networkmap_get_filter_types () {
function networkmap_get_filter_types ($strict_user = false) {
$networkmap_types = array();
$is_enterprise = enterprise_include_once('include/functions_policies.php');
@ -1632,9 +1704,11 @@ function networkmap_get_filter_types () {
$networkmap_types['topology'] = __('Topology');
$networkmap_types['groups'] = __('Group');
$networkmap_types['dinamic'] = __('Dynamic');
$networkmap_types['radial_dynamic'] = __('Radial dynamic');
if (!$strict_user) {
$networkmap_types['radial_dynamic'] = __('Radial dynamic');
}
if ($is_enterprise !== ENTERPRISE_NOT_HOOK) {
if (($is_enterprise !== ENTERPRISE_NOT_HOOK) && (!$strict_user)) {
$enterprise_types = enterprise_hook('policies_get_networkmap_filter_types');
$networkmap_types = array_merge($networkmap_types, $enterprise_types);
@ -1659,28 +1733,48 @@ function networkmap_cidr_match($ip, $cidr_mask) {
return ($ip & $mask) == $subnet;
}
function networkmap_get_new_nodes_from_ip_mask($ip_mask, $fields = array()) {
function networkmap_get_new_nodes_from_ip_mask($ip_mask, $fields = array(), $strict_user = false) {
$list_ip_masks = explode(",", $ip_mask);
$list_address = db_get_all_rows_in_table('taddress');
if (empty($address))
$address = array();
if ($strict_user) {
$filter['group_by'] = 'tagente.id_agente';
$fields = array ('tagente.id_agente');
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
$user_agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
foreach ($all_user_agents as $agent) {
$user_agents[$agent['id_agente']] = $agent['id_agente'];
}
}
$agents = array();
foreach ($list_address as $address) {
foreach ($list_ip_masks as $ip_mask) {
if (networkmap_cidr_match($address['ip'], $ip_mask)) {
$id_agent = db_get_value_filter('id_agent', 'taddress_agent', array('id_a' => $address['id_a']));
if (empty($fields)) {
$agents[] = db_get_value_filter('id_agent',
'taddress_agent', array('id_a' => $address['id_a']));
if ($strict_user) {
if (array_key_exists($id_agent, $user_agents)) {
$agents[] = db_get_value_filter('id_agent', 'taddress_agent', array('id_a' => $address['id_a']));
}
} else {
$agents[] = db_get_value_filter('id_agent', 'taddress_agent', array('id_a' => $address['id_a']));
}
}
else {
$id_agent = db_get_value_filter('id_agent',
'taddress_agent', array('id_a' => $address['id_a']));
$agents[] = db_get_row('tagente', 'id_agente',
$id_agent, $fields);
if ($strict_user) {
if (array_key_exists($id_agent, $user_agents)) {
$agents[] = db_get_row('tagente', 'id_agente', $id_agent, $fields);
}
} else {
$agents[] = db_get_row('tagente', 'id_agente', $id_agent, $fields);
}
}
}
}

View File

@ -7778,7 +7778,9 @@ function reporting_get_count_events_validated ($filter, $period = 0,
*
* @return string html formatted tiny stats of modules/alerts of an agent
*/
function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $separator = ':') {
function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $separator = ':', $strict_user = false) {
global $config;
$out = '';
// Depend the type of object, the stats will refer agents, modules...
@ -7809,6 +7811,28 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
break;
}
if ($strict_user && $type == 'agent') {
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
$filter['disabled'] = 0;
$id_agent = $counts_info['id_agente'];
$counts_info = array();
$counts_info['normal_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NORMAL));
$counts_info['warning_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_WARNING));
$counts_info['critical_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_CRITICAL_BAD));
$counts_info['notinit_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_NOT_INIT));
$counts_info['unknown_count'] = count(tags_get_agent_modules ($id_agent, $acltags, false, $filter, false, AGENT_MODULE_STATUS_UNKNOWN));
$counts_info['total_count'] = $counts_info['normal_count'] + $counts_info['warning_count'] + $counts_info['critical_count'] + $counts_info['unknown_count'] + $counts_info['notinit_count'];
$all_agent_modules = tags_get_agent_modules ($id_agent, $acltags, false, $filter);
$mod_clause = "(".implode(',', array_keys($all_agent_modules)).")";
$counts_info['fired_count'] = db_get_sql ("SELECT COUNT(times_fired)
FROM talert_template_modules
WHERE times_fired != 0 AND id_agent_module IN ".$mod_clause);
}
// Store the counts in a data structure to print hidden divs with titles
$stats = array();

View File

@ -403,6 +403,14 @@ function tags_delete_tag ($id_tag) {
}
function tags_remove_tag($id_tag, $id_module) {
$result = (bool)db_process_sql_delete('ttag_module',
array('id_tag' => $id_tag,
'id_agente_modulo' => $id_module));
return $result;
}
/**
* Get tag's total count.
*
@ -440,6 +448,8 @@ function tags_insert_module_tag ($id_agent_module, $tags) {
if ($result_tag === false)
$errn++;
}
return $errn;
}
/**
@ -580,17 +590,6 @@ function tags_get_module_tags ($id, $policy = false) {
return $return;
}
function tags_get_module_policy_tags($id_tag, $id_module) {
if (empty($id_tag))
return false;
$id_module_policy = db_get_value_filter('id_policy_module',
'ttag_module',
array('id_tag' => $id_tag, 'id_agente_modulo' => $id_module));
return $id_module_policy;
}
/**
* Select all tags of a policy module.
*
@ -656,6 +655,34 @@ function tags_get_tags ($ids) {
return $tags;
}
function tags_get_agents($id_tag, $id_policy_module = 0) {
$agents = db_get_all_rows_sql("
SELECT id_agente
FROM tagente
WHERE id_agente IN (
SELECT t1.id_agente
FROM tagente_modulo AS t1
WHERE t1.id_agente_modulo IN (
SELECT t2.id_agente_modulo
FROM ttag_module AS t2
WHERE id_tag = " . $id_tag . "
AND id_policy_module = " . $id_policy_module . "))");
if (empty($agents)) {
return array();
}
$temp = array();
foreach ($agents as $agent) {
$temp[] = $agent['id_agente'];
}
$agents = $temp;
return $agents;
}
/**
* Give format to tags when go concatened with url.
*
@ -1760,14 +1787,15 @@ function tags_get_monitors_alerts ($id_tag, $groups_and_tags = array()) {
*
* @return mixed Returns count of agents with this tag or false if they aren't.
*/
function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags = array(), $filter = false, $fields = false, $meta = true, $strict_user = true) {
function tags_get_all_user_agents ($id_tag = false, $id_user = false, $groups_and_tags = array(), $filter = false, $fields = false, $meta = true, $strict_user = true, $return_all_fields = false) {
global $config;
// Avoid mysql error
if (empty($id_tag))
return;
if (empty($id_tag)) {
$tag_filter = '';
} else {
$tag_filter = " AND ttag_module.id_tag = " . $id_tag;
}
if (empty($id_user)) {
$id_user = $config['id_user'];
}
@ -1777,17 +1805,85 @@ function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags =
$fields[0] = "id_agente";
$fields[1] = "nombre";
}
$select_fields = implode(',',$fields);
$select_fields = implode(',',$fields);
$groups_clause = "";
if ($strict_user) {
if (!empty($groups_and_tags)) {
$groups_clause = " AND ".tags_get_acl_tags_module_condition($groups_and_tags, "tagente_modulo");
$groups_clause = " AND ".tags_get_acl_tags_module_condition($groups_and_tags, "tagente_modulo");
}
} else {
$groups_clause = " AND tagente.id_grupo IN (".implode(',',$groups_and_tags).")";
}
if (!empty($filter['id_group'])) {
$groups_clause .= " AND tagente.id_grupo IN (".$filter['id_group'].")";
}
$status_sql = '';
if (isset($filter['status'])) {
switch ($filter['status']) {
case AGENT_STATUS_NORMAL:
$status_sql =
" AND (normal_count = total_count)";
break;
case AGENT_STATUS_WARNING:
$status_sql =
"AND (critical_count = 0 AND warning_count > 0)";
break;
case AGENT_STATUS_CRITICAL:
$status_sql =
"AND (critical_count > 0)";
break;
case AGENT_STATUS_UNKNOWN:
$status_sql =
"AND (critical_count = 0 AND warning_count = 0
AND unknown_count > 0)";
break;
case AGENT_STATUS_NOT_NORMAL:
$status_sql = " AND (normal_count <> total_count)";
break;
case AGENT_STATUS_NOT_INIT:
$status_sql = "AND (notinit_count = total_count)";
break;
}
}
$disabled_sql = '';
if (!empty($filter['disabled'])) {
$disabled_sql = " AND disabled = ".$filter['disabled'];
}
$order_by_condition = '';
if (!empty($filter['order'])) {
$order_by_condition = " ORDER BY ".$filter['order'];
} else {
$order_by_condition = " ORDER BY tagente.nombre ASC";
}
$limit_sql = '';
if (isset($filter['offset'])) {
$offset = $filter['offset'];
}
if (isset($filter['limit'])) {
$limit = $filter['limit'];
}
if (isset($offset) && isset($limit)) {
$limit_sql = " LIMIT $offset, $limit ";
}
if (!empty($filter['group_by'])) {
$group_by = " GROUP BY ".$filter['group_by'];
} else {
$group_by = " GROUP BY tagente.nombre";
}
$id_agent_search = '';
if (!empty($filter['id_agent'])) {
$id_agent_search = " AND tagente.id_agente = ".$filter['id_agent'];
}
$search_sql = "";
$void_agents = "";
if ($filter) {
@ -1802,23 +1898,40 @@ function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags =
}
}
}
//~ $user_agents_sql = "SELECT ".$select_fields ."
//~ FROM tagente, tagente_modulo, ttag_module
//~ WHERE tagente.id_agente = tagente_modulo.id_agente
//~ AND tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
//~ ". $tag_filter .
//~ $groups_clause . $search_sql . $void_agents .
//~ $status_sql .
//~ $group_by .
//~ " ORDER BY tagente.nombre ASC";
$user_agents_sql = "SELECT ".$select_fields ."
FROM tagente, tagente_modulo, ttag_module
WHERE tagente.id_agente = tagente_modulo.id_agente
AND tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
AND ttag_module.id_tag = " . $id_tag .
". $tag_filter .
$groups_clause . $search_sql . $void_agents .
" ORDER BY tagente.nombre ASC";
$status_sql .
$disabled_sql .
$group_by .
$order_by_condition .
$limit_sql;
//return db_get_sql ($user_agents);
$user_agents = db_get_all_rows_sql($user_agents_sql);
$user_agents = db_get_all_rows_sql($user_agents_sql);
if ($user_agents == false) {
$user_agents = array();
}
if ($return_all_fields) {
return $user_agents;
}
if (!$meta){
$user_agents_aux = array();
if ($user_agents === false) {
$user_agents = array();
}
foreach ($user_agents as $ua) {
$user_agents_aux[$ua['id_agente']] = $ua['nombre'];
}
@ -1826,4 +1939,85 @@ function tags_get_all_user_agents ($id_tag, $id_user = false, $groups_and_tags =
}
return $user_agents;
}
function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields = false, $filter = false, $return_all_fields = false, $get_filter_status = -1) {
global $config;
// Avoid mysql error
if (empty($id_agent))
return;
if (!is_array ($fields)) {
$fields = array ();
$fields[0] = "tagente_modulo.id_agente_modulo";
$fields[1] = "tagente_modulo.nombre";
}
$select_fields = implode(',',$fields);
if ($filter) {
$filter_sql = '';
if (isset($filter['disabled'])) {
$filter_sql .= " AND tagente_modulo.disabled = ".$filter['disabled'];
}
if (isset($filter['nombre'])) {
$filter_sql .= ' AND tagente_modulo.nombre LIKE "' .$filter['nombre'].'"';
}
}
$tag_filter = "";
if (!empty($groups_and_tags)) {
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $id_agent);
if (isset($groups_and_tags[$agent_group]) && ($groups_and_tags[$agent_group] != '')) {
//~ $tag_filter = " AND ttag_module.id_tag IN (".$groups_and_tags[$agent_group].")";
$tag_filter = " AND tagente_modulo.id_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (".$groups_and_tags[$agent_group]."))";
}
}
if ($get_filter_status != -1) {
$agent_modules_sql = "SELECT ".$select_fields ."
FROM tagente_modulo, tagente_estado
WHERE tagente_modulo.id_agente=". $id_agent .
" AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_estado.estado = ".$get_filter_status .
$tag_filter .
$filter_sql ."
ORDER BY nombre";
} else {
$agent_modules_sql = "SELECT ".$select_fields ."
FROM tagente_modulo
WHERE id_agente=". $id_agent .
$tag_filter .
$filter_sql ."
ORDER BY nombre";
}
$agent_modules = db_get_all_rows_sql($agent_modules_sql);
if ($agent_modules == false) {
$agent_modules = array();
}
if ($return_all_fields) {
$result = array();
foreach ($agent_modules as $am) {
$am['status'] = modules_get_agentmodule_status($am['id_agente_modulo']);
$am['isinit'] = modules_get_agentmodule_is_init($am['id_agente_modulo']);
if ($am['isinit']) {
}
$result[$am['id_agente_modulo']] = $am;
}
return $result;
}
$result = array();
foreach ($agent_modules as $am) {
$result[$am['id_agente_modulo']] = $am['nombre'];
}
return $result;
}
?>

View File

@ -4,7 +4,7 @@
*/
?>
<h1>Custom OID/Data #1-20</h1>
<h1>Variable bindings/Data #1-20</h1>
<p>These are regular expressions that try to match varbinds 1 to 20. If there is a match, the alert is fired. The value of the variable is stored in the corresponding _snmp_fx_ macro (_snmp_f1_, _snmp_f2_, ...). Even though only twenty variables can be searched for matches, _snmp_fx_ macros are set for all of them (_snmp_f11_, _snmp_f12_, ...).</p>

View File

@ -6,4 +6,8 @@
<h1>Custom Value/OID</h1>
<p>This search in the trap &#34;Value&#34; fields, and also in the fields &#34;Custom OID&#34; and &#34;Custom Value&#34;, that is, in the rest of the TRAP fields.</p>
<p>
This search in the trap &#34;Value&#34; fields, and also in the fields
&#34;Variable bindings&#34; and &#34;Custom Value&#34;, that is, in
the rest of the TRAP fields.
</p>

View File

@ -4,7 +4,7 @@
*/
?>
<h1>Custom OID/Data #1-20</h1>
<h1>Variable bindings/Data #1-20</h1>
<p>Son expresiones regulares que intentan casar con las variables 1 a 20. Si hay un acierto, se dispara la alerta. El valor de la variable se guarda en la macro _snmp_fx_ correspondiente (_snmp_f1_, _snmp_f2_, ...). Aunque sólo se puede especificar una expresión regular para veinte variables, las macros _snmp_fx_ macros están disponibles para todas ellas (_snmp_f11_, _snmp_f12_, ...).</p>

View File

@ -177,7 +177,8 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
$('#module').attr ('disabled', 1);
$('#module').empty ();
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
$('#module').append ($('<option></option>')
.html ("Loading...").attr ("value", 0));
// Check if homedir was received like a JSON

View File

@ -12,6 +12,7 @@ function parse_alert_command (command, classs) {
$('.' + classs).each(function() {
// Only render values different from ''
if ($(this).val() == '') {
nfield++;
return;
}
var field = '_field' + nfield + '_';

View File

@ -69,6 +69,7 @@ if ((! file_exists ("include/config.php")) || (! is_readable ("include/config.ph
session_start ();
require_once ("include/config.php");
// If metaconsole activated, redirect to it
if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
header ("Location: " . $config['homeurl'] . "enterprise/meta");
@ -177,34 +178,34 @@ if (! isset ($config['id_user'])) {
$pass = get_parameter_post ("pass"); //This is the variable with the password
$nick = db_escape_string_sql($nick);
$pass = db_escape_string_sql($pass);
//Since now, only the $pass variable are needed
unset ($_GET['pass'], $_POST['pass'], $_REQUEST['pass']);
// If the auth_code exists, we assume the user has come through the double auth page
if (isset ($_POST['auth_code'])) {
$double_auth_success = false;
// The double authentication is activated and the user has surpassed the first step (the login).
// Now the authentication code provided will be checked.
if (isset ($_SESSION['prepared_login_da'])) {
if (isset ($_SESSION['prepared_login_da']['id_user'])
&& isset ($_SESSION['prepared_login_da']['timestamp'])) {
// The user has a maximum of 5 minutes to introduce the double auth code
$dauth_period = SECONDS_2MINUTES;
$now = time();
$dauth_time = $_SESSION['prepared_login_da']['timestamp'];
if ($now - $dauth_period < $dauth_time) {
// Nick
$nick = $_SESSION["prepared_login_da"]['id_user'];
// Code
$code = (string) get_parameter_post ("auth_code");
if (!empty($code)) {
$result = validate_double_auth_code($nick, $code);
if ($result === true) {
// Double auth success
$double_auth_success = true;
@ -214,7 +215,7 @@ if (! isset ($config['id_user'])) {
$login_screen = 'double_auth';
// Error message
$config["auth_error"] = __("Invalid code");
if (!isset($_SESSION['prepared_login_da']['attempts']))
$_SESSION['prepared_login_da']['attempts'] = 0;
$_SESSION['prepared_login_da']['attempts']++;
@ -225,7 +226,7 @@ if (! isset ($config['id_user'])) {
$login_screen = 'double_auth';
// Error message
$config["auth_error"] = __("The code shouldn't be empty");
if (!isset($_SESSION['prepared_login_da']['attempts']))
$_SESSION['prepared_login_da']['attempts'] = 0;
$_SESSION['prepared_login_da']['attempts']++;
@ -234,7 +235,7 @@ if (! isset ($config['id_user'])) {
else {
// Expired login
unset ($_SESSION['prepared_login_da']);
// Error message
$config["auth_error"] = __('Expired login');
}
@ -242,7 +243,7 @@ if (! isset ($config['id_user'])) {
else {
// If the code doesn't exist, remove the prepared login
unset ($_SESSION['prepared_login_da']);
// Error message
$config["auth_error"] = __('Login error');
}
@ -252,10 +253,10 @@ if (! isset ($config['id_user'])) {
// Error message
$config["auth_error"] = __('Login error');
}
// Remove the authenticator code
unset ($_POST['auth_code'], $code);
if (!$double_auth_success) {
$login_failed = true;
require_once ('general/login_page.php');
@ -328,73 +329,88 @@ if (! isset ($config['id_user'])) {
'timestamp' => time(),
'attempts' => 0
);
// Load the page to introduce the double auth code
$login_screen = 'double_auth';
require_once ('general/login_page.php');
while (@ob_end_flush ());
exit ("</html>");
}
//login ok and password has not expired
$process_login = true;
echo "<script type='text/javascript'>var process_login_ok = 1;</script>";
unset ($_GET["sec2"]);
$_GET["sec"] = "general/logon_ok";
$home_page ='';
if (isset($nick)) {
$user_info = users_get_user_by_id($nick);
$home_page = io_safe_output($user_info['section']);
$home_url = $user_info['data_section'];
if ($home_page != '') {
switch($home_page) {
case 'Event list':
$_GET["sec"] = "eventos";
$_GET["sec2"] = "operation/events/events";
break;
case 'Group view':
$_GET["sec"] = "estado";
$_GET["sec2"] = "operation/agentes/group_view";
break;
case 'Alert detail':
$_GET["sec"] = "estado";
$_GET["sec2"] = "operation/agentes/alerts_status";
break;
case 'Tactical view':
$_GET["sec"] = "estado";
$_GET["sec2"] = "operation/agentes/tactical";
break;
case 'Default':
$_GET["sec"] = "general/logon_ok";
break;
case 'Dashboard':
$_GET["sec"] = "dashboard";
$_GET["sec2"] = ENTERPRISE_DIR.'/dashboard/main_dashboard';
$id_dashboard_select =
db_get_value('id', 'tdashboard', 'name', $home_url);
$_GET['id_dashboard_select'] = $id_dashboard_select;
break;
case 'Visual console':
$_GET["sec"] = "visualc";
$_GET["sec2"] = "operation/visual_console/index";
break;
case 'Other':
$home_url = io_safe_output($home_url);
parse_str ($home_url, $res);
$_GET["sec"] = $res["sec"];
$_GET["sec2"] = $res["sec2"];
break;
if (!isset($_GET["sec2"]) && !isset($_GET["sec"])) {
// Avoid the show homepage when the user go to
// a specific section of pandora
// for example when timeout the sesion
unset ($_GET["sec2"]);
$_GET["sec"] = "general/logon_ok";
$home_page ='';
if (isset($nick)) {
$user_info = users_get_user_by_id($nick);
$home_page = io_safe_output($user_info['section']);
$home_url = $user_info['data_section'];
if ($home_page != '') {
switch ($home_page) {
case 'Event list':
$_GET["sec"] = "eventos";
$_GET["sec2"] = "operation/events/events";
break;
case 'Group view':
$_GET["sec"] = "estado";
$_GET["sec2"] = "operation/agentes/group_view";
break;
case 'Alert detail':
$_GET["sec"] = "estado";
$_GET["sec2"] = "operation/agentes/alerts_status";
break;
case 'Tactical view':
$_GET["sec"] = "estado";
$_GET["sec2"] = "operation/agentes/tactical";
break;
case 'Default':
$_GET["sec"] = "general/logon_ok";
break;
case 'Dashboard':
$_GET["sec"] = "dashboard";
$_GET["sec2"] = ENTERPRISE_DIR.'/dashboard/main_dashboard';
$id_dashboard_select =
db_get_value('id', 'tdashboard', 'name', $home_url);
$_GET['id_dashboard_select'] = $id_dashboard_select;
break;
case 'Visual console':
$_GET["sec"] = "visualc";
$_GET["sec2"] = "operation/visual_console/index";
break;
case 'Other':
$home_url = io_safe_output($home_url);
parse_str ($home_url, $res);
$_GET["sec"] = $res["sec"];
$_GET["sec2"] = $res["sec2"];
break;
}
}
else {
$_GET["sec"] = "general/logon_ok";
}
}
else {
$_GET["sec"] = "general/logon_ok";
}
}
db_logon ($nick_in_db, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $nick_in_db;
$config['id_user'] = $nick_in_db;
//==========================================================
//-------- SET THE CUSTOM CONFIGS OF USER ------------------
config_user_set_custom_config();
//==========================================================
//Remove everything that might have to do with people's passwords or logins
unset ($pass, $login_good);
@ -483,8 +499,8 @@ if ($process_login) {
require_once("include/functions_update_manager.php");
enterprise_include_once("include/functions_update_manager.php");
if ($config["autoupdate"] == 1) {
if ($config["autoupdate"] == 1) {
if (enterprise_installed()) {
$result = update_manager_check_online_enterprise_packages_available();
}
@ -623,6 +639,8 @@ else {
$home_url = $user_info['data_section'];
}
if ($home_page != '') {
switch ($home_page) {
case 'Event list':

View File

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

View File

@ -131,11 +131,11 @@ else {
}
if ($alert_validate) {
if (check_acl ($config["id_user"], $id_group, "AW") == 0) {
ui_print_error_message(__('Insufficient permissions to validate alerts'));
if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM") ) {
validateAlert();
}
else {
validateAlert();
ui_print_error_message(__('Insufficient permissions to validate alerts'));
}
}
@ -554,7 +554,7 @@ if (!empty ($table->data)) {
html_print_table ($table);
if (!defined('METACONSOLE')) {
if (check_acl ($config["id_user"], $id_group, "AW")) {
if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM") ) {
if (count($alerts['alerts_simple']) > 0) {
echo '<div class="action-buttons" style="width: '.$table->width.';">';
html_print_submit_button (__('Validate'), 'alert_validate', false, 'class="sub ok"', false);

View File

@ -119,6 +119,8 @@ $refr = get_parameter('refr', 0);
$recursion = get_parameter('recursion', 0);
$status = (int) get_parameter ('status', -1);
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$onheader = array();
if (check_acl ($config['id_user'], 0, "AW")) {
@ -139,8 +141,10 @@ if (check_acl ($config['id_user'], 0, "AW")) {
ui_print_page_header ( __("Agent detail"), "images/agent_mc.png", false, "agent_status", false, $onheader);
if (tags_has_user_acl_tags()) {
ui_print_tags_warning();
if (!$strict_user) {
if (tags_has_user_acl_tags()) {
ui_print_tags_warning();
}
}
// User is deleting agent
@ -342,43 +346,72 @@ else {
$groups = array_keys($user_groups);
}
$total_agents = 0;
$agents = false;
$total_agents = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $groups,
'search' => $search_sql,
'status' => $status),
array ('COUNT(*) as total'), 'AR', false);
$total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0;
if ($strict_user) {
$agents = agents_get_agents(array (
'order' => 'nombre ' . $order_collation . ' ASC',
'id_grupo' => $groups,
'disabled' => 0,
'status' => $status,
'search' => $search_sql,
'offset' => (int) get_parameter ('offset'),
'limit' => (int) $config['block_size'] ),
$filter = array (
'order' => 'tagente.nombre COLLATE utf8_general_ci ASC',
'disabled' => 0,
'status' => $status,
'search' => $search,
'offset' => (int) get_parameter ('offset'),
'limit' => (int) $config['block_size']);
if ($group_id > 0) {
$groups = array($group_id);
if ($recursion) {
$groups = groups_get_id_recursive($group_id, true);
}
$filter['id_group'] = implode(',', $groups);
}
$fields = array ('tagente.id_agente','tagente.id_grupo','tagente.id_os','tagente.ultimo_contacto','tagente.intervalo','tagente.comentarios description','tagente.quiet',
'tagente.normal_count','tagente.warning_count','tagente.critical_count','tagente.unknown_count','tagente.notinit_count','tagente.total_count','tagente.fired_count');
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
array ('id_agente',
'id_grupo',
'id_os',
'ultimo_contacto',
'intervalo',
'comentarios description',
'quiet',
'normal_count',
'warning_count',
'critical_count',
'unknown_count',
'notinit_count',
'total_count',
'fired_count'),
'AR',
$order);
$total_agents = count($agents);
} else {
$total_agents = 0;
$agents = false;
$total_agents = agents_get_agents(array (
'disabled' => 0,
'id_grupo' => $groups,
'search' => $search_sql,
'status' => $status),
array ('COUNT(*) as total'), 'AR', false);
$total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0;
$agents = agents_get_agents(array (
'order' => 'nombre ' . $order_collation . ' ASC',
'id_grupo' => $groups,
'disabled' => 0,
'status' => $status,
'search' => $search_sql,
'offset' => (int) get_parameter ('offset'),
'limit' => (int) $config['block_size'] ),
array ('id_agente',
'id_grupo',
'id_os',
'ultimo_contacto',
'intervalo',
'comentarios description',
'quiet',
'normal_count',
'warning_count',
'critical_count',
'unknown_count',
'notinit_count',
'total_count',
'fired_count'),
'AR',
$order);
}
if (empty ($agents)) {
$agents = array ();
@ -416,12 +449,6 @@ $table->head[8] = __('Last contact'). ' ' .
$table->align = array ();
//Only for AW flag
if (check_acl ($config["id_user"], $group_id, "AW")) {
$table->head[9] = __('R');
$table->align[9] = "center";
}
$table->align[2] = "center";
$table->align[3] = "center";
$table->align[4] = "center";
@ -478,7 +505,7 @@ foreach ($agents as $agent) {
$data[4] = ui_print_group_icon ($agent["id_grupo"], true);
$data[5] = reporting_tiny_stats($agent, true);
$data[5] = reporting_tiny_stats($agent, true, 'agent', ':', $strict_user);
$data[6] = $status_img;
@ -500,25 +527,6 @@ foreach ($agents as $agent) {
// And does not print outdated agents in red. WRONG !!!!
// $data[7] = ui_print_timestamp ($agent_info["last_contact"], true);
//Only for AW flag
if (check_acl ($config["id_user"], $group_id, "AW")) {
// Has remote configuration ?
$data[9]="";
if (enterprise_installed()) {
if (config_agents_has_remote_configuration($agent["id_agente"])) {
$data[9] = "<a href='index.php?" .
"sec=estado&" .
"sec2=godmode/agentes/configurar_agente&" .
"tab=remote_configuration&" .
"id_agente=" . $agent["id_agente"] . "&" .
"disk_conf=1'>".
html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config')))."</a>";
}
}
}
array_push ($table->data, $data);
}

View File

@ -193,6 +193,7 @@ ui_toggle($html_toggle,
parameters["sort"] = sort_rows;
parameters["status_filter_monitor"] = filter_status;
parameters["status_text_monitor"] = filter_text;
parameters["status_module_group"] = filter_group;
parameters["page"] = "include/ajax/module";
@ -218,6 +219,7 @@ ui_toggle($html_toggle,
function filter_modules() {
filter_status = $("#status_filter_monitor").val();
filter_group = $("#status_module_group").val();
filter_text = $("input[name='status_text_monitor']").val();
var parameters = {};
@ -228,6 +230,7 @@ ui_toggle($html_toggle,
parameters["sort"] = sort_rows;
parameters["status_filter_monitor"] = filter_status;
parameters["status_text_monitor"] = filter_text;
parameters["status_module_group"] = filter_group;
parameters["filter_monitors"] = 1;
parameters["monitors_change_filter"] = 1;
parameters["page"] = "include/ajax/module";
@ -255,6 +258,7 @@ ui_toggle($html_toggle,
function reset_filter_modules() {
$("#status_filter_monitor").val(-1);
$("#status_module_group").val(-1);
$("input[name='status_text_monitor']").val("");
filter_modules();
@ -270,6 +274,7 @@ ui_toggle($html_toggle,
parameters["sort"] = sort_rows;
parameters["status_filter_monitor"] = filter_status;
parameters["status_text_monitor"] = filter_text;
parameters["status_module_group"] = filter_group;
parameters["filter_monitors"] = 0;
parameters["monitors_change_filter"] = 0;
parameters["page"] = "include/ajax/module";
@ -408,7 +413,7 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
</script>
<?php
function print_form_filter_monitors($id_agent, $status_filter_monitor = -1,
$status_text_monitor = '') {
$status_text_monitor = '', $status_module_group=-1) {
$form_text = '';
@ -431,14 +436,24 @@ function print_form_filter_monitors($id_agent, $status_filter_monitor = -1,
$table->data[0][2] = __('Free text for search (*):');
$table->data[0][3] = html_print_input_text('status_text_monitor', $status_text_monitor, '', 30, 100, true);
$table->data[0][4] = html_print_button(__('Filter'), 'filter', false, 'filter_modules();', 'class="sub search"', true);
$table->data[0][4] .= '&nbsp;' . html_print_button(__('Reset'), 'filter', false, 'reset_filter_modules();', 'class="sub upd"', true);
$table->data[0][4] = __('Module group');
$rows = db_get_all_rows_sql("SELECT *
FROM tmodule_group ORDER BY name");
$rows = io_safe_output($rows);
$rows_select = array();
if (!empty($rows)){
$rows_select[-1] = __('All');
foreach ($rows as $module_group)
$rows_select[$module_group['id_mg']] = __($module_group['name']);
}
$table->data[0][5] = html_print_select ($rows_select,'status_module_group', $status_module_group, '', '',0, true);
$table->data[0][6] = html_print_button(__('Filter'), 'filter', false, 'filter_modules();', 'class="sub search"', true);
$table->data[0][7] .= '&nbsp;' . html_print_button(__('Reset'), 'filter', false, 'reset_filter_modules();', 'class="sub upd"', true);
$form_text .= html_print_table($table, true);
$filter_hidden = false;
if ($status_filter_monitor == -1 && $status_text_monitor == '') {
if ($status_filter_monitor == -1 && $status_text_monitor == '' && $status_module_group == -1 ) {
$filter_hidden = true;
}

View File

@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
require_once ('include/functions_networkmap.php');
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
if ($activeTab == "radial_dynamic") {
include_once("include/functions_graph.php");
@ -39,7 +41,7 @@ if ($activeTab == "radial_dynamic") {
if (!empty($module_group))
$filter['module_group'] = $module_group;
echo graph_monitor_wheel(600, 650, $filter);
echo graph_monitor_wheel(600, 650, $filter, $strict_user);
echo "</div>";
return;
@ -56,7 +58,7 @@ if (!isset($text_filter)) {
$graph = networkmap_generate_hash(__('Pandora FMS'), $group, $simple,
$font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen,
$pure, $id_networkmap, $show_snmp_modules, true, true,
$text_filter);
$text_filter, $strict_user);
networkmap_print_jsdata($graph);

View File

@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
require_once ('include/functions_networkmap.php');
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
// Set filter
$filter = networkmap_get_filter ($layout);
@ -36,7 +38,7 @@ $filter = networkmap_get_filter ($layout);
$graph = networkmap_generate_dot_groups (__('Pandora FMS'), $group,
$simple, $font_size, $layout, $nooverlap, $zoom, $ranksep, $center,
$regen, $pure, $modwithalerts, $module_group, $hidepolicymodules,
$depth, $id_networkmap, $dont_show_subgroups, $text_filter);
$depth, $id_networkmap, $dont_show_subgroups, $text_filter, $strict_user);
if ($graph === false) {
ui_print_error_message (__('Map could not be generated'));

View File

@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
require_once ('include/functions_networkmap.php');
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$name = '';
$pure = (int) get_parameter ('pure', 0);
$activeTab = get_parameter ('tab', 'topology');
@ -143,7 +145,7 @@ if ($save_networkmap || $update_networkmap) {
}
}
$networkmaps = networkmap_get_networkmaps();
$networkmaps = networkmap_get_networkmaps('','', true, $strict_user);
$nomaps = false;
if ($networkmaps === false) {
@ -197,7 +199,7 @@ else {
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;pure=1&amp;tab='.$activeTab.'">' .
html_print_image("images/full_screen.png", true, array ('title' => __('Full screen'))) .'</a>');
}
if ($config['enterprise_installed']) {
if (($config['enterprise_installed']) && (!$strict_user)) {
$buttons['policies'] = array('active' => $activeTab == 'policies',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=policies&amp;pure='.$pure.'">' .
html_print_image("images/policies_mc.png", true, array ("title" => __('Policies view'))) .'</a>');
@ -215,9 +217,11 @@ $buttons['dinamic'] = array('active' => $activeTab == 'dinamic',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=dinamic&amp;pure='.$pure.'">' .
html_print_image("images/dynamic_network_icon.png", true, array ("title" => __('Dynamic view'))) .'</a>');
$buttons['radial_dinamic'] = array('active' => $activeTab == 'radial_dynamic',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=radial_dynamic&amp;pure='.$pure.'">' .
html_print_image("images/radial_dynamic_network_icon.png", true, array ("title" => __('Radial dynamic view'))) .'</a>');
if (!$strict_user) {
$buttons['radial_dinamic'] = array('active' => $activeTab == 'radial_dynamic',
'text' => '<a href="index.php?sec=network&amp;sec2=operation/agentes/networkmap&amp;tab=radial_dynamic&amp;pure='.$pure.'">' .
html_print_image("images/radial_dynamic_network_icon.png", true, array ("title" => __('Radial dynamic view'))) .'</a>');
}
$combolist = '<form name="query_sel" method="post" action="index.php?sec=network&sec2=operation/agentes/networkmap">';
@ -295,7 +299,7 @@ if (!empty($name)) {
ui_print_page_header (__('Network map') . " - " . $title,
"images/op_network.png", false, "network_map", false, $buttons);
if (tags_has_user_acl_tags()) {
if ((tags_has_user_acl_tags()) && (!$strict_user)) {
ui_print_tags_warning();
}

View File

@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "AR")) {
require_once ('include/functions_networkmap.php');
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
// Set filter
$filter = networkmap_get_filter ($layout);
@ -39,7 +41,7 @@ if (!isset($text_filter)) {
$graph = networkmap_generate_dot(__('Pandora FMS'), $group, $simple,
$font_size, $layout, $nooverlap, $zoom, $ranksep, $center, $regen,
$pure, $id_networkmap, $show_snmp_modules, true, true,
$text_filter, $l2_network, null, $dont_show_subgroups);
$text_filter, $l2_network, null, $dont_show_subgroups, $strict_user);
if ($graph === false) {
ui_print_error_message (__('Map could not be generated'));

View File

@ -73,6 +73,8 @@ if (is_ajax()) {
return;
}
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
ui_print_page_header(__('Network map'), "images/op_network.png", false, "network_map", false);
// Delete networkmap action
@ -118,7 +120,7 @@ $type_search = get_parameter('type_filter', '0');
</td>
<td class='datos'>
<?php
$networkmap_filter_types = networkmap_get_filter_types();
$networkmap_filter_types = networkmap_get_filter_types($strict_user);
html_print_select($networkmap_filter_types, 'type_filter',
$type_search, '', __('All'), 0, false);
?>
@ -200,7 +202,11 @@ else {
// If enterprise not loaded then skip this code
if ($network_map['type'] == 'policies' and (!defined('PANDORA_ENTERPRISE')))
continue;
if (($network_map['type'] == 'radial_dynamic' || $network_map['type'] == 'policies') && ($strict_user)) {
continue;
}
$data = array();
$data[0] = '<b><a href="index.php?sec=network&sec2=operation/agentes/networkmap&tab=view&id_networkmap=' . $network_map['id_networkmap'] . '">' . $network_map['name'] . '</a></b>';
$data[1] = $network_map['type'];
@ -234,7 +240,7 @@ if (check_acl ($config['id_user'], 0, "RW") || check_acl ($config['id_user'], 0,
'create' => __('Create'),
'delete' => __('Delete')
);
$networkmap_types = networkmap_get_types();
$networkmap_types = networkmap_get_types($strict_user);
$delete_options = array(
'selected' => __('Delete selected')
);

View File

@ -890,21 +890,21 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
$table->head[1] = __('Agent');
if (! defined ('METACONSOLE')) {
$table->head[1] .=' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=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;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[1] .=' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=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;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] = __('Type');
if (! defined ('METACONSOLE')) {
$table->head[2] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=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;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=type&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
$table->head[2] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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;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->head[3] = __('Module name');
if (! defined ('METACONSOLE')) {
$table->head[3] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=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;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=module_name&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleNameDown, "alt" => "down")) . '</a>';
$table->head[3] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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;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>';
}
/*
@ -913,16 +913,16 @@ $table->head[4] = __('Tags');
$table->head[5] = __('Interval');
if (! defined ('METACONSOLE')) {
$table->head[5] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=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;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=interval&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . '</a>';
$table->head[5] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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;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] = "center";
$table->head[6] = __('Status');
if (! defined ('METACONSOLE')) {
$table->head[6] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=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;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=status&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
$table->head[6] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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;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] = "center";
@ -936,7 +936,7 @@ $table->align[8] = "left";
$table->head[9] = __('Data');
if (! defined ('METACONSOLE')) {
$table->head[9] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=data&amp;sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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=data&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
}
$table->align[9] = "left";
@ -944,7 +944,7 @@ $table->align[9] = "left";
$table->head[10] = __('Timestamp');
if (! defined ('METACONSOLE')) {
$table->head[10] .= ' <a href="index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&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;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=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;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] = "right";

View File

@ -162,7 +162,7 @@ unset($table_source);
// By OID
$table_oid = new StdClass();
$table_oid->width = '100%';
$table_oid->head[] = __("Traps received by OID") . " - " . sprintf(__('Top %d'), 25);
$table_oid->head[] = __("Traps received by Enterprise String") . " - " . sprintf(__('Top %d'), 25);
$table_oid->head_colspan[] = 2;
$table_oid->headstyle[] = "background-color: #82b92e";
$table_oid->size = array();
@ -175,7 +175,7 @@ $table_oid_row = array();
$table_oid_data = new StdClass();
$table_oid_data->width = '100%';
$table_oid_data->head = array();
$table_oid_data->head['oid'] = __('Trap OID');
$table_oid_data->head['oid'] = __('Trap Enterprise String');
$table_oid_data->head['num'] = __('Number');
$table_oid_data->data = array();

57
pandora_console/operation/snmpconsole/snmp_view.php Normal file → Executable file
View File

@ -49,7 +49,7 @@ foreach ($user_groups as $id=>$name) {
$str_user_groups .= $id;
}
else {
$str_user_groups .= ','.$id;
$str_user_groups .= ',' . $id;
}
$i++;
}
@ -320,18 +320,22 @@ $table->data[2][3] = '<strong>'.__('Free search').'</strong>' . ui_print_help_ti
$table->data[2][4] = html_print_input_text ('free_search_string', $free_search_string, '', 40, 0, true);
// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other)
$table->data[4][1] = '<strong>'.__('Type').'</strong>' . ui_print_help_tip(__('Search by trap type'), true);
$table->data[4][1] = '<strong>'.__('Trap type').'</strong>' . ui_print_help_tip(__('Search by trap type'), true);
$trap_types = array(-1 => __('None'), 0 => __('Cold start (0)'), 1 => __('Warm start (1)'), 2 => __('Link down (2)'), 3 => __('Link up (3)'), 4 => __('Authentication failure (4)'), 5 => __('Other'));
$table->data[4][2] = html_print_select ($trap_types, 'trap_type', $trap_type, 'this.form.submit();', '', '', true, false, false);
$table->data[3][3] = '<strong>'.__('Group by OID/IP').'</strong>';
$table->data[3][3] = '<strong>'.__('Group by Enterprise String/IP').'</strong>';
$table->data[3][4] = __('Yes') . '&nbsp;'.
html_print_radio_button ('group_by', 1, '', $group_by, true) .
'&nbsp;&nbsp;';
$table->data[3][4] .= __('No') . '&nbsp;' .
html_print_radio_button ('group_by', 0, '', $group_by, true);
$filter = '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refr='.((int)get_parameter('refr', 0)).'&pure='.$config["pure"].'&tab='.$tab.'">';
$filter = '<form method="POST" action="index.php?' .
'sec=snmpconsole&' .
'sec2=operation/snmpconsole/snmp_view&' .
'refr=' . ((int)get_parameter('refr', 0)) . '&' .
'pure=' . $config["pure"] . '">';
$filter .= html_print_table($table, true);
$filter .= '<div style="width: ' . $table->width . '; text-align: right;">';
$filter .= html_print_submit_button(__('Update'), 'search', false, 'class="sub upd"', true);
@ -347,7 +351,8 @@ $trapcount = (int) db_get_value_sql($sql_count);
// No traps
if (empty ($traps)) {
echo '<div class="nf">'.__('There are no SNMP traps in database').'</div>';
echo '<div class="nf">' .
__('There are no SNMP traps in database') . '</div>';
return;
}
@ -368,7 +373,9 @@ $url_snmp = "index.php?" .
"group_by=" . $group_by . "&" .
"free_search_string=" . $free_search_string;
$urlPagination = $url_snmp . "&pagination=" . $pagination . "&offset=" . $offset;
$urlPagination = $url_snmp . "&" .
"pagination=" . $pagination . "&" .
"offset=" . $offset;
ui_pagination ($trapcount, $urlPagination, $offset, $pagination);
@ -391,7 +398,7 @@ $table->head[1] = __('SNMP Agent');
$table->align[1] = "center";
$table->size[1] = '15%';
$table->head[2] = __('OID');
$table->head[2] = __('Enterprise String');
$table->align[2] = "center";
$table->size[2] = '18%';
@ -401,7 +408,7 @@ if ($group_by) {
$table->size[3] = '5%';
}
$table->head[4] = __('Value');
$table->head[4] = __('Trap subtype');
$table->align[4] = "center";
$table->size[4] = '10%';
@ -421,7 +428,9 @@ $table->head[8] = __('Action');
$table->align[8] = "center";
$table->size[8] = '10%';
$table->head[9] = html_print_checkbox_extended ("allbox", 1, false, false, "javascript:CheckAll();", 'class="chk" title="'.__('All').'"', true);
$table->head[9] = html_print_checkbox_extended ("allbox", 1, false,
false, "javascript:CheckAll();",
'class="chk" title="'.__('All').'"', true);
$table->align[9] = "center";
$table->size[9] = '5%';
@ -430,7 +439,7 @@ $table->style[8] = "background: #F3F3F3; color: #111 !important;";
// Skip offset records
$idx = 0;
if ($traps !== false) {
foreach ($traps as $trap) {
$data = array ();
if (empty($trap["description"])){
@ -532,10 +541,10 @@ if ($traps !== false) {
$data[8] .= '<a href="' . $url_snmp . '&delete='.$trap["id_trap"].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">' . html_print_image("images/cross.png", true, array("border" => "0", "title" => __('Delete'))) . '</a> ';
}
}
$data[8] .= '<a href="javascript: toggleVisibleExtendedInfo(' . $trap["id_trap"] . ');">' . html_print_image("images/eye.png", true, array("alt" => __('Show more'), "title" => __('Show more'))) .'</a>';
$data[8] .= enterprise_hook ('editor_link', array ($trap));
$data[8] .= enterprise_hook ('editor_link', array ($trap));
$data[9] = html_print_checkbox_extended ("snmptrapid[]", $trap["id_trap"], false, false, '', 'class="chk"', true);
@ -544,7 +553,8 @@ if ($traps !== false) {
//Hiden file for description
$string = '<table style="border:solid 1px #D3D3D3;" width="90%" class="toggle">
<tr>
<td align="left" valign="top" width="15%" ><b>' . __('Custom data:') . '</b></td>
<td align="left" valign="top" width="15%">' .
'<b>' . __('Variable bindings:') . '</b></td>
<td align="left" >';
if ($group_by) {
@ -558,7 +568,8 @@ if ($traps !== false) {
"free_search_string=" . $free_search_string;
$string .= '<a href='.$new_url.'>'.__('See more details').'</a>';
} else {
}
else {
// Print binding vars separately
$binding_vars = explode ("\t", $trap['oid_custom']);
foreach ($binding_vars as $var) {
@ -569,7 +580,7 @@ if ($traps !== false) {
$string .= '</td>
</tr>
<tr>
<td align="left" valign="top">' . '<b>' . __('OID:') . '</td>
<td align="left" valign="top">' . '<b>' . __('Enterprise String:') . '</td>
<td align="left"> ' . $trap['oid'] . '</td>
</tr>';
@ -580,6 +591,13 @@ if ($traps !== false) {
</tr>';
}
if ($trap["text"] != "") {
$string .= '<tr>
<td align="left" valign="top">' . '<b>' . __('Text:') . '</td>
<td align="left">' . $trap['text'] . '</td>
</tr>';
}
if ($trap["type"] != "") {
$trap_types = array(-1 => __('None'), 0 => __('Cold start (0)'), 1 => __('Warm start (1)'), 2 => __('Link down (2)'), 3 => __('Link up (3)'), 4 => __('Authentication failure (4)'), 5 => __('Other'));
@ -606,7 +624,10 @@ if ($traps !== false) {
$desc_trap_type = __('Other');
break;
}
$string .= '<tr><td align="left" valign="top">' . '<b>' . __('Type:') . '</td><td align="left">' . $desc_trap_type . '</td></tr>';
$string .= '<tr><td align="left" valign="top">' .
'<b>' . __('Trap type:') . '</b>' .
'</td>' .
'<td align="left">' . $desc_trap_type . '</td></tr>';
}
if ($group_by) {
@ -643,7 +664,7 @@ if ($traps !== false) {
<td align="left" valign="top">' . '<b>' . __('Last trap:') . '</td>
<td align="left">' . $last_trap . '</td>
</tr>';
}
$string .= '</table>';

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150119
Version: 6.0dev-150126
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="6.0dev-150119"
pandora_version="6.0dev-150126"
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 = "6.0dev";
my $pandora_build = "150119";
my $pandora_build = "150126";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

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

View File

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

View File

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

View File

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