Merge remote-tracking branch 'origin/develop' into 2078-ue-cmdb-integration
This commit is contained in:
commit
401583e605
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.727-180914
|
||||
Version: 7.0NG.727-180919
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.727-180914"
|
||||
pandora_version="7.0NG.727-180919"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.727';
|
||||
use constant AGENT_BUILD => '180914';
|
||||
use constant AGENT_BUILD => '180919';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.727
|
||||
%define release 180914
|
||||
%define release 180919
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.727
|
||||
%define release 180914
|
||||
%define release 180919
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.727"
|
||||
PI_BUILD="180914"
|
||||
PI_BUILD="180919"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{180914}
|
||||
{180919}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace Pandora;
|
|||
*/
|
||||
Pandora_Data::Pandora_Data (string value) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = pandora_data_unknown_source;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time) {
|
|||
*/
|
||||
Pandora_Data::Pandora_Data (string value, string data_origin) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = data_origin;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time, string data_o
|
|||
*/
|
||||
Pandora_Data::Pandora_Data () {
|
||||
this->value = "";
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = "";
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.727(Build 180914)")
|
||||
#define PANDORA_VERSION ("7.0NG.727(Build 180919)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.727(Build 180914))"
|
||||
VALUE "ProductVersion", "(7.0NG.727(Build 180919))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.727-180914
|
||||
Version: 7.0NG.727-180919
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.727-180914"
|
||||
pandora_version="7.0NG.727-180919"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -24,4 +24,26 @@ ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_node_id` INT(10) N
|
|||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
COMMIT;
|
|
@ -1769,8 +1769,32 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
|||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
|
|
|
@ -215,20 +215,57 @@ if (! check_acl($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
|
||||
$url_tree = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree";
|
||||
$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups";
|
||||
$buttons['tree'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_tree'>" .
|
||||
html_print_image(
|
||||
"images/gm_massive_operations.png",
|
||||
true,
|
||||
array (
|
||||
"title" => __('Tree Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$buttons['groups'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_groups'>" .
|
||||
html_print_image(
|
||||
"images/group.png",
|
||||
true,
|
||||
array(
|
||||
"title" => __('Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$tab = (string)get_parameter('tab', 'groups');
|
||||
|
||||
// Marks correct tab
|
||||
switch ($tab) {
|
||||
case 'tree':
|
||||
$buttons['tree']['active'] = true;
|
||||
break;
|
||||
case 'groups':
|
||||
default:
|
||||
$buttons['groups']['active'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
agents_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
echo '<div class="notify">';
|
||||
echo __("Edit or delete groups can cause problems with synchronization");
|
||||
echo '</div>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui_print_page_header (
|
||||
__("Groups defined in %s", get_product_name()),
|
||||
"images/group.png", false, "", true, ""
|
||||
"images/group.png", false, "", true, $buttons
|
||||
);
|
||||
$sec = 'gagente';
|
||||
}
|
||||
|
||||
$create_group = (bool) get_parameter ('create_group');
|
||||
|
@ -365,148 +402,158 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
|||
}
|
||||
}
|
||||
|
||||
$acl='';
|
||||
$search_name = '';
|
||||
$offset = (int)get_parameter('offset', 0);
|
||||
$search = (string)get_parameter('search', '');
|
||||
$block_size = $config['block_size'];
|
||||
if($tab == 'tree'){
|
||||
echo html_print_image('images/spinner.gif', true,
|
||||
array('class' => "loading_tree",
|
||||
'style' => 'display: none;'));
|
||||
echo "<div id='tree-controller-recipient'></div>";
|
||||
|
||||
if(!empty($search)){
|
||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
||||
}
|
||||
else{
|
||||
$acl='';
|
||||
$search_name = '';
|
||||
$offset = (int)get_parameter('offset', 0);
|
||||
$search = (string)get_parameter('search', '');
|
||||
$block_size = $config['block_size'];
|
||||
|
||||
if (!users_can_manage_group_all("AR")){
|
||||
$user_groups_acl = users_get_groups(false, "AR");
|
||||
$groups_acl = implode(",", $user_groups_ACL);
|
||||
if(empty($groups_acl)) return ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
if(!empty($search)){
|
||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
||||
}
|
||||
|
||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
||||
}
|
||||
if (!users_can_manage_group_all("AR")){
|
||||
$user_groups_acl = users_get_groups(false, "AR");
|
||||
$groups_acl = implode(",", $user_groups_ACL);
|
||||
if(empty($groups_acl)) return ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= "<table class='databox filters' width='100%' style='font-weight: bold;'>";
|
||||
$form .= "<tr><td>" . __('Search') . ' ';
|
||||
$form .= html_print_input_text ("search", $search, '', 100, 100, true);
|
||||
$form .= "</td><td>";
|
||||
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
$form .= "<td></tr>";
|
||||
$form .= "</table>";
|
||||
$form .= "</form>";
|
||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
||||
}
|
||||
|
||||
echo $form;
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= "<table class='databox filters' width='100%' style='font-weight: bold;'>";
|
||||
$form .= "<tr><td>" . __('Search') . ' ';
|
||||
$form .= html_print_input_text ("search", $search, '', 100, 100, true);
|
||||
$form .= "</td><td>";
|
||||
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
$form .= "<td></tr>";
|
||||
$form .= "</table>";
|
||||
$form .= "</form>";
|
||||
|
||||
$groups_sql =
|
||||
"SELECT t.*,
|
||||
p.nombre AS parent_name,
|
||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
ON t.parent=p.id_grupo
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
ORDER BY nombre
|
||||
LIMIT $offset, $block_size
|
||||
";
|
||||
echo $form;
|
||||
|
||||
$groups = db_get_all_rows_sql($groups_sql);
|
||||
|
||||
if (!empty($groups)) {
|
||||
//Count all groups for pagination only saw user and filters
|
||||
$groups_sql_count = "SELECT count(*)
|
||||
$groups_sql =
|
||||
"SELECT t.*,
|
||||
p.nombre AS parent_name,
|
||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
ON t.parent=p.id_grupo
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
ORDER BY nombre
|
||||
LIMIT $offset, $block_size
|
||||
";
|
||||
$groups_count = db_get_value_sql($groups_sql_count);
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Parent');
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[0] = 'right';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[6] = 'left';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '10%';
|
||||
$table->data = array ();
|
||||
$groups = db_get_all_rows_sql($groups_sql);
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
$url = "index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group=".$group['id_grupo'];
|
||||
$url_delete = "index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group=" . $group['id_grupo'];
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = "<a href='$url'>" . $group['nombre'] . "</a>";
|
||||
$table->data[$key][2] = html_print_image(
|
||||
"images/groups_small/" . $group['icon'] . ".png",
|
||||
true,
|
||||
array(
|
||||
"style" => '',
|
||||
"class" => "bot",
|
||||
"alt" => $group['nombre'],
|
||||
"title" => $group['nombre'],
|
||||
false, false, false, true
|
||||
)
|
||||
);
|
||||
if (!empty($groups)) {
|
||||
//Count all groups for pagination only saw user and filters
|
||||
$groups_sql_count = "SELECT count(*)
|
||||
FROM tgrupo t
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
";
|
||||
$groups_count = db_get_value_sql($groups_sql_count);
|
||||
|
||||
//reporting_get_group_stats
|
||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->data[$key][6] = "<a href='$url'>" .
|
||||
html_print_image(
|
||||
"images/config.png",
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Parent');
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[0] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[6] = 'left';
|
||||
$table->size[0] = '3%';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '5%';
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
$url = "index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group=".$group['id_grupo'];
|
||||
$url_delete = "index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group=" . $group['id_grupo'];
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = "<a href='$url'>" . $group['nombre'] . "</a>";
|
||||
$table->data[$key][2] = html_print_image(
|
||||
"images/groups_small/" . $group['icon'] . ".png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Edit'),
|
||||
"title" => __('Edit'),
|
||||
"border" => '0'
|
||||
"style" => '',
|
||||
"class" => "bot",
|
||||
"alt" => $group['nombre'],
|
||||
"title" => $group['nombre'],
|
||||
false, false, false, true
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
);
|
||||
|
||||
//reporting_get_group_stats
|
||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->data[$key][6] = "<a href='$url'>" .
|
||||
html_print_image(
|
||||
"images/config.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Edit'),
|
||||
"title" => __('Edit'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
$confirm_message = __('Are you sure?');
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group') . ". " . $confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= ' ' .
|
||||
'<a href="'. $url_delete. '" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">' .
|
||||
html_print_image(
|
||||
"images/cross.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Delete'),
|
||||
"title" => __('Delete'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
$confirm_message = __('Are you sure?');
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group') . ". " . $confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= ' ' .
|
||||
'<a href="'. $url_delete. '" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">' .
|
||||
html_print_image(
|
||||
"images/cross.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Delete'),
|
||||
"title" => __('Delete'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', false
|
||||
);
|
||||
html_print_table ($table);
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', true
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', false
|
||||
);
|
||||
html_print_table ($table);
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', true
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, "PM")) {
|
||||
|
@ -517,5 +564,101 @@ if (check_acl($config['id_user'], 0, "PM")) {
|
|||
echo '</form>';
|
||||
}
|
||||
|
||||
ui_require_javascript_file("TreeController", "include/javascript/tree/");
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
$tab = "group_edition";
|
||||
|
||||
?>
|
||||
|
||||
<?php if (!is_metaconsole()){ ?>
|
||||
<script type="text/javascript" src="include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php }else{ ?>
|
||||
<script type="text/javascript" src="../../include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var treeController = TreeController.getController();
|
||||
|
||||
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
|
||||
treeController.recipient.empty();
|
||||
|
||||
$(".loading_tree").show();
|
||||
|
||||
var parameters = {};
|
||||
parameters['page'] = "include/ajax/tree.ajax";
|
||||
parameters['getChildren'] = 1;
|
||||
parameters['type'] = "<?php echo $tab; ?>";
|
||||
parameters['filter'] = {};
|
||||
parameters['filter']['searchGroup'] = '';
|
||||
parameters['filter']['searchAgent'] = '';
|
||||
parameters['filter']['statusAgent'] = '';
|
||||
parameters['filter']['searchModule'] = '';
|
||||
parameters['filter']['statusModule'] = '';
|
||||
parameters['filter']['groupID'] = '';
|
||||
parameters['filter']['tagID'] = '';
|
||||
parameters['filter']['searchHirearchy'] = 1;
|
||||
parameters['filter']['show_not_init_agents'] = 1;
|
||||
parameters['filter']['show_not_init_modules'] = 1;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
data: parameters,
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
$(".loading_tree").hide();
|
||||
|
||||
treeController.init({
|
||||
recipient: $("div#tree-controller-recipient"),
|
||||
//detailRecipient: $.fixedBottomBox({ width: 400, height: window.innerHeight * 0.9 }),
|
||||
page: parameters['page'],
|
||||
emptyMessage: "<?php echo __('No data found'); ?>",
|
||||
foundMessage: "<?php echo __('Found groups'); ?>",
|
||||
tree: data.tree,
|
||||
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",
|
||||
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
filter: parameters['filter'],
|
||||
counterTitles: {
|
||||
total: {
|
||||
agents: "<?php echo __('Total agents'); ?>",
|
||||
modules: "<?php echo __('Total modules'); ?>",
|
||||
none: "<?php echo __('Total'); ?>"
|
||||
},
|
||||
alerts: {
|
||||
agents: "<?php echo __('Fired alerts'); ?>",
|
||||
modules: "<?php echo __('Fired alerts'); ?>",
|
||||
none: "<?php echo __('Fired alerts'); ?>"
|
||||
},
|
||||
critical: {
|
||||
agents: "<?php echo __('Critical agents'); ?>",
|
||||
modules: "<?php echo __('Critical modules'); ?>",
|
||||
none: "<?php echo __('Critical'); ?>"
|
||||
},
|
||||
warning: {
|
||||
agents: "<?php echo __('Warning agents'); ?>",
|
||||
modules: "<?php echo __('Warning modules'); ?>",
|
||||
none: "<?php echo __('Warning'); ?>"
|
||||
},
|
||||
unknown: {
|
||||
agents: "<?php echo __('Unknown agents'); ?>",
|
||||
modules: "<?php echo __('Unknown modules'); ?>",
|
||||
none: "<?php echo __('Unknown'); ?>"
|
||||
},
|
||||
not_init: {
|
||||
agents: "<?php echo __('Not init agents'); ?>",
|
||||
modules: "<?php echo __('Not init modules'); ?>",
|
||||
none: "<?php echo __('Not init'); ?>"
|
||||
},
|
||||
ok: {
|
||||
agents: "<?php echo __('Normal agents'); ?>",
|
||||
modules: "<?php echo __('Normal modules'); ?>",
|
||||
none: "<?php echo __('Normal'); ?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1543,8 +1543,16 @@ function loadFieldsFromDB(item) {
|
|||
$("select[name=parent]").val(val);
|
||||
if (key == 'linked_layout_status_type')
|
||||
$("select[name=linked_map_status_calculation_type]").val(val).change();
|
||||
if (key == 'id_layout_linked')
|
||||
$("select[name=map_linked]").val(val).change();
|
||||
if (key == 'id_layout_linked') {
|
||||
if (data['linked_layout_node_id'] == null) {
|
||||
$("select[name=map_linked]").val(val).change();
|
||||
}
|
||||
else {
|
||||
var $option = $("select[name=map_linked] > option[data-node-id=" + data['linked_layout_node_id'] + "][value=" + val + "]");
|
||||
if ($option.length === 0) $option = $("select[name=map_linked] > option[value=" + val + "]");
|
||||
$option.prop("selected", true).parent().change();
|
||||
}
|
||||
}
|
||||
if (key == 'linked_layout_node_id')
|
||||
$("input[name=linked_map_node_id]").val(val);
|
||||
if (key == 'id_layout_linked_weight')
|
||||
|
|
|
@ -97,7 +97,15 @@ if ((isset ($_GET["update"])) OR ((isset ($_GET["create"])))) {
|
|||
$field2 = get_parameter ("_field2_", "");
|
||||
$field3 = get_parameter ("_field3_", "");
|
||||
$field4 = get_parameter ("_field4_", "");
|
||||
|
||||
$snmp_version = get_parameter_post ("snmp_version");
|
||||
$snmp3_auth_user = get_parameter_post ("snmp_auth_user");
|
||||
$snmp3_auth_pass = get_parameter_post ("snmp_auth_pass");
|
||||
$snmp3_privacy_method = get_parameter_post ("snmp_privacy_method");
|
||||
$snmp3_privacy_pass = get_parameter_post ("snmp_privacy_pass");
|
||||
$snmp3_auth_method = get_parameter_post ("snmp_auth_method");
|
||||
$snmp3_security_level = get_parameter_post ("snmp_security_level");
|
||||
|
||||
|
||||
if ($mode == "network_sweep")
|
||||
$id_recon_script = 0;
|
||||
else
|
||||
|
@ -154,8 +162,30 @@ if (isset($_GET["update"])) {
|
|||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version
|
||||
);
|
||||
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level
|
||||
);
|
||||
if($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c'){
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => ''
|
||||
);
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$where = array('id_rt' => $id);
|
||||
|
||||
|
@ -217,13 +247,37 @@ if (isset($_GET["create"])) {
|
|||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version
|
||||
);
|
||||
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level
|
||||
);
|
||||
if($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c'){
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => ''
|
||||
);
|
||||
}
|
||||
if ($values['snmp_version'] == '3'){
|
||||
$values['vlan_enabled'] = 0;
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$name = io_safe_output($name);
|
||||
$name = trim($name, ' ');
|
||||
$name = io_safe_input($name);
|
||||
|
||||
$reason = "";
|
||||
|
||||
if ($name != "") {
|
||||
|
@ -293,7 +347,7 @@ else {
|
|||
$color=1;
|
||||
if ($result !== false) {
|
||||
$table = new StdClass();
|
||||
$table->head = array (__('Name'), __('Network'), __('Mode'), __('Group'), __('Incident'), __('OS'), __('Interval'), __('Ports'), __('Action'));
|
||||
$table->head = array (__('Name'), __('Network'), __('Mode'), __('Group'), __('SNMP Version'), __('Incident'), __('OS'), __('Interval'), __('Ports'), __('Action'));
|
||||
$table->align = array ("left","left","left","left","left","left","left","left");
|
||||
$table->width = "100%";
|
||||
$table->cellpadding = 4;
|
||||
|
@ -336,48 +390,64 @@ if ($result !== false) {
|
|||
$data[3] = "-";
|
||||
}
|
||||
|
||||
//SNMP VERSION
|
||||
if ($row["snmp_version"] == '1'){
|
||||
$data[4] = "v. 1";
|
||||
}
|
||||
elseif($row["snmp_version"] == '2'){
|
||||
$data[4] = "v. 2";
|
||||
}
|
||||
elseif($row["snmp_version"] == '2c'){
|
||||
$data[4] = "v. 2c";
|
||||
}
|
||||
elseif($row["snmp_version"] == '3'){
|
||||
$data[4] = "v. 3";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// INCIDENT
|
||||
$data[4] = (($row["create_incident"] == 1) ? __('Yes') : __('No'));
|
||||
$data[5] = (($row["create_incident"] == 1) ? __('Yes') : __('No'));
|
||||
|
||||
// OS
|
||||
if ($row["id_recon_script"] == 0) {
|
||||
$data[5] =(($row["id_os"] > 0) ? ui_print_os_icon ($row["id_os"], false, true) : __('Any'));
|
||||
$data[6] =(($row["id_os"] > 0) ? ui_print_os_icon ($row["id_os"], false, true) : __('Any'));
|
||||
}
|
||||
else {
|
||||
$data[5] = "-";
|
||||
$data[6] = "-";
|
||||
}
|
||||
// INTERVAL
|
||||
if ($row["interval_sweep"]==0)
|
||||
$data[6] = __("Manual");
|
||||
$data[7] = __("Manual");
|
||||
else
|
||||
$data[6] =human_time_description_raw($row["interval_sweep"]);
|
||||
$data[7] =human_time_description_raw($row["interval_sweep"]);
|
||||
|
||||
// PORTS
|
||||
if ($row["id_recon_script"] == 0) {
|
||||
$data[7] = substr($row["recon_ports"],0,15);
|
||||
$data[8] = substr($row["recon_ports"],0,15);
|
||||
}
|
||||
else {
|
||||
$data[7] = "-";
|
||||
$data[8] = "-";
|
||||
}
|
||||
|
||||
// ACTION
|
||||
$task_group = $row["id_group"];
|
||||
|
||||
if (in_array($task_group, $user_groups_w)){
|
||||
$data[8] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">' . html_print_image("images/eye.png", true) . '</a>';
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||
$data[9] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">' . html_print_image("images/eye.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||
if($mode_name != 'IPAM Recon'){
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' .html_print_image("images/config.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' .html_print_image("images/config.png", true) . '</a>';
|
||||
} else {
|
||||
$sql_ipam = 'select id from tipam_network where id_recon_task =' . $row["id_rt"];
|
||||
$id_recon_ipam = db_get_sql($sql_ipam);
|
||||
$data[8] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=' . $id_recon_ipam . '">' . html_print_image("images/config.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=' . $id_recon_ipam . '">' . html_print_image("images/config.png", true) . '</a>';
|
||||
}
|
||||
if($row["disabled"] == 0) {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=1">' .html_print_image("images/lightbulb.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=1">' .html_print_image("images/lightbulb.png", true) . '</a>';
|
||||
}
|
||||
else {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=0">' .html_print_image("images/lightbulb_off.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=0">' .html_print_image("images/lightbulb_off.png", true) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,13 @@ if (isset($_GET["update"]) || (isset($_GET["upd"]))) {
|
|||
$id_os = $row["id_os"];
|
||||
$recon_ports = $row["recon_ports"];
|
||||
$snmp_community = $row["snmp_community"];
|
||||
$snmp_version = $row["snmp_version"];
|
||||
$snmp3_auth_user = $row["snmp_auth_user"];
|
||||
$snmp3_auth_pass = $row["snmp_auth_pass"];
|
||||
$snmp3_privacy_method = $row["snmp_privacy_method"];
|
||||
$snmp3_privacy_pass = $row["snmp_privacy_pass"];
|
||||
$snmp3_auth_method = $row["snmp_auth_method"];
|
||||
$snmp3_security_level = $row["snmp_security_level"];
|
||||
$id_recon_script = $row["id_recon_script"];
|
||||
$field1 = $row["field1"];
|
||||
$field2 = $row["field2"];
|
||||
|
@ -156,6 +163,13 @@ elseif (isset($_GET["create"]) || isset($_GET["crt"])) {
|
|||
$id_group = 0;
|
||||
$create_incident = 1;
|
||||
$snmp_community = "public";
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
$snmp3_privacy_method = '';
|
||||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
$id_network_profile = 0;
|
||||
$id_os = -1; // Any
|
||||
$recon_ports = ""; // Any
|
||||
|
@ -212,6 +226,13 @@ $table->rowclass[20] = "network_sweep";
|
|||
$table->rowclass[21] = "network_sweep";
|
||||
$table->rowclass[22] = "network_sweep";
|
||||
$table->rowclass[23] = "network_sweep";
|
||||
$table->rowclass[24] = "network_sweep";
|
||||
$table->rowclass[25] = "network_sweep recon_v3";
|
||||
$table->rowclass[26] = "network_sweep recon_v3";
|
||||
$table->rowclass[27] = "network_sweep recon_v3";
|
||||
$table->rowclass[28] = "network_sweep recon_v3";
|
||||
$table->rowclass[29] = "network_sweep recon_v3";
|
||||
$table->rowclass[30] = "network_sweep recon_v3";
|
||||
|
||||
$table->rowclass[6] = "recon_script";
|
||||
$table->rowclass[13] = "recon_script";
|
||||
|
@ -327,6 +348,34 @@ $table->data[12][0] = "<b>".__('SNMP Default community');
|
|||
$table->data[12][0] .= ui_print_help_tip (__('You can specify several values, separated by commas, for example: public,mysecret,1234'), true);
|
||||
$table->data[12][1] = html_print_input_text ('snmp_community', $snmp_community, '', 35, 0, true);
|
||||
|
||||
//SNMP version
|
||||
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
$table->data[24][0] ="<b>". _('SNMP version');
|
||||
$table->data[24][1] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', 0, true);
|
||||
|
||||
$table->data[25][0] ="<b>".__('Auth user');
|
||||
$table->data[25][1] = html_print_input_text ('snmp_auth_user', $snmp3_auth_user, '', 15, 60, true, '',
|
||||
false, '', '');
|
||||
$table->data[26][0] ="<b>". __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$table->data[26][1] = html_print_input_password ('snmp_auth_pass', $snmp3_auth_pass, '', 15, 60, true, '',
|
||||
false, '');
|
||||
$table->data[26][1] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mmen', true);
|
||||
|
||||
$table->data[27][0] ="<b>". __('Privacy method');
|
||||
$table->data[27][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[28][0] ="<b>". __('Privacy pass') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$table->data[28][1] = html_print_input_password ('snmp_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true, '',
|
||||
false, '');
|
||||
$table->data[29][0] ="<b>". __('Auth method');
|
||||
$table->data[29][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp_auth_method', $snmp3_auth_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[30][0] ="<b>". __('Security level');
|
||||
$table->data[30][1] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp_security_level', $snmp3_security_level, '', '', '', true, false, false, '', '');
|
||||
|
||||
// Explanation
|
||||
$explanation = db_get_value('description', 'trecon_script', 'id_recon_script', $id_recon_script);
|
||||
|
||||
|
@ -461,9 +510,24 @@ $('select#id_recon_script').change(function() {
|
|||
get_explanation_recon_script($(this).val());
|
||||
});
|
||||
|
||||
$('select#snmp_version').change(function () {
|
||||
if (this.value == "3") {
|
||||
$(".recon_v3").show();
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").attr("disabled", true);
|
||||
$("input[name=vlan_enabled]").removeAttr("checked");
|
||||
$("input[name=vlan_enabled]").attr("disabled", true);
|
||||
}
|
||||
else {
|
||||
$(".recon_v3").hide();
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
$("input[name=vlan_enabled]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('select#mode').change(function() {
|
||||
var type = $(this).val();
|
||||
|
||||
if (type == 'recon_script') {
|
||||
$(".recon_script").show();
|
||||
$(".network_sweep").hide();
|
||||
|
@ -474,6 +538,7 @@ $('select#mode').change(function() {
|
|||
$(".recon_script").hide();
|
||||
$(".network_sweep").show();
|
||||
$('.macro_field').remove();
|
||||
$('select#snmp_version').trigger('change');
|
||||
}
|
||||
}).change();
|
||||
|
||||
|
@ -543,5 +608,5 @@ function get_explanation_recon_script (id) {
|
|||
});
|
||||
taskManager.addTask(xhr);
|
||||
}
|
||||
/* ]]> */
|
||||
|
||||
</script>
|
||||
|
|
|
@ -43,6 +43,7 @@ if (is_ajax ()) {
|
|||
require_once($config['homedir'] . "/include/class/TreeModule.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeTag.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeGroup.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeGroupEdition.class.php");
|
||||
enterprise_include_once("include/class/TreePolicies.class.php");
|
||||
enterprise_include_once("include/class/TreeGroupMeta.class.php");
|
||||
require_once($config['homedir'] . "/include/functions_reporting.php");
|
||||
|
@ -104,6 +105,9 @@ if (is_ajax ()) {
|
|||
if (!class_exists('TreePolicies')) break;
|
||||
$tree = new TreePolicies($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
case 'group_edition':
|
||||
$tree = new TreeGroupEdition($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
default:
|
||||
// FIXME. No error handler
|
||||
return;
|
||||
|
|
|
@ -101,7 +101,7 @@ $height = get_parameter('height', null);
|
|||
$parent = get_parameter('parent', null);
|
||||
$map_linked = get_parameter('map_linked', null);
|
||||
$linked_map_node_id = get_parameter('linked_map_node_id', null);
|
||||
$linked_map_status_calculation_type = get_parameter('linked_map_status_calculation_type', 'default');
|
||||
$linked_map_status_calculation_type = get_parameter('linked_map_status_calculation_type', null);
|
||||
|
||||
$map_linked_weight = get_parameter('map_linked_weight', null);
|
||||
if ($map_linked_weight !== null) {
|
||||
|
@ -615,8 +615,8 @@ switch ($action) {
|
|||
$values['id_agent'] = $id_agent;
|
||||
}
|
||||
|
||||
if ($linked_map_node_id) {
|
||||
$values['linked_layout_node_id'] = $linked_map_node_id;
|
||||
if ($linked_map_node_id !== null) {
|
||||
$values['linked_layout_node_id'] = (int) $linked_map_node_id;
|
||||
}
|
||||
}
|
||||
else if ($id_agent == 0) {
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 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 Lesser 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.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeGroupEdition extends TreeGroup {
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
}
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getProcessedGroups () {
|
||||
$processed_groups = array();
|
||||
// Index and process the groups
|
||||
$groups = $this->getGroupCounters();
|
||||
|
||||
// If user have not permissions in parent, set parent node to 0 (all)
|
||||
// Avoid to do foreach for admins
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
foreach ($groups as $id => $group) {
|
||||
if (!isset($this->userGroups[$groups[$id]['parent']])) {
|
||||
$groups[$id]['parent'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Build the group hierarchy
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
||||
$parent = $groups[$id]['parent'];
|
||||
// Parent exists
|
||||
if (!isset($groups[$parent]['children'])) {
|
||||
$groups[$parent]['children'] = array();
|
||||
}
|
||||
// Store a reference to the group into the parent
|
||||
$groups[$parent]['children'][] = &$groups[$id];
|
||||
// This group was introduced into a parent
|
||||
$groups[$id]['have_parent'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the children groups
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['children'])) {
|
||||
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
|
||||
}
|
||||
}
|
||||
//Filter groups and eliminates the reference to children groups out of her parent
|
||||
$groups = array_filter($groups, function ($group) {
|
||||
return !$group['have_parent'];
|
||||
});
|
||||
|
||||
usort($groups, array("Tree", "cmpSortNames"));
|
||||
return $groups;
|
||||
}
|
||||
|
||||
|
||||
protected function getGroupCounters() {
|
||||
$messages = array(
|
||||
'confirm' => __('Confirm'),
|
||||
'cancel' => __('Cancel'),
|
||||
'messg' => __('Are you sure?')
|
||||
);
|
||||
$sql = "SELECT id_grupo AS gid,
|
||||
nombre as name, parent, icon
|
||||
FROM tgrupo
|
||||
";
|
||||
|
||||
$stats = db_get_all_rows_sql($sql);
|
||||
$group_stats = array();
|
||||
foreach ($stats as $group) {
|
||||
$group_stats[$group['gid']]['name'] = $group['name'];
|
||||
$group_stats[$group['gid']]['parent'] = $group['parent'];
|
||||
$group_stats[$group['gid']]['icon'] = $group['icon'];
|
||||
$group_stats[$group['gid']]['id'] = $group['gid'];
|
||||
$group_stats[$group['gid']]['type'] = 'group';
|
||||
|
||||
$group_stats[$group['gid']] = $this->getProcessedItem($group_stats[$group['gid']]);
|
||||
$group_stats[$group['gid']]['delete']['messages'] = $messages;
|
||||
$group_stats[$group['gid']]['edit'] = 1;
|
||||
$group_stats[$group['gid']]['alerts'] = '';
|
||||
}
|
||||
|
||||
return $group_stats;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180914';
|
||||
$build_version = 'PC180919';
|
||||
$pandora_version = 'v7.0NG.727';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1638,23 +1638,13 @@ function get_agent_alert_fired ($id_agent, $id_alert, $period, $date = 0) {
|
|||
*
|
||||
* @return array An array with all the events happened.
|
||||
*/
|
||||
function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) {
|
||||
function get_module_alert_fired ($id_agent_module, $id_alert) {
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = time_w_fixed_tz($date);
|
||||
}
|
||||
if (empty ($date)) {
|
||||
$date = get_system_time();
|
||||
}
|
||||
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$sql = sprintf ('SELECT timestamp
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tevento
|
||||
WHERE id_agentmodule = %d AND utimestamp > %d
|
||||
AND utimestamp <= %d
|
||||
WHERE id_agentmodule = %d
|
||||
AND id_alert_am = %d
|
||||
ORDER BY timestamp DESC', $id_agent_module, $datelimit, $date, $id_alert);
|
||||
ORDER BY timestamp DESC', $id_agent_module, $id_alert);
|
||||
|
||||
return db_get_all_rows_sql ($sql);
|
||||
}
|
||||
|
|
|
@ -513,6 +513,8 @@ function grafico_modulo_sparse_data(
|
|||
}
|
||||
$period_time_interval = $period_time_interval - $params['time_interval'];
|
||||
}
|
||||
//drag the last value to paint the graph correctly
|
||||
$acum_array_data[]= array( 0 => $start_period, 1 => $acum_array_data[$i-1][1]);
|
||||
$array_data['sum1']['data'] = $acum_array_data;
|
||||
}
|
||||
|
||||
|
|
|
@ -1552,7 +1552,7 @@ function reporting_event_report_group($report, $content,
|
|||
function reporting_event_report_module($report, $content,
|
||||
$type = 'dinamic', $force_width_chart = null,
|
||||
$force_height_chart = null, $pdf=0) {
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
if($pdf){
|
||||
|
@ -1563,20 +1563,29 @@ function reporting_event_report_module($report, $content,
|
|||
}
|
||||
|
||||
$return['type'] = 'event_report_module';
|
||||
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('Event Report Module');
|
||||
}
|
||||
|
||||
|
||||
$id_server = false;
|
||||
if(is_metaconsole()){
|
||||
$id_server = metaconsole_get_id_server($content["server_name"]);
|
||||
metaconsole_connect(null, $id_server);
|
||||
}
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']) .
|
||||
" - " .
|
||||
io_safe_output(
|
||||
modules_get_agentmodule_name($content['id_agent_module']));
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']) . " - " .
|
||||
io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
|
||||
|
||||
if(is_metaconsole()){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$return["description"] = $content["description"];
|
||||
$return["date"] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
|
||||
$event_filter = $content['style'];
|
||||
$return['show_summary_group'] = $event_filter['show_summary_group'];
|
||||
//filter
|
||||
|
@ -1585,22 +1594,18 @@ function reporting_event_report_module($report, $content,
|
|||
$filter_event_type = json_decode($event_filter['filter_event_type'],true);
|
||||
$filter_event_status = json_decode($event_filter['filter_event_status'],true);
|
||||
$filter_event_filter_search = $event_filter['event_filter_search'];
|
||||
|
||||
|
||||
//graphs
|
||||
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
|
||||
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
|
||||
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
|
||||
|
||||
$id_server = false;
|
||||
if(is_metaconsole()){
|
||||
$id_server = metaconsole_get_id_server($content["server_name"]);
|
||||
}
|
||||
|
||||
//data events
|
||||
$data = reporting_get_module_detailed_event (
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"],
|
||||
$show_summary_group, $filter_event_severity, $filter_event_type,
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"],
|
||||
$show_summary_group, $filter_event_severity, $filter_event_type,
|
||||
$filter_event_status, $filter_event_filter_search, $force_width_chart,
|
||||
$event_graph_by_user_validator, $event_graph_by_criticity,
|
||||
$event_graph_by_user_validator, $event_graph_by_criticity,
|
||||
$event_graph_validated_vs_unvalidated, $ttl, $id_server);
|
||||
|
||||
if (empty($data)) {
|
||||
|
@ -1608,7 +1613,7 @@ function reporting_event_report_module($report, $content,
|
|||
}
|
||||
else {
|
||||
$return['data'] = array_reverse($data);
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
metaconsole_restore_db();
|
||||
|
@ -1621,7 +1626,7 @@ function reporting_event_report_module($report, $content,
|
|||
else{
|
||||
$return['total_events'] = 0;
|
||||
}
|
||||
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
@ -2865,14 +2870,27 @@ function reporting_alert_get_fired($id_agent_module, $id_alert_template_module,
|
|||
$id_alert_template_module,
|
||||
$period,
|
||||
$datetime);
|
||||
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$empty = '----------------------------';
|
||||
if (empty($firedTimes)) {
|
||||
$firedTimes = array();
|
||||
$firedTimes[0]['timestamp'] = null;
|
||||
$firedTimes[0]['timestamp'] = $empty;
|
||||
}
|
||||
|
||||
foreach ($firedTimes as $fireTime) {
|
||||
if($fireTime['utimestamp'] > $datelimit && $fireTime['utimestamp'] <= $datetime)
|
||||
$fired[] = $fireTime['timestamp'];
|
||||
else
|
||||
$fired[] = $empty;
|
||||
}
|
||||
|
||||
return $fired;
|
||||
|
@ -2955,6 +2973,16 @@ function reporting_alert_report_group($report, $content) {
|
|||
|
||||
foreach ($alerts as $template => $actions) {
|
||||
|
||||
$datetime = (int) $report["datetime"];
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
$period = (int) $content["period"];
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$data_action = array();
|
||||
$data_action['actions'] = array();
|
||||
|
||||
|
@ -2963,7 +2991,7 @@ function reporting_alert_report_group($report, $content) {
|
|||
foreach ($actions["custom"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -2976,7 +3004,7 @@ function reporting_alert_report_group($report, $content) {
|
|||
foreach ($actions["default"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -2989,7 +3017,7 @@ function reporting_alert_report_group($report, $content) {
|
|||
foreach ($actions["unavailable"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -3009,10 +3037,7 @@ function reporting_alert_report_group($report, $content) {
|
|||
(int) $report["datetime"]);
|
||||
$module_actions["actions"] = $data_action;
|
||||
|
||||
if ($module_actions["template_fired"][0] !== null)
|
||||
$data_row['alerts'][$ntemplates] = $module_actions;
|
||||
else
|
||||
$data_row = null;
|
||||
$ntemplates++;
|
||||
}
|
||||
|
||||
|
@ -3075,6 +3100,16 @@ function reporting_alert_report_agent($report, $content) {
|
|||
|
||||
foreach ($alerts as $template => $actions) {
|
||||
|
||||
$datetime = (int) $report["datetime"];
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
$period = (int) $content["period"];
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$data_action = array();
|
||||
$data_action['actions'] = array();
|
||||
|
||||
|
@ -3083,7 +3118,7 @@ function reporting_alert_report_agent($report, $content) {
|
|||
foreach ($actions["custom"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -3096,7 +3131,7 @@ function reporting_alert_report_agent($report, $content) {
|
|||
foreach ($actions["default"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -3109,7 +3144,7 @@ function reporting_alert_report_agent($report, $content) {
|
|||
foreach ($actions["unavailable"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -3129,10 +3164,7 @@ function reporting_alert_report_agent($report, $content) {
|
|||
(int) $report["datetime"]);
|
||||
$module_actions["actions"] = $data_action;
|
||||
|
||||
if ($module_actions["template_fired"][0] !== null)
|
||||
$data_row['alerts'][$ntemplates] = $module_actions;
|
||||
else
|
||||
$data_row = null;
|
||||
$ntemplates++;
|
||||
}
|
||||
|
||||
|
@ -3198,6 +3230,15 @@ function reporting_alert_report_module($report, $content) {
|
|||
$ntemplates = 0;
|
||||
|
||||
foreach ($alerts as $template => $actions) {
|
||||
$datetime = (int) $report["datetime"];
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
$period = (int) $content["period"];
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$data_action = array();
|
||||
$data_action['actions'] = array();
|
||||
|
@ -3207,7 +3248,7 @@ function reporting_alert_report_module($report, $content) {
|
|||
foreach ($actions["custom"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -3220,7 +3261,7 @@ function reporting_alert_report_module($report, $content) {
|
|||
foreach ($actions["default"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -3233,7 +3274,7 @@ function reporting_alert_report_module($report, $content) {
|
|||
foreach ($actions["unavailable"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
|
@ -3253,10 +3294,7 @@ function reporting_alert_report_module($report, $content) {
|
|||
(int) $report["datetime"]);
|
||||
$module_actions["actions"] = $data_action;
|
||||
|
||||
if ($module_actions["template_fired"][0] !== null)
|
||||
$data_row['alerts'][$ntemplates] = $module_actions;
|
||||
else
|
||||
$data_row = null;
|
||||
$ntemplates++;
|
||||
}
|
||||
|
||||
|
@ -3816,114 +3854,114 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
'type_graph' => $config['type_module_charts'],
|
||||
'time_interval' => $content['lapse'],
|
||||
'server_id' => $id_meta,
|
||||
'height' => $config['graph_image_height']
|
||||
'height' => $config['graph_image_height'],
|
||||
'fullscale' => true
|
||||
);
|
||||
|
||||
switch ($type) {
|
||||
case 'max':
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Maximum").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
}
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'max_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Maximum").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if ($i>$time_begin['utimestamp']) {
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
} else {
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
$value .= '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
$formated_value = $value;
|
||||
}
|
||||
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'max_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Maximum").'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if($i>$time_begin['utimestamp']){
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
}
|
||||
else{
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
$value .= '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$formated_value = $value;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
case 'min':
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_min(
|
||||
|
@ -4034,111 +4072,111 @@ function reporting_value($report, $content, $type,$pdf) {
|
|||
|
||||
break;
|
||||
case 'avg':
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Average").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
}
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'avg_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Average").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if($i>$time_begin['utimestamp']){
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
}
|
||||
else{
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'avg_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Average").'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if($i>$time_begin['utimestamp']){
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
}
|
||||
else{
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
$formated_value = $value;
|
||||
|
||||
$formated_value = $value;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'sum':
|
||||
$value = reporting_get_agentmodule_data_sum(
|
||||
|
|
|
@ -1960,6 +1960,12 @@ function reporting_html_alert_report($table, $item, $pdf = 0) {
|
|||
$table1->data = array ();
|
||||
$table1->rowspan = array();
|
||||
$table1->valign = array();
|
||||
|
||||
if ($item['data'] == null) {
|
||||
$table->data['alerts']['cell'] = ui_print_empty_data ( __('No alerts defined') , '', true) ;
|
||||
return true;
|
||||
}
|
||||
|
||||
$table1->head['agent'] = __('Agent');
|
||||
$table1->head['module'] = __('Module');
|
||||
$table1->head['template'] = __('Template');
|
||||
|
|
|
@ -700,7 +700,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$visual_maps = db_get_all_rows_filter("tlayout", "id != " . (int) $visualConsole_id, array("id", "name"));
|
||||
|
||||
$form_items_advance['map_linked_row']['html'] = '<td align="left">'
|
||||
. __('Linked map')
|
||||
. __('Linked visual console')
|
||||
. '</td>'
|
||||
. '<td align="left">';
|
||||
|
||||
|
@ -727,7 +727,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
return $arr;
|
||||
}, array());
|
||||
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select_from_sql(
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select(
|
||||
array(), 'map_linked', 0, 'onLinkedMapChange(event)', __('None'), 0, true
|
||||
);
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_input_hidden(
|
||||
|
@ -773,7 +773,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items_advance['map_linked_row']['html'] .= ob_get_clean();
|
||||
}
|
||||
else {
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select_from_sql(
|
||||
$visual_maps = array_reduce($visual_maps, function ($all, $item) {
|
||||
$all[$item["id"]] = $item["name"];
|
||||
return $all;
|
||||
}, array());
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select(
|
||||
$visual_maps, 'map_linked', 0, 'onLinkedMapChange(event)', __('None'), 0, true
|
||||
);
|
||||
}
|
||||
|
@ -790,7 +794,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos', 'donut_graph');
|
||||
$form_items_advance['linked_map_status_calculation_row']['html'] = '<td align="left">'.
|
||||
__('Type of the status calculation of the linked map') . '</td>'
|
||||
__('Type of the status calculation of the linked visual console') . '</td>'
|
||||
. '<td align="left">'
|
||||
. html_print_select(
|
||||
$status_type_select_items,
|
||||
|
@ -803,6 +807,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
false,
|
||||
false
|
||||
)
|
||||
. ui_print_help_icon("linked_map_status_calc", true)
|
||||
. '</td>';
|
||||
|
||||
$form_items_advance['map_linked_weight'] = array();
|
||||
|
@ -811,13 +816,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos', 'donut_graph');
|
||||
$form_items_advance['map_linked_weight']['html'] = '<td align="left">'
|
||||
. __('Linked map weight') . '</td>'
|
||||
. __('Linked visual console weight') . '</td>'
|
||||
. '<td align="left">'
|
||||
. html_print_input_text(
|
||||
'map_linked_weight', 80, '', 5, 5, true, false, false, "", "type_number percentage"
|
||||
)
|
||||
. '<span>%</span>'
|
||||
. ui_print_help_icon("linked_map_weight", true)
|
||||
. '</td>';
|
||||
|
||||
$form_items_advance['linked_map_status_service_critical_row'] = array();
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Include/help/es
|
||||
*/
|
||||
?>
|
||||
<h1>Ways to calculate the status of the linked visual console</h1>
|
||||
|
||||
<h3>By Default</h3>
|
||||
<p>
|
||||
It calculates the status based on the status of all elements, as an agent would do.
|
||||
</p>
|
||||
|
||||
<h3>By weight</h3>
|
||||
<p>
|
||||
It calculates the status of the elements that have a visual console, a module or an agent assigned in relation to a percentage of elements configured by the user. This percentage is the one that has to exceed the number of elements of a non-normal status with respect to the number of elements taken into account in the calculation for that status to change.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example, given an element with a percentage of 50% and a visual console linked with 5 elements:
|
||||
</p>
|
||||
<ul>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>normal</i> -> Status <i>normal</i>.</li>
|
||||
<li>2 <i>critical</i>, 2 <i>warning</i> y 1 <i>normal</i> -> Status <i>normal</i>.</li>
|
||||
<li>1 <i>critical</i>, 3 <i>warning</i> y 1 <i>normal</i> -> Status <i>warning</i>.</li>
|
||||
<li>3 <i>critical</i>, 1 <i>warning</i> y 1 <i>normal</i> -> Status <i>critical.</i></li>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>unknown</i> -> Status <i>unknown</i>.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
If several statuses exceed the weight, the priority is the same as in the rest of the status calculation (<i>critical</i> > <i>warning</i> > <i>unknown</i>). If there are no elements to perform the calculation, the status becomes <i>unknown</i>.
|
||||
</p>
|
||||
|
||||
<h3>By critical elements</h3>
|
||||
<p>
|
||||
It calculates the status using the elements in <i>critical</i> status and the percentages of the thresholds defined by the user. If the number of elements in <i>critical</i> status with respect to the number of elements taken into account in the calculation exceeds the percentage assigned as <i>warning</i>, the status becomes <i>warning</i>. The same applies to the percentage assigned as <i>critical</i>, which also has preference.
|
||||
</p>
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Include/help/es
|
||||
*/
|
||||
?>
|
||||
<h1>Formas de calcular el estado de la consola visual enlazada</h1>
|
||||
|
||||
<h3>Por defecto</h3>
|
||||
<p>
|
||||
Calcula el estado a partir del estado de todos los elementos, como lo haría un agente.
|
||||
</p>
|
||||
|
||||
<h3>Por peso</h3>
|
||||
<p>
|
||||
Calcula el estado de los elementos que tienen asignados una consola visual, un módulo o un agente en relación a un porcentaje de elementos configurado por el usuario. Este porcentaje es el que tiene que superar el número de elementos de un estado no normal respecto al número de elementos tenidos en cuenta en el cálculo para que el ese estado cambie.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Por ejemplo, dado un elemento con un porcentaje del 50% y una consola visual enlazada con 5 elementos:
|
||||
</p>
|
||||
<ul>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>normal</i> -> Estado <i>normal</i>.</li>
|
||||
<li>2 <i>critical</i>, 2 <i>warning</i> y 1 <i>normal</i> -> Estado <i>normal</i>.</li>
|
||||
<li>1 <i>critical</i>, 3 <i>warning</i> y 1 <i>normal</i> -> Estado <i>warning</i>.</li>
|
||||
<li>3 <i>critical</i>, 1 <i>warning</i> y 1 <i>normal</i> -> Estado <i>critical.</i></li>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>unknown</i> -> Estado <i>unknown</i>.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Si varios estados superan el peso, la prioridad es igual que en el resto de cálculo de estados (<i>critical</i> > <i>warning</i> > <i>unknown</i>). Si no hay elementos para realizar el cálculo, el estado pasa a ser <i>unknown</i>.
|
||||
</p>
|
||||
|
||||
<h3>Por elementos críticos</h3>
|
||||
<p>
|
||||
Calcula el estado usando los elementos en estado <i>critical</i> y los porcentajes de los umbrales definidos por el usuario. Si el número de los elementos en estado <i>critical</i> respecto al número de elementos tenidos en cuenta en el cálculo supera el porcentaje asignado como <i>warning</i>, el estado pasa a ser <i>warning</i>. Lo mismo para el porcentaje asignado como <i>critical</i>, que además tiene preferencia.
|
||||
</p>
|
|
@ -1585,6 +1585,10 @@ function display_confirm_dialog (message, ok_text, cancel_text, ok_function) {
|
|||
clean_function();
|
||||
}
|
||||
|
||||
var buttons_obj = {};
|
||||
buttons_obj[cancel_text] = clean_function;
|
||||
buttons_obj[ok_text] = ok_function_clean;
|
||||
|
||||
// Display the dialog
|
||||
$("body").append('<div id="pandora_confirm_dialog_text"><h3>' + message + '</h3></div>');
|
||||
$("#pandora_confirm_dialog_text").dialog({
|
||||
|
@ -1598,10 +1602,7 @@ function display_confirm_dialog (message, ok_text, cancel_text, ok_function) {
|
|||
},
|
||||
closeOnEscape: true,
|
||||
modal: true,
|
||||
buttons: {
|
||||
Cancel: clean_function,
|
||||
"Confirm": ok_function_clean
|
||||
}
|
||||
buttons: buttons_obj
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ var TreeController = {
|
|||
}
|
||||
|
||||
container.append($group);
|
||||
|
||||
|
||||
_.each(elements, function(element) {
|
||||
element.jqObject = _processNode($group, element);
|
||||
});
|
||||
|
@ -279,14 +279,13 @@ var TreeController = {
|
|||
|
||||
// Load leaf
|
||||
function _processNode (container, element) {
|
||||
|
||||
// type, [id], [serverID], callback
|
||||
function _getTreeDetailData (type, id, serverID, callback) {
|
||||
var lastParam = arguments[arguments.length - 1];
|
||||
var callback;
|
||||
if (typeof lastParam === 'function')
|
||||
callback = lastParam;
|
||||
|
||||
|
||||
var serverID;
|
||||
if (arguments.length >= 4)
|
||||
serverID = arguments[2];
|
||||
|
@ -296,23 +295,23 @@ var TreeController = {
|
|||
var type;
|
||||
if (arguments.length >= 2)
|
||||
type = arguments[0];
|
||||
|
||||
|
||||
if (typeof type === 'undefined')
|
||||
throw new TypeError('Type required');
|
||||
if (typeof callback === 'undefined')
|
||||
throw new TypeError('Callback required');
|
||||
|
||||
|
||||
var postData = {
|
||||
page: controller.ajaxPage,
|
||||
getDetail: 1,
|
||||
type: type
|
||||
}
|
||||
|
||||
|
||||
if (typeof id !== 'undefined')
|
||||
postData.id = id;
|
||||
if (typeof serverID !== 'undefined')
|
||||
postData.serverID = serverID;
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: 'POST',
|
||||
|
@ -346,6 +345,36 @@ var TreeController = {
|
|||
$content.append(element.iconHTML + " ");
|
||||
}
|
||||
$content.append(element.name);
|
||||
|
||||
if(typeof element.edit != 'undefined'){
|
||||
var url_edit = controller.baseURL + "index.php?sec=gagente&sec2=godmode/groups/configure_group&tab=tree&id_group=" + element.id;
|
||||
var $updateicon = $('<img src="' + (controller.baseURL.length > 0 ? controller.baseURL : '')+ 'images/config.png" style="width:18px; vertical-align: middle;"/>')
|
||||
var $updatebtn = $('<a href = "' + url_edit + '"></a>')
|
||||
.append($updateicon);
|
||||
$content.append($updatebtn);
|
||||
}
|
||||
|
||||
if(typeof element.delete != 'undefined'){
|
||||
var url_delete = controller.baseURL + "index.php?sec=gagente&sec2=godmode/groups/group_list&tab=tree&delete_group=1&id_group=" + element.id;
|
||||
var $deleteBtn = $('<a><img src="' + (controller.baseURL.length > 0 ? controller.baseURL : '') +'images/cross.png" style="width:18px; vertical-align: middle; cursor: pointer;"/></a>');
|
||||
$deleteBtn.click(function (event){
|
||||
var ok_function = function(){
|
||||
window.location.replace(url_delete);
|
||||
};
|
||||
display_confirm_dialog(
|
||||
element.delete.messages.messg,
|
||||
element.delete.messages.confirm,
|
||||
element.delete.messages.cancel,
|
||||
ok_function
|
||||
)
|
||||
});
|
||||
$content.append($deleteBtn);
|
||||
}
|
||||
|
||||
if(typeof element.alerts != 'undefined'){
|
||||
$content.append(element.alerts);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'agent':
|
||||
// Is quiet
|
||||
|
@ -583,95 +612,99 @@ var TreeController = {
|
|||
if (typeof(public_user) === 'undefined') public_user = 0;
|
||||
|
||||
if (typeof element.searchChildren != 'undefined' && element.searchChildren) {
|
||||
$node
|
||||
.removeClass("leaf-empty")
|
||||
.addClass("leaf-closed");
|
||||
if(element.rootType == "group_edition"
|
||||
&& typeof element.children == 'undefined'){
|
||||
$node.addClass("leaf-empty");
|
||||
}
|
||||
else{
|
||||
$node
|
||||
.removeClass("leaf-empty")
|
||||
.addClass("leaf-closed");
|
||||
$leafIcon.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$leafIcon.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!$node.hasClass("leaf-loading") && !$node.hasClass("children-loaded") && !$node.hasClass("leaf-empty")) {
|
||||
$node
|
||||
.removeClass("leaf-closed")
|
||||
.removeClass("leaf-error")
|
||||
.addClass("leaf-loading");
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: controller.ajaxPage,
|
||||
getChildren: 1,
|
||||
id: element.id,
|
||||
type: element.type,
|
||||
rootID: element.rootID,
|
||||
serverID: element.serverID,
|
||||
rootType: element.rootType,
|
||||
filter: controller.filter,
|
||||
hash: public_hash,
|
||||
id_user: public_user
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
$node.removeClass("leaf-loading");
|
||||
$node.addClass("children-loaded");
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
if (data.success) {
|
||||
var $group = $node.children("ul.tree-group");
|
||||
|
||||
if ((typeof data.tree != 'undefined' && data.tree.length > 0) || $group.length > 0) {
|
||||
$node.addClass("leaf-open");
|
||||
|
||||
if ($group.length <= 0) {
|
||||
$group = $("<ul></ul>");
|
||||
$group
|
||||
.addClass("tree-group")
|
||||
.hide();
|
||||
$node.append($group);
|
||||
}
|
||||
|
||||
_.each(data.tree, function(element) {
|
||||
element.jqObject = _processNode($group, element);
|
||||
});
|
||||
|
||||
$group.slideDown();
|
||||
|
||||
$node.data('children', $group);
|
||||
|
||||
// Add again the hover event to the 'force_callback' elements
|
||||
forced_title_callback();
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-empty");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (! $node.hasClass("leaf-empty")) {
|
||||
if ($node.hasClass("leaf-open")) {
|
||||
$node
|
||||
.removeClass("leaf-open")
|
||||
.addClass("leaf-closed")
|
||||
.data('children')
|
||||
.slideUp();
|
||||
}
|
||||
else {
|
||||
if (!$node.hasClass("leaf-loading") && !$node.hasClass("children-loaded") && !$node.hasClass("leaf-empty")) {
|
||||
$node
|
||||
.removeClass("leaf-closed")
|
||||
.addClass("leaf-open")
|
||||
.data('children')
|
||||
.slideDown();
|
||||
.removeClass("leaf-error")
|
||||
.addClass("leaf-loading");
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: controller.ajaxPage,
|
||||
getChildren: 1,
|
||||
id: element.id,
|
||||
type: element.type,
|
||||
rootID: element.rootID,
|
||||
serverID: element.serverID,
|
||||
rootType: element.rootType,
|
||||
filter: controller.filter,
|
||||
hash: public_hash,
|
||||
id_user: public_user
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
$node.removeClass("leaf-loading");
|
||||
$node.addClass("children-loaded");
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
if (data.success) {
|
||||
var $group = $node.children("ul.tree-group");
|
||||
if ((typeof data.tree != 'undefined' && data.tree.length > 0) || $group.length > 0) {
|
||||
$node.addClass("leaf-open");
|
||||
|
||||
if ($group.length <= 0) {
|
||||
$group = $("<ul></ul>");
|
||||
$group
|
||||
.addClass("tree-group")
|
||||
.hide();
|
||||
$node.append($group);
|
||||
}
|
||||
|
||||
_.each(data.tree, function(element) {
|
||||
element.jqObject = _processNode($group, element);
|
||||
});
|
||||
|
||||
$group.slideDown();
|
||||
|
||||
$node.data('children', $group);
|
||||
|
||||
// Add again the hover event to the 'force_callback' elements
|
||||
forced_title_callback();
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-empty");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
else if (! $node.hasClass("leaf-empty")) {
|
||||
if ($node.hasClass("leaf-open")) {
|
||||
$node
|
||||
.removeClass("leaf-open")
|
||||
.addClass("leaf-closed")
|
||||
.data('children')
|
||||
.slideUp();
|
||||
}
|
||||
else {
|
||||
$node
|
||||
.removeClass("leaf-closed")
|
||||
.addClass("leaf-open")
|
||||
.data('children')
|
||||
.slideDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return $node;
|
||||
|
|
|
@ -3709,6 +3709,57 @@ div.simple_value > a > span.text p
|
|||
color:white;
|
||||
}
|
||||
|
||||
.modaldeletebutton{
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
cursor:pointer;
|
||||
text-align:center;
|
||||
margin-left:45px;
|
||||
float:left;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
margin-bottom:30px;
|
||||
border-radius: 3px;width:90px;height:30px;background-color:white;border: 1px solid #FA5858;
|
||||
}
|
||||
|
||||
.modaldeletebuttontext{
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
color:#FA5858;font-family:Nunito;font-size:10pt;position:relative;top:6px;
|
||||
}
|
||||
|
||||
.modaldeletebutton:hover .modaldeletebuttontext {
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.modaldeletebutton:hover {
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
background-color:#FA5858;
|
||||
}
|
||||
|
||||
.modalgobutton{
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.727';
|
||||
$build = '180914';
|
||||
$build = '180919';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.727
|
||||
%define release 180914
|
||||
%define release 180919
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.727
|
||||
%define release 180914
|
||||
%define release 180919
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -775,6 +775,13 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
|
|||
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||
`snmp_enabled` tinyint(1) unsigned default '0',
|
||||
`vlan_enabled` tinyint(1) unsigned default '0',
|
||||
`snmp_version` varchar(5) NOT NULL default '1',
|
||||
`snmp_auth_user` varchar(255) NOT NULL default '',
|
||||
`snmp_auth_pass` varchar(255) NOT NULL default '',
|
||||
`snmp_auth_method` varchar(25) NOT NULL default '',
|
||||
`snmp_privacy_method` varchar(25) NOT NULL default '',
|
||||
`snmp_privacy_pass` varchar(255) NOT NULL default '',
|
||||
`snmp_security_level` varchar(25) NOT NULL default '',
|
||||
PRIMARY KEY (`id_rt`),
|
||||
KEY `recon_task_daemon` (`id_recon_server`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
@ -2365,6 +2372,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` (
|
|||
`username` varchar(100) default '',
|
||||
`password` varchar(100) default '',
|
||||
`pending_delete` tinyint(1) default '0',
|
||||
`custom_fields` MEDIUMBLOB NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_policy`) REFERENCES tpolicies(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
|
@ -3330,3 +3338,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
|||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -1260,3 +1260,10 @@ INSERT INTO `tprofile_view` (`id_profile`, `sec`, `sec2`, `sec3`) VALUES (5, '*'
|
|||
-- Dumping data for table `tcontainer`
|
||||
--
|
||||
INSERT INTO `tcontainer` SET `name` = 'Default graph container';
|
||||
|
||||
--
|
||||
-- Dumping data for table `tlog_graph_models`
|
||||
--
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.727-180914
|
||||
Version: 7.0NG.727-180919
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.727-180914"
|
||||
pandora_version="7.0NG.727-180919"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.727";
|
||||
my $pandora_build = "180914";
|
||||
my $pandora_build = "180919";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.727";
|
||||
my $pandora_build = "180914";
|
||||
my $pandora_build = "180919";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -96,6 +96,9 @@ sub new {
|
|||
# Working SNMP community for each device.
|
||||
community_cache => {},
|
||||
|
||||
# Cache of deviced discovered.
|
||||
dicovered_cache => {},
|
||||
|
||||
# Connections between devices.
|
||||
connections => {},
|
||||
|
||||
|
@ -147,8 +150,15 @@ sub new {
|
|||
recon_timing_template => 3,
|
||||
recon_ports => '',
|
||||
resolve_names => 0,
|
||||
snmp_auth_user => '',
|
||||
snmp_auth_pass => '',
|
||||
snmp_auth_method => '',
|
||||
snmp_checks => 2,
|
||||
snmp_privacy_method => '',
|
||||
snmp_privacy_pass => '',
|
||||
snmp_security_level => '',
|
||||
snmp_timeout => 2,
|
||||
snmp_version => 1,
|
||||
subnets => [],
|
||||
@_,
|
||||
|
||||
|
@ -157,8 +167,66 @@ sub new {
|
|||
# Perform some sanity checks.
|
||||
die("No subnet was specified.") unless defined($self->{'subnets'});
|
||||
|
||||
# Disable SNMP scans if no community was given.
|
||||
$self->{'snmp_enabled'} = 0 if (scalar(@{$self->{'communities'}}) == 0);
|
||||
# Check SNMP params id SNMP is enabled
|
||||
if ($self->{'snmp_enabled'}) {
|
||||
# Check SNMP version
|
||||
if ($self->{'snmp_version'} ne '1' && $self->{'snmp_version'} ne '2'
|
||||
&& $self->{'snmp_version'} ne '2c' && $self->{'snmp_version'} ne '3'
|
||||
) {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5);
|
||||
}
|
||||
|
||||
# Check the version 3 parameters
|
||||
if ($self->{'snmp_version'} eq '3') {
|
||||
# Fixed some vars
|
||||
$self->{'communities'} = [];
|
||||
|
||||
# SNMP v3 checks
|
||||
if (
|
||||
$self->{'snmp_security_level'} ne 'noAuthNoPriv' &&
|
||||
$self->{'snmp_security_level'} ne 'authNoPriv' &&
|
||||
$self->{'snmp_security_level'} ne 'authPriv'
|
||||
) {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "Invalid SNMP security level " . $self->{'snmp_security_level'} . ".", 5);
|
||||
}
|
||||
if ($self->{'snmp_privacy_method'} ne 'DES' && $self->{'snmp_privacy_method'} ne 'AES') {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "Invalid SNMP privacy method " . $self->{'snmp_privacy_method'} . ".", 5);
|
||||
}
|
||||
if ($self->{'snmp_auth_method'} ne 'MD5' && $self->{'snmp_auth_method'} ne 'SHA') {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "Invalid SNMP authentication method " . $self->{'snmp_auth_method'} . ".", 5);
|
||||
}
|
||||
} else {
|
||||
# Fixed some vars
|
||||
$self->{'snmp_auth_user'} = '';
|
||||
$self->{'snmp_auth_pass'} = '';
|
||||
$self->{'snmp_auth_method'} = '';
|
||||
$self->{'snmp_privacy_method'} = '';
|
||||
$self->{'snmp_privacy_pass'} = '';
|
||||
$self->{'snmp_security_level'} = '';
|
||||
|
||||
# Disable SNMP scans if no community was given.
|
||||
if (scalar(@{$self->{'communities'}}) == 0) {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "There is not any SNMP community configured.", 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Remove all snmp related values if disabled
|
||||
if (!$self->{'snmp_enabled'}) {
|
||||
$self->{'communities'} = [];
|
||||
$self->{'snmp_auth_user'} = '';
|
||||
$self->{'snmp_auth_pass'} = '';
|
||||
$self->{'snmp_auth_method'} = '';
|
||||
$self->{'snmp_privacy_method'} = '';
|
||||
$self->{'snmp_privacy_pass'} = '';
|
||||
$self->{'snmp_security_level'} = '';
|
||||
}
|
||||
|
||||
return bless($self, $class);
|
||||
}
|
||||
|
@ -199,7 +267,7 @@ sub aft_connectivity($$) {
|
|||
my ($self, $switch) = @_;
|
||||
my (%mac_temp, @aft_temp);
|
||||
|
||||
return unless defined($self->get_community($switch));
|
||||
return unless ($self->is_snmp_discovered($switch));
|
||||
|
||||
$self->enable_vlan_cache();
|
||||
|
||||
|
@ -397,8 +465,7 @@ sub find_ifaces($$) {
|
|||
my ($self, $device) = @_;
|
||||
|
||||
# Does it respond to SNMP?
|
||||
my $community = $self->get_community($device);
|
||||
return unless defined($community);
|
||||
return unless ($self->is_snmp_discovered($device));
|
||||
|
||||
my @output = $self->snmp_get_value_array($device, $PandoraFMS::Recon::Base::IFINDEX);
|
||||
foreach my $if_index (@output) {
|
||||
|
@ -476,11 +543,13 @@ sub get_device($$) {
|
|||
sub get_community($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
return '' if ($self->{'snmp_version'} eq "3");
|
||||
|
||||
if (defined($self->{'community_cache'}->{$device})) {
|
||||
return $self->{'community_cache'}->{$device};
|
||||
}
|
||||
|
||||
return undef;
|
||||
return '';
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
|
@ -787,6 +856,9 @@ sub get_visited_devices($) {
|
|||
sub get_vlans($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
# Disabled in verison 3
|
||||
return () if ($self->{'snmp_version'} eq "3");
|
||||
|
||||
# Is the VLAN cache disabled?
|
||||
return () unless ($self->{'__vlan_cache_enabled__'} == 1);
|
||||
|
||||
|
@ -945,6 +1017,17 @@ sub is_visited($$) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Returns 1 if the given device has responded successfully to a snmp request
|
||||
# Returns 0 otherwise.
|
||||
########################################################################################
|
||||
sub is_snmp_discovered($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
# Check if device is into discovered cache
|
||||
return (defined($self->{'discovered_cache'}->{$device})) ? 1 : 0;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Mark the given devices as connected to each other on the given interfaces.
|
||||
########################################################################################
|
||||
|
@ -999,23 +1082,46 @@ sub mark_visited($$) {
|
|||
}
|
||||
|
||||
########################################################################################
|
||||
# Looks for a working SNMP community for the given device. Returns 1 if one is
|
||||
# found, 0 otherwise. Updates the SNMP community cache.
|
||||
# Mark the given device as snmp discovered.
|
||||
########################################################################################
|
||||
sub mark_discovered($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
$self->{'discovered_cache'}->{$device} = 1;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Validate the configuration for the given device.
|
||||
# Returns 1 if successfull snmp contact, 0 otherwise.
|
||||
# Updates the SNMP community cache on v1, v2 and v2c.
|
||||
########################################################################################
|
||||
sub snmp_responds($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
# We already have a working SNMP community for this device.
|
||||
return 1 if (defined($self->get_community($device)));
|
||||
return 1 if($self->is_snmp_discovered($device));
|
||||
|
||||
return ($self->{'snmp_version'} eq "3")
|
||||
? $self->snmp_responds_v3($device)
|
||||
: $self->snmp_responds_v122c($device);
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Looks for a working SNMP community for the given device. Returns 1 if one is
|
||||
# found, 0 otherwise. Updates the SNMP community cache.
|
||||
########################################################################################
|
||||
sub snmp_responds_v122c($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
foreach my $community (@{$self->{'communities'}}) {
|
||||
|
||||
# Clean blanks.
|
||||
$community =~ s/\s+//g;
|
||||
|
||||
`snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v1 -On -Oe -c $community $device .0 2>/dev/null`;
|
||||
my $command = $self->snmp_get_command($device, ".0", $community);
|
||||
`$command`;
|
||||
if ($? == 0) {
|
||||
$self->set_community($device, $community);
|
||||
$self->mark_discovered($device);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1023,6 +1129,25 @@ sub snmp_responds($$) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
########################################################################################
|
||||
# Validate the SNMP v3 configuration for a device.
|
||||
# Returns 1 if successfull snmp contact, 0 otherwise.
|
||||
########################################################################################
|
||||
sub snmp_responds_v3($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
my $command = $self->snmp_get_command($device, ".0");
|
||||
`$command`;
|
||||
|
||||
if ($? == 0) {
|
||||
$self->mark_discovered($device);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Parse the local ARP cache.
|
||||
##############################################################################
|
||||
|
@ -1309,8 +1434,8 @@ sub snmp_get($$$) {
|
|||
my ($self, $device, $oid) = @_;
|
||||
my @output;
|
||||
|
||||
return () unless defined $self->is_snmp_discovered($device);
|
||||
my $community = $self->get_community($device);
|
||||
return () unless defined ($community);
|
||||
|
||||
# Check the SNMP query cache first.
|
||||
if (defined($self->{'snmp_cache'}->{"${device}_${oid}"})) {
|
||||
|
@ -1320,13 +1445,15 @@ sub snmp_get($$$) {
|
|||
# Check VLANS.
|
||||
my @vlans = $self->get_vlans($device);
|
||||
if (scalar(@vlans) == 0) {
|
||||
@output = `snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v1 -On -Oe -c $community $device $oid 2>/dev/null`;
|
||||
my $command = $self->snmp_get_command($device, $oid, $community);
|
||||
@output = `$command`;
|
||||
}
|
||||
else {
|
||||
# Handle duplicate lines.
|
||||
my %output_hash;
|
||||
foreach my $vlan (@vlans) {
|
||||
foreach my $line (`snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v1 -On -Oe -c $community\@$vlan $device $oid 2>/dev/null`) {
|
||||
my $command = $self->snmp_get_command($device, $oid, $community, $vlan);
|
||||
foreach my $line (`$vlan`) {
|
||||
$output_hash{$line} = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1339,6 +1466,30 @@ sub snmp_get($$$) {
|
|||
return @output;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Get the snmpwalk command seing version 1, 2, 2c or 3.
|
||||
########################################################################################
|
||||
sub snmp_get_command {
|
||||
my ($self, $device, $oid, $community, $vlan) = @_;
|
||||
$vlan = defined($vlan) ? "\@" . $vlan : '';
|
||||
|
||||
my $command = "snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v$self->{'snmp_version'} -On -Oe ";
|
||||
if ($self->{'snmp_version'} eq "3") {
|
||||
$command .= " -l$self->{'snmp_security_level'} ";
|
||||
if ($self->{'snmp_security_level'} ne "noAuthNoPriv") {
|
||||
$command .= " -u$self->{'snmp_auth_user'} -a$self->{'snmp_auth_method'} -A$self->{'snmp_auth_pass'} ";
|
||||
}
|
||||
if ($self->{'snmp_security_level'} eq "authPriv") {
|
||||
$command .= " -x$self->{'snmp_privacy_method'} -X$self->{'snmp_privacy_pass'} ";
|
||||
}
|
||||
} else {
|
||||
$command .= " -c$community$vlan ";
|
||||
}
|
||||
|
||||
return "$command $device $oid 2>/dev/null";
|
||||
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Performs an SNMP WALK and returns the value of the given OID. Returns undef
|
||||
# on error.
|
||||
|
|
|
@ -173,7 +173,16 @@ sub data_consumer ($$) {
|
|||
pa_config => $pa_config,
|
||||
recon_ports => $task->{'recon_ports'},
|
||||
resolve_names => $task->{'resolve_names'},
|
||||
snmp_auth_user => $task->{'snmp_auth_user'},
|
||||
snmp_auth_pass => $task->{'snmp_auth_pass'},
|
||||
snmp_auth_method => $task->{'snmp_auth_method'},
|
||||
snmp_checks => $task->{'snmp_checks'},
|
||||
snmp_enabled => $task->{'snmp_enabled'},
|
||||
snmp_privacy_method => $task->{'snmp_privacy_method'},
|
||||
snmp_privacy_pass => $task->{'snmp_privacy_pass'},
|
||||
snmp_security_level => $task->{'snmp_security_level'},
|
||||
snmp_timeout => $task->{'snmp_timeout'},
|
||||
snmp_version => $task->{'snmp_version'},
|
||||
subnets => \@subnets,
|
||||
task_id => $task->{'id_rt'},
|
||||
vlan_cache_enabled => $task->{'vlan_enabled'},
|
||||
|
@ -310,10 +319,17 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$$) {
|
|||
$self->call('message', "Network component ID " . $np_component->{'id_nc'} . " not found.", 5);
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
# Use snmp_community from network task instead the component snmp_community
|
||||
$component->{'snmp_community'} = safe_output($self->get_community($device));
|
||||
|
||||
$component->{'tcp_send'} = $self->{'snmp_version'};
|
||||
$component->{'custom_string_1'} = $self->{'snmp_privacy_method'};
|
||||
$component->{'custom_string_2'} = $self->{'snmp_privacy_pass'};
|
||||
$component->{'custom_string_3'} = $self->{'snmp_security_level'};
|
||||
$component->{'plugin_parameter'} = $self->{'snmp_auth_method'};
|
||||
$component->{'plugin_user'} = $self->{'snmp_auth_user'};
|
||||
$component->{'plugin_pass'} = $self->{'snmp_auth_pass'};
|
||||
|
||||
pandora_create_module_from_network_component($self->{'pa_config'}, $component, $agent_id, $self->{'dbh'});
|
||||
}
|
||||
}
|
||||
|
@ -466,8 +482,8 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
}
|
||||
|
||||
# Add interfaces to the agent if it responds to SNMP.
|
||||
return $agent_id unless ($self->is_snmp_discovered($device));
|
||||
my $community = $self->get_community($device);
|
||||
return $agent_id unless defined($community);
|
||||
|
||||
my @output = $self->snmp_get_value_array($device, $PandoraFMS::Recon::Base::IFINDEX);
|
||||
foreach my $if_index (@output) {
|
||||
|
@ -506,7 +522,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
'descripcion' => $if_desc,
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOPERSTATUS.$if_index"
|
||||
);
|
||||
|
@ -516,6 +538,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
'descripcion' => $if_desc,
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
|
@ -531,7 +561,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifInOctets.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCINOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
|
@ -539,6 +575,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
|
@ -553,7 +596,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFINOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
|
@ -561,6 +610,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
|
@ -577,7 +633,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifOutOctets.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCOUTOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
|
@ -585,6 +647,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
|
@ -599,7 +669,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOUTOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
|
@ -607,6 +683,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
|||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.727
|
||||
%define release 180914
|
||||
%define release 180919
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.727
|
||||
%define release 180914
|
||||
%define release 180919
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.727"
|
||||
PI_BUILD="180914"
|
||||
PI_BUILD="180919"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.727 PS180914";
|
||||
my $version = "7.0NG.727 PS180919";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.727 PS180914";
|
||||
my $version = "7.0NG.727 PS180919";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue