mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch 'develop' into 2290-seguridad-en-la-api
Conflicts: pandora_console/include/functions_api.php
This commit is contained in:
commit
2e1bb2ac9c
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.723-180601
|
Version: 7.0NG.723-180607
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.723-180601"
|
pandora_version="7.0NG.723-180607"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.723';
|
use constant AGENT_VERSION => '7.0NG.723';
|
||||||
use constant AGENT_BUILD => '180601';
|
use constant AGENT_BUILD => '180607';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.723
|
%define version 7.0NG.723
|
||||||
%define release 180601
|
%define release 180607
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.723
|
%define version 7.0NG.723
|
||||||
%define release 180601
|
%define release 180607
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.723"
|
PI_VERSION="7.0NG.723"
|
||||||
PI_BUILD="180601"
|
PI_BUILD="180607"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{180601}
|
{180607}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.723(Build 180601)")
|
#define PANDORA_VERSION ("7.0NG.723(Build 180607)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.723(Build 180601))"
|
VALUE "ProductVersion", "(7.0NG.723(Build 180607))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.723-180601
|
Version: 7.0NG.723-180607
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.723-180601"
|
pandora_version="7.0NG.723-180607"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -247,12 +247,10 @@ function output_xml_visual_console($id) {
|
|||||||
echo "<other_id>" . $item['id'] . "</other_id>\n"; //OLD ID USE FOR parent item
|
echo "<other_id>" . $item['id'] . "</other_id>\n"; //OLD ID USE FOR parent item
|
||||||
$agent = '';
|
$agent = '';
|
||||||
if ($item['id_agent'] != 0) {
|
if ($item['id_agent'] != 0) {
|
||||||
$agent = db_get_value ("alias","tagente","id_agente",$item['id_agent']);
|
$agent = db_get_value ("nombre","tagente","id_agente",$item['id_agent']);
|
||||||
}
|
}
|
||||||
if (!empty($item['label'])) {
|
if (!empty($item['label'])) {
|
||||||
$aux = explode("-",$item['label']);
|
echo "<label><![CDATA[" . io_safe_output($item['label']) . "]]></label>\n";
|
||||||
$label = $agent .' -'. $aux[1];
|
|
||||||
echo "<label><![CDATA[" . io_safe_output($label) . "]]></label>\n";
|
|
||||||
}
|
}
|
||||||
echo "<x>" . $item['pos_x'] . "</x>\n";
|
echo "<x>" . $item['pos_x'] . "</x>\n";
|
||||||
echo "<y>" . $item['pos_y'] . "</y>\n";
|
echo "<y>" . $item['pos_y'] . "</y>\n";
|
||||||
@ -273,7 +271,7 @@ function output_xml_visual_console($id) {
|
|||||||
if ($item['id_agente_modulo'] != 0) {
|
if ($item['id_agente_modulo'] != 0) {
|
||||||
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
|
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
|
||||||
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
|
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
|
||||||
$agent = db_get_value ("alias","tagente","id_agente",$id_agent);
|
$agent = db_get_value ("nombre","tagente","id_agente",$id_agent);
|
||||||
|
|
||||||
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
|
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
|
||||||
}
|
}
|
||||||
@ -287,6 +285,27 @@ function output_xml_visual_console($id) {
|
|||||||
if ($item['parent_item'] != 0) {
|
if ($item['parent_item'] != 0) {
|
||||||
echo "<parent_item>" . $item['parent_item'] . "</parent_item>\n";
|
echo "<parent_item>" . $item['parent_item'] . "</parent_item>\n";
|
||||||
}
|
}
|
||||||
|
if (!empty($item['clock_animation'])) {
|
||||||
|
echo "<clock_animation>" . $item['clock_animation'] . "</clock_animation>\n";
|
||||||
|
}
|
||||||
|
if (!empty($item['fill_color'])) {
|
||||||
|
echo "<fill_color>" . $item['fill_color'] . "</fill_color>\n";
|
||||||
|
}
|
||||||
|
if (!empty($item['type_graph'])) {
|
||||||
|
echo "<type_graph>" . $item['type_graph'] . "</type_graph>\n";
|
||||||
|
}
|
||||||
|
if (!empty($item['time_format'])) {
|
||||||
|
echo "<time_format>" . $item['time_format'] . "</time_format>\n";
|
||||||
|
}
|
||||||
|
if (!empty($item['timezone'])) {
|
||||||
|
echo "<timezone>" . $item['timezone'] . "</timezone>\n";
|
||||||
|
}
|
||||||
|
if (!empty($item['border_width'])) {
|
||||||
|
echo "<border_width>" . $item['border_width'] . "</border_width>\n";
|
||||||
|
}
|
||||||
|
if (!empty($item['border_color'])) {
|
||||||
|
echo "<border_color>" . $item['border_color'] . "</border_color>\n";
|
||||||
|
}
|
||||||
echo "</item>\n";
|
echo "</item>\n";
|
||||||
}
|
}
|
||||||
echo "</visual_map>\n";
|
echo "</visual_map>\n";
|
||||||
|
@ -455,13 +455,13 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
|
|||||||
$agents_in_item = array();
|
$agents_in_item = array();
|
||||||
foreach ($agents as $id => $agent) {
|
foreach ($agents as $id => $agent) {
|
||||||
if ($regular_expresion) {
|
if ($regular_expresion) {
|
||||||
if ((bool)preg_match("/" . $agent_clean . "/", io_safe_input($agent))) {
|
if ((bool)preg_match("/" . $agent_clean . "/", io_safe_output($agent))) {
|
||||||
$agents_in_item[$id]['name'] = $agent;
|
$agents_in_item[$id]['name'] = $agent;
|
||||||
$no_agents = false;
|
$no_agents = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($agent_clean == io_safe_input($agent)) {
|
if ($agent_clean == io_safe_output($agent)) {
|
||||||
$agents_in_item[$id]['name'] = $agent;
|
$agents_in_item[$id]['name'] = $agent;
|
||||||
$no_agents = false;
|
$no_agents = false;
|
||||||
break;
|
break;
|
||||||
@ -482,13 +482,13 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
|
|||||||
$modules_in_item = array();
|
$modules_in_item = array();
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
if ($regular_expresion) {
|
if ($regular_expresion) {
|
||||||
if ((bool)preg_match("/" . $module_clean . "/", io_safe_input($module['nombre']))) {
|
if ((bool)preg_match("/" . $module_clean . "/", io_safe_output($module['nombre']))) {
|
||||||
$modules_in_item[$module['id_agente_modulo']] = $module['nombre'];
|
$modules_in_item[$module['id_agente_modulo']] = $module['nombre'];
|
||||||
$no_modules = false;
|
$no_modules = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($module_clean == io_safe_input($module['nombre'])) {
|
if ($module_clean == io_safe_output($module['nombre'])) {
|
||||||
$modules_in_item[$module['id_agente_modulo']] = $module['nombre'];
|
$modules_in_item[$module['id_agente_modulo']] = $module['nombre'];
|
||||||
$no_modules = false;
|
$no_modules = false;
|
||||||
break;
|
break;
|
||||||
@ -528,6 +528,34 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
|
|||||||
if (isset($item->type))
|
if (isset($item->type))
|
||||||
$values['type'] = (string)$item->type;
|
$values['type'] = (string)$item->type;
|
||||||
|
|
||||||
|
if (isset($item->clock_animation)) {
|
||||||
|
$values['clock_animation'] = (string)$item->clock_animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($item->fill_color)) {
|
||||||
|
$values['fill_color'] = (string)$item->fill_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($item->type_graph)) {
|
||||||
|
$values['type_graph'] = (string)$item->type_graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($item->time_format)) {
|
||||||
|
$values['time_format'] = (string)$item->time_format;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($item->timezone)) {
|
||||||
|
$values['timezone'] = (string)$item->timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($item->border_width)) {
|
||||||
|
$values['border_width'] = (string)$item->border_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($item->border_color)) {
|
||||||
|
$values['border_color'] = (string)$item->border_color;
|
||||||
|
}
|
||||||
|
|
||||||
if ($no_agents) {
|
if ($no_agents) {
|
||||||
$id_item = db_process_sql_insert('tlayout_data', $values);
|
$id_item = db_process_sql_insert('tlayout_data', $values);
|
||||||
|
|
||||||
|
@ -119,6 +119,17 @@ $(document).ready( function() {
|
|||||||
$('div#menu')
|
$('div#menu')
|
||||||
.css('position', 'fixed')
|
.css('position', 'fixed')
|
||||||
.css('z-index', '9000')
|
.css('z-index', '9000')
|
||||||
|
.css('top','80px')
|
||||||
|
}else{
|
||||||
|
$('div#menu')
|
||||||
|
.css('z-index', '9000')
|
||||||
|
}
|
||||||
|
if (fixed_header) {
|
||||||
|
$('div#menu')
|
||||||
|
.css('position', 'fixed')
|
||||||
|
.css('z-index', '9000')
|
||||||
|
.css('top','80px')
|
||||||
|
$('#menu_tab_frame_view').css('margin-top','20px')
|
||||||
}
|
}
|
||||||
//Daniel maya 02/06/2016 Fixed menu position--END
|
//Daniel maya 02/06/2016 Fixed menu position--END
|
||||||
/*
|
/*
|
||||||
@ -244,6 +255,7 @@ $(document).ready( function() {
|
|||||||
openTimeMenu = new Date().getTime();
|
openTimeMenu = new Date().getTime();
|
||||||
$('#menu').css('width', '145px');
|
$('#menu').css('width', '145px');
|
||||||
$('#menu').css('position', 'block');
|
$('#menu').css('position', 'block');
|
||||||
|
$('div#menu').css('top', '80px');
|
||||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||||
$('ul.submenu').css('left', '144px');
|
$('ul.submenu').css('left', '144px');
|
||||||
|
|
||||||
|
@ -106,6 +106,7 @@ if (is_ajax ()) {
|
|||||||
$id_agent = get_parameter('id_agent');
|
$id_agent = get_parameter('id_agent');
|
||||||
$groups_to_add = get_parameter('groups');
|
$groups_to_add = get_parameter('groups');
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
|
if (empty($groups_to_add)) return 0;
|
||||||
enterprise_include('include/functions_agents.php');
|
enterprise_include('include/functions_agents.php');
|
||||||
$ret = enterprise_hook(
|
$ret = enterprise_hook(
|
||||||
'agents_update_secondary_groups',
|
'agents_update_secondary_groups',
|
||||||
|
@ -392,7 +392,7 @@ if ($id_agente) {
|
|||||||
|
|
||||||
$grouptab['active'] = false;
|
$grouptab['active'] = false;
|
||||||
|
|
||||||
$gistab = "";
|
$gistab = array();
|
||||||
|
|
||||||
/* GIS tab */
|
/* GIS tab */
|
||||||
if ($config['activate_gis']) {
|
if ($config['activate_gis']) {
|
||||||
@ -1265,7 +1265,6 @@ if ($update_module || $create_module) {
|
|||||||
if ($update_module) {
|
if ($update_module) {
|
||||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||||
|
|
||||||
|
|
||||||
$values = array (
|
$values = array (
|
||||||
'id_agente_modulo' => $id_agent_module,
|
'id_agente_modulo' => $id_agent_module,
|
||||||
'descripcion' => $description,
|
'descripcion' => $description,
|
||||||
@ -1896,10 +1895,81 @@ switch ($tab) {
|
|||||||
var wizard_tab_showed = 0;
|
var wizard_tab_showed = 0;
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
|
$('body').append('<div id="dialog"></div>');
|
||||||
// Control the tab and subtab hover. When mouse leave one,
|
// Control the tab and subtab hover. When mouse leave one,
|
||||||
// check if is hover the other before hide the subtab
|
// check if is hover the other before hide the subtab
|
||||||
$('.agent_wizard_tab').hover(agent_wizard_tab_show, agent_wizard_tab_hide);
|
$('.agent_wizard_tab').hover(agent_wizard_tab_show, agent_wizard_tab_hide);
|
||||||
|
|
||||||
|
$('#module_form').submit(function() {
|
||||||
|
|
||||||
|
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>';
|
||||||
|
|
||||||
|
if('<?php echo modules_get_agentmodule_name(get_parameter("id_agent_module")); ?>' != $('#text-name').val() &&
|
||||||
|
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>' == 19){
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
$("#dialog").dialog({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
height: 220,
|
||||||
|
width: 600,
|
||||||
|
title: 'Changing the module name of a satellite agent',
|
||||||
|
open: function(){
|
||||||
|
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br>The names of the modules of a satellite should not be <br> altered manually. Unless you are absolutely certain of <br> the process, do not alter these names.</p>');
|
||||||
|
},
|
||||||
|
buttons: [{
|
||||||
|
text: "Ok",
|
||||||
|
click: function() {
|
||||||
|
$('#module_form').submit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Cancel",
|
||||||
|
click: function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter("id_agent_module")); ?>';
|
||||||
|
|
||||||
|
if('<?php echo modules_get_agentmodule_name(get_parameter("id_agent_module")); ?>' != $('#text-name').val() && (
|
||||||
|
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
$("#dialog").dialog({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
height: 260,
|
||||||
|
width: 600,
|
||||||
|
title: 'Changing snmp module name',
|
||||||
|
open: function(){
|
||||||
|
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;margin-top:30px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br> If you change the name of this module, various features <br> associated with this module, such as network maps, <br> interface graphs or other network modules, may no longer <br> work. If you are not completely sure of the process, please <br> do not change the name of the module. </p>');
|
||||||
|
},
|
||||||
|
buttons: [{
|
||||||
|
text: "Ok",
|
||||||
|
click: function() {
|
||||||
|
$('#module_form').submit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Cancel",
|
||||||
|
click: function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the position and width of the subtab
|
// Set the position and width of the subtab
|
||||||
|
@ -109,6 +109,7 @@ if (is_ajax()) {
|
|||||||
'nombre' => $module_names
|
'nombre' => $module_names
|
||||||
);
|
);
|
||||||
$module_plugin_macros = db_get_all_rows_filter('tagente_modulo', $filter, $fields);
|
$module_plugin_macros = db_get_all_rows_filter('tagente_modulo', $filter, $fields);
|
||||||
|
$module_plugin_macros = io_safe_output($module_plugin_macros);
|
||||||
if (empty($module_plugin_macros)) $module_plugin_macros = array();
|
if (empty($module_plugin_macros)) $module_plugin_macros = array();
|
||||||
|
|
||||||
$module_plugin_macros = array_reduce($module_plugin_macros, function($carry, $item) {
|
$module_plugin_macros = array_reduce($module_plugin_macros, function($carry, $item) {
|
||||||
|
@ -116,10 +116,7 @@ if ($edit_graph) {
|
|||||||
echo ">";
|
echo ">";
|
||||||
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
$own_info = get_user_info ($config['id_user']);
|
||||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
$return_all_groups = $own_info['is_admin'] || users_can_manage_group_all("RR");
|
||||||
$return_all_groups = true;
|
|
||||||
else
|
|
||||||
$return_all_groups = false;
|
|
||||||
|
|
||||||
echo "<td><b>".__('Group')."</b></td><td>";
|
echo "<td><b>".__('Group')."</b></td><td>";
|
||||||
if (check_acl ($config['id_user'], 0, "RW"))
|
if (check_acl ($config['id_user'], 0, "RW"))
|
||||||
@ -170,7 +167,8 @@ $stackeds = array(
|
|||||||
CUSTOM_GRAPH_GAUGE => __('Gauge'),
|
CUSTOM_GRAPH_GAUGE => __('Gauge'),
|
||||||
CUSTOM_GRAPH_HBARS => __('Horizontal bars'),
|
CUSTOM_GRAPH_HBARS => __('Horizontal bars'),
|
||||||
CUSTOM_GRAPH_VBARS => __('Vertical bars'),
|
CUSTOM_GRAPH_VBARS => __('Vertical bars'),
|
||||||
CUSTOM_GRAPH_PIE => __('Pie')
|
CUSTOM_GRAPH_PIE => __('Pie'),
|
||||||
|
CUSTOM_GRAPH_THERMOMETER => __('Thermometer')
|
||||||
);
|
);
|
||||||
html_print_select ($stackeds, 'stacked', $stacked);
|
html_print_select ($stackeds, 'stacked', $stacked);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ check_login ();
|
|||||||
$report_r = check_acl ($config['id_user'], 0, "RR");
|
$report_r = check_acl ($config['id_user'], 0, "RR");
|
||||||
$report_w = check_acl ($config['id_user'], 0, "RW");
|
$report_w = check_acl ($config['id_user'], 0, "RW");
|
||||||
$report_m = check_acl ($config['id_user'], 0, "RM");
|
$report_m = check_acl ($config['id_user'], 0, "RM");
|
||||||
$access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
|
|
||||||
if (!$report_r && !$report_w && !$report_m) {
|
if (!$report_r && !$report_w && !$report_m) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
"Trying to access Inventory Module Management");
|
"Trying to access Inventory Module Management");
|
||||||
@ -31,6 +31,9 @@ if (!$report_r && !$report_w && !$report_m) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
|
||||||
|
$manage_group_all = users_can_manage_group_all($access);
|
||||||
|
|
||||||
$activeTab = get_parameter('tab', 'main');
|
$activeTab = get_parameter('tab', 'main');
|
||||||
|
|
||||||
$enterpriseEnable = false;
|
$enterpriseEnable = false;
|
||||||
@ -185,18 +188,19 @@ if (!empty ($graphs)) {
|
|||||||
$data[2] = $graph["graphs_count"];
|
$data[2] = $graph["graphs_count"];
|
||||||
$data[3] = ui_print_group_icon($graph['id_group'],true);
|
$data[3] = ui_print_group_icon($graph['id_group'],true);
|
||||||
|
|
||||||
if (($report_w || $report_m) && users_can_manage_group_all($access)) {
|
$data[4] = '';
|
||||||
|
if (($report_w || $report_m) && $manage_group_all) {
|
||||||
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.
|
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.
|
||||||
$graph['id_graph'].'">'.html_print_image("images/config.png", true).'</a>';
|
$graph['id_graph'].'">'.html_print_image("images/config.png", true).'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
$data[4] .= ' ';
|
$data[4] .= ' ';
|
||||||
|
|
||||||
|
if ($report_m && $manage_group_all) {
|
||||||
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='
|
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='
|
||||||
.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
|
.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
|
||||||
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>' .
|
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>' .
|
||||||
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
||||||
} else {
|
|
||||||
if($op_column) $data[4] = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
@ -930,9 +930,9 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||||||
$agents = agents_get_group_agents($group);
|
$agents = agents_get_group_agents($group);
|
||||||
if ((empty($agents)) || $agents == -1) $agents = array();
|
if ((empty($agents)) || $agents == -1) $agents = array();
|
||||||
|
|
||||||
$sql_log = 'SELECT source
|
$sql_log = 'SELECT source AS k, source AS v
|
||||||
FROM tagente,tagent_module_log
|
FROM tagente,tagent_module_log
|
||||||
WHERE tagente.id_agente = tagent_module_log.id_agent ';
|
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
|
||||||
|
|
||||||
if (!empty($agents)) {
|
if (!empty($agents)) {
|
||||||
$index = 0;
|
$index = 0;
|
||||||
@ -947,7 +947,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||||||
}
|
}
|
||||||
$sql_log .= ")";
|
$sql_log .= ")";
|
||||||
}
|
}
|
||||||
html_print_select_from_sql ($sql_log, 'source', $source, '', __('All'), '', false, false, false);
|
html_print_select_from_sql ($sql_log, 'source', $source, 'onselect=source_change_agents();', __('All'), '', false, false, false);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -1066,9 +1066,15 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||||||
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
|
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$sql_log_report = 'SELECT id_agente, alias
|
if ($source) {
|
||||||
FROM tagente, tagent_module_log
|
$sql_log_report = 'SELECT id_agente, alias
|
||||||
WHERE tagente.id_agente = tagent_module_log.id_agent';
|
FROM tagente, tagent_module_log
|
||||||
|
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0 AND tagent_module_log.source like "'. $source.'"';
|
||||||
|
} else {
|
||||||
|
$sql_log_report = 'SELECT id_agente, alias
|
||||||
|
FROM tagente, tagent_module_log
|
||||||
|
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
|
||||||
|
}
|
||||||
$all_agent_log = db_get_all_rows_sql($sql_log_report);
|
$all_agent_log = db_get_all_rows_sql($sql_log_report);
|
||||||
|
|
||||||
foreach ($all_agent_log as $key => $value) {
|
foreach ($all_agent_log as $key => $value) {
|
||||||
@ -1089,6 +1095,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
||||||
|
echo "<span id='spinner_hack' style='display:none;'>" . html_print_image('images/spinner.gif', true) . "</span>";
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -3522,4 +3529,22 @@ function set_last_value_period() {
|
|||||||
$("#row_period").show();
|
$("#row_period").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function source_change_agents() {
|
||||||
|
$("#id_agents2").empty();
|
||||||
|
$("#spinner_hack").show();
|
||||||
|
jQuery.post ("ajax.php",
|
||||||
|
{"page" : "operation/agentes/ver_agente",
|
||||||
|
"get_agents_source_json" : 1,
|
||||||
|
"source" : $("#source").val()
|
||||||
|
},
|
||||||
|
function (data, status) {
|
||||||
|
for (var clave in data) {
|
||||||
|
$("#id_agents2").append('<option value="'+clave+'">'+data[clave]+'</option>');
|
||||||
|
}
|
||||||
|
$("#spinner_hack").hide();
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -690,25 +690,18 @@ switch ($action) {
|
|||||||
|
|
||||||
switch ($type_access_selected) {
|
switch ($type_access_selected) {
|
||||||
case 'group_view':
|
case 'group_view':
|
||||||
$edit = check_acl($config['id_user'],
|
$edit = check_acl($config['id_user'], $report['id_group'], "RW");
|
||||||
$report['id_group'], "RW");
|
$delete =
|
||||||
|
$edit ||
|
||||||
if ($config['id_user'] == $report['id_user'] || is_user_admin ($config["id_user"])) {
|
is_user_admin ($config["id_user"]) ||
|
||||||
$delete = true; //owner can delete
|
$config['id_user'] == $report['id_user'];
|
||||||
} else {
|
|
||||||
$delete = false;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'group_edit':
|
case 'group_edit':
|
||||||
$edit = check_acl($config['id_user'],
|
$edit = check_acl($config['id_user'], $report['id_group_edit'], "RW");
|
||||||
$report['id_group_edit'], "RW");
|
$delete =
|
||||||
|
$edit ||
|
||||||
if ($config['id_user'] == $report['id_user'] || is_user_admin ($config["id_user"])) {
|
is_user_admin ($config["id_user"]) ||
|
||||||
$delete = true; //owner can delete
|
$config['id_user'] == $report['id_user'];
|
||||||
} else {
|
|
||||||
$delete = check_acl($config['id_user'],
|
|
||||||
$report['id_group'], "RM");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'user_edit':
|
case 'user_edit':
|
||||||
if ($config['id_user'] == $report['id_user'] ||
|
if ($config['id_user'] == $report['id_user'] ||
|
||||||
|
BIN
pandora_console/images/icono-warning-triangulo.png
Normal file
BIN
pandora_console/images/icono-warning-triangulo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
@ -22,7 +22,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC180601';
|
$build_version = 'PC180607';
|
||||||
$pandora_version = 'v7.0NG.723';
|
$pandora_version = 'v7.0NG.723';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -444,6 +444,7 @@ define("CUSTOM_GRAPH_LINE", 2);
|
|||||||
define("CUSTOM_GRAPH_STACKED_LINE", 3);
|
define("CUSTOM_GRAPH_STACKED_LINE", 3);
|
||||||
define("CUSTOM_GRAPH_BULLET_CHART", 4);
|
define("CUSTOM_GRAPH_BULLET_CHART", 4);
|
||||||
define("CUSTOM_GRAPH_GAUGE", 5);
|
define("CUSTOM_GRAPH_GAUGE", 5);
|
||||||
|
define("CUSTOM_GRAPH_THERMOMETER", 10);
|
||||||
define("CUSTOM_GRAPH_HBARS", 6);
|
define("CUSTOM_GRAPH_HBARS", 6);
|
||||||
define("CUSTOM_GRAPH_VBARS", 7);
|
define("CUSTOM_GRAPH_VBARS", 7);
|
||||||
define("CUSTOM_GRAPH_PIE", 8);
|
define("CUSTOM_GRAPH_PIE", 8);
|
||||||
|
@ -2434,7 +2434,7 @@ function clear_pandora_error_for_header() {
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$config["alert_cnt"] = 0;
|
$config["alert_cnt"] = 0;
|
||||||
$_SESSION["alert_msg"] = "";
|
$_SESSION["alert_msg"] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_pandora_error_for_header($message, $title = null) {
|
function set_pandora_error_for_header($message, $title = null) {
|
||||||
|
@ -83,9 +83,6 @@ function agents_create_agent ($name, $id_group, $interval, $ip_address, $values
|
|||||||
if (empty ($id_group) && (int)$id_group != 0)
|
if (empty ($id_group) && (int)$id_group != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (empty ($ip_address))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Check interval greater than zero
|
// Check interval greater than zero
|
||||||
if ($interval < 0)
|
if ($interval < 0)
|
||||||
$interval = false;
|
$interval = false;
|
||||||
@ -97,7 +94,10 @@ function agents_create_agent ($name, $id_group, $interval, $ip_address, $values
|
|||||||
$values['nombre'] = $name;
|
$values['nombre'] = $name;
|
||||||
$values['id_grupo'] = $id_group;
|
$values['id_grupo'] = $id_group;
|
||||||
$values['intervalo'] = $interval;
|
$values['intervalo'] = $interval;
|
||||||
$values['direccion'] = $ip_address;
|
|
||||||
|
if (!empty ($ip_address)){
|
||||||
|
$values['direccion'] = $ip_address;
|
||||||
|
}
|
||||||
|
|
||||||
$id_agent = db_process_sql_insert ('tagente', $values);
|
$id_agent = db_process_sql_insert ('tagente', $values);
|
||||||
if ($id_agent === false) {
|
if ($id_agent === false) {
|
||||||
@ -105,8 +105,9 @@ function agents_create_agent ($name, $id_group, $interval, $ip_address, $values
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create address for this agent in taddress
|
// Create address for this agent in taddress
|
||||||
agents_add_address ($id_agent, $ip_address);
|
if (!empty ($ip_address)){
|
||||||
|
agents_add_address ($id_agent, $ip_address);
|
||||||
|
}
|
||||||
|
|
||||||
db_pandora_audit ("Agent management", "New agent '$name' created");
|
db_pandora_audit ("Agent management", "New agent '$name' created");
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ enterprise_include_once ('include/functions_local_components.php');
|
|||||||
enterprise_include_once ('include/functions_events.php');
|
enterprise_include_once ('include/functions_events.php');
|
||||||
enterprise_include_once ('include/functions_agents.php');
|
enterprise_include_once ('include/functions_agents.php');
|
||||||
enterprise_include_once ('include/functions_modules.php');
|
enterprise_include_once ('include/functions_modules.php');
|
||||||
|
enterprise_include_once ('include/functions_clusters.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the "other" parameter.
|
* Parse the "other" parameter.
|
||||||
@ -884,7 +885,7 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) {
|
|||||||
*/
|
*/
|
||||||
function api_get_module_properties($id_module, $trahs2, $other, $returnType)
|
function api_get_module_properties($id_module, $trahs2, $other, $returnType)
|
||||||
{
|
{
|
||||||
if (!api_check_agent_and_print_error(modules_get_agentmodule($id_module), $returnType)) return;
|
if (!util_api_check_agent_and_print_error(modules_get_agentmodule($id_module), $returnType)) return;
|
||||||
|
|
||||||
if ($other['type'] == 'array') {
|
if ($other['type'] == 'array') {
|
||||||
$separator = $other['data'][0];
|
$separator = $other['data'][0];
|
||||||
@ -951,7 +952,7 @@ function api_get_module_properties_by_name($agent_name, $module_name, $other, $r
|
|||||||
returnError('error_get_module_properties_by_name', __('Does not exist agent with this name.'));
|
returnError('error_get_module_properties_by_name', __('Does not exist agent with this name.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!api_check_agent_and_print_error($agent_id, $returnType)) return;
|
if (!util_api_check_agent_and_print_error($agent_id, $returnType)) return;
|
||||||
|
|
||||||
$tagente_modulo = modules_get_agentmodule_id ($module_name, $agent_id);
|
$tagente_modulo = modules_get_agentmodule_id ($module_name, $agent_id);
|
||||||
if ($tagente_modulo === false) {
|
if ($tagente_modulo === false) {
|
||||||
@ -1013,7 +1014,7 @@ function api_get_module_properties_by_alias($alias, $module_name, $other, $retur
|
|||||||
if ($data === false) {
|
if ($data === false) {
|
||||||
returnError('error_get_module_properties_by_name', __('Does not exist the pair alias/module required.'));
|
returnError('error_get_module_properties_by_name', __('Does not exist the pair alias/module required.'));
|
||||||
}
|
}
|
||||||
if (!api_check_agent_and_print_error($data['id_agente'], $returnType)) return;
|
if (!util_api_check_agent_and_print_error($data['id_agente'], $returnType)) return;
|
||||||
|
|
||||||
$module_id = $data['id_agente_modulo'];
|
$module_id = $data['id_agente_modulo'];
|
||||||
|
|
||||||
@ -1674,7 +1675,7 @@ function api_get_agent_modules($thrash1, $thrash2, $other, $thrash3) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error($other['data'][0], 'csv')) return;
|
if (!util_api_check_agent_and_print_error($other['data'][0], 'csv')) return;
|
||||||
|
|
||||||
$sql = sprintf("SELECT id_agente, id_agente_modulo, nombre
|
$sql = sprintf("SELECT id_agente, id_agente_modulo, nombre
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
@ -2012,7 +2013,7 @@ function api_get_module_id($id , $thrash1 , $name, $thrash3) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error($id, 'csv')) return;
|
if (!util_api_check_agent_and_print_error($id, 'csv')) return;
|
||||||
|
|
||||||
$sql = sprintf('SELECT id_agente_modulo
|
$sql = sprintf('SELECT id_agente_modulo
|
||||||
FROM tagente_modulo WHERE id_agente = %d
|
FROM tagente_modulo WHERE id_agente = %d
|
||||||
@ -5863,7 +5864,7 @@ function api_get_module_from_conf($id_agent, $module_name, $thrash2, $thrash3) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error($id_agent, 'string')) return;
|
if (!util_api_check_agent_and_print_error($id_agent, 'string')) return;
|
||||||
|
|
||||||
$module_name = io_safe_output($module_name);
|
$module_name = io_safe_output($module_name);
|
||||||
$result = enterprise_hook('config_agents_get_module_from_conf',
|
$result = enterprise_hook('config_agents_get_module_from_conf',
|
||||||
@ -6626,7 +6627,7 @@ function api_get_module_data($id, $thrash1, $other, $returnType) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error(modules_get_agentmodule($id), $returnType)) return;
|
if (!util_api_check_agent_and_print_error(modules_get_agentmodule($id), $returnType)) return;
|
||||||
|
|
||||||
$separator = $other['data'][0];
|
$separator = $other['data'][0];
|
||||||
$periodSeconds = $other['data'][1];
|
$periodSeconds = $other['data'][1];
|
||||||
@ -6709,7 +6710,7 @@ function api_get_graph_module_data($id, $thrash1, $other, $thrash2) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error(modules_get_agentmodule($id), "string")) return;
|
if (!util_api_check_agent_and_print_error(modules_get_agentmodule($id), "string")) return;
|
||||||
|
|
||||||
$period = $other['data'][0];
|
$period = $other['data'][0];
|
||||||
$width = $other['data'][1];
|
$width = $other['data'][1];
|
||||||
@ -7730,7 +7731,7 @@ function api_get_gis_agent($id_agent, $trash1, $tresh2, $return_type, $user_in_d
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error($id_agent, $return_type)) return;
|
if (!util_api_check_agent_and_print_error($id_agent, $return_type)) return;
|
||||||
|
|
||||||
$agent_gis_data = db_get_row_sql("
|
$agent_gis_data = db_get_row_sql("
|
||||||
SELECT *
|
SELECT *
|
||||||
@ -8894,7 +8895,7 @@ function api_get_agent_name($id_agent, $trash1, $trash2, $returnType) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error($id_agent, $returnType)) return;
|
if (!util_api_check_agent_and_print_error($id_agent, $returnType)) return;
|
||||||
|
|
||||||
$sql = sprintf('SELECT nombre
|
$sql = sprintf('SELECT nombre
|
||||||
FROM tagente
|
FROM tagente
|
||||||
@ -8906,6 +8907,40 @@ function api_get_agent_name($id_agent, $trash1, $trash2, $returnType) {
|
|||||||
returnData($returnType, $data);
|
returnData($returnType, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ID or an hash of IDs of the detected given agents
|
||||||
|
*
|
||||||
|
* @param array or value $data
|
||||||
|
*
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
function api_get_agent_id($trash1, $trash2, $data, $returnType) {
|
||||||
|
$response;
|
||||||
|
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (empty($returnType)) {
|
||||||
|
$returnType = "json";
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = array();
|
||||||
|
|
||||||
|
if ($data["type"] == "array") {
|
||||||
|
$response["type"] = "array";
|
||||||
|
$response["data"] = array();
|
||||||
|
|
||||||
|
foreach ($data["data"] as $name) {
|
||||||
|
$response["data"][$name] = agents_get_agent_id($name, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$response["type"] = "string";
|
||||||
|
$response["data"] = agents_get_agent_id($data["data"], 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
returnData($returnType, $response);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agent alias for a given id
|
* Agent alias for a given id
|
||||||
*
|
*
|
||||||
@ -8918,7 +8953,7 @@ function api_get_agent_alias($id_agent, $trash1, $trash2, $returnType) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error($id_agent, $returnType)) return;
|
if (!util_api_check_agent_and_print_error($id_agent, $returnType)) return;
|
||||||
|
|
||||||
$sql = sprintf('SELECT alias
|
$sql = sprintf('SELECT alias
|
||||||
FROM tagente
|
FROM tagente
|
||||||
@ -8942,7 +8977,7 @@ function api_get_module_name($id_module, $trash1, $trash2, $returnType) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error(modules_get_agentmodule($id_module), $returnType)) return;
|
if (!util_api_check_agent_and_print_error(modules_get_agentmodule($id_module), $returnType)) return;
|
||||||
|
|
||||||
$sql = sprintf('SELECT nombre
|
$sql = sprintf('SELECT nombre
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
@ -9027,7 +9062,7 @@ function api_get_event_info($id_event, $trash1, $trash, $returnType) {
|
|||||||
}
|
}
|
||||||
// Check the access to agent
|
// Check the access to agent
|
||||||
if (!empty($event_data['id_agente']) && $event_data['id_agente'] > 0) {
|
if (!empty($event_data['id_agente']) && $event_data['id_agente'] > 0) {
|
||||||
if (!api_check_agent_and_print_error($event_data['id_agente'], $returnType)) return;
|
if (!util_api_check_agent_and_print_error($event_data['id_agente'], $returnType)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -10147,7 +10182,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!api_check_agent_and_print_error(modules_get_agentmodule($id_module), 'string')) return;
|
if (!util_api_check_agent_and_print_error(modules_get_agentmodule($id_module), 'string')) return;
|
||||||
|
|
||||||
$graph_seconds =
|
$graph_seconds =
|
||||||
(!empty($other) && isset($other['data'][0]))
|
(!empty($other) && isset($other['data'][0]))
|
||||||
@ -10342,7 +10377,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||||||
db_pandora_audit("Report management", "Fail try to create agent");
|
db_pandora_audit("Report management", "Fail try to create agent");
|
||||||
|
|
||||||
returnData('string',
|
returnData('string',
|
||||||
array('type' => 'string', 'data' => (int)((bool)$id_cluster)));
|
array('type' => 'string', 'data' => (int)$id_cluster));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10391,7 +10426,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||||||
//
|
//
|
||||||
if($element["type"] == "AA"){
|
if($element["type"] == "AA"){
|
||||||
//
|
//
|
||||||
$tcluster_module = db_process_sql_insert('tcluster_item',array('name'=>$element["name"],'id_cluster'=>$element["id_cluster"],'critical_limit'=>$element["critical_limit"],'warning_limit'=>$element["warning_limit"]));
|
$tcluster_module = db_process_sql_insert('tcluster_item',array('name'=>io_safe_input($element["name"]),'id_cluster'=>$element["id_cluster"],'critical_limit'=>$element["critical_limit"],'warning_limit'=>$element["warning_limit"]));
|
||||||
|
|
||||||
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element["id_cluster"]);
|
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element["id_cluster"]);
|
||||||
|
|
||||||
@ -10410,7 +10445,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||||||
$get_module_interval_value = $get_module_type[0]['module_interval'];
|
$get_module_interval_value = $get_module_type[0]['module_interval'];
|
||||||
|
|
||||||
$values_module = array(
|
$values_module = array(
|
||||||
'nombre' => $element["name"],
|
'nombre' => io_safe_input($element["name"]),
|
||||||
'id_modulo' => 0,
|
'id_modulo' => 0,
|
||||||
'prediction_module' => 6,
|
'prediction_module' => 6,
|
||||||
'id_agente' => $id_agent[0]['id_agent'],
|
'id_agente' => $id_agent[0]['id_agent'],
|
||||||
@ -10762,7 +10797,99 @@ function api_get_cluster_status($id_cluster, $trash1, $trash2, $returnType) {
|
|||||||
returnData($returnType, $data);
|
returnData($returnType, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function api_check_agent_and_print_error($id_agent, $returnType, $access = "AR") {
|
function api_get_cluster_id_by_name($cluster_name, $trash1, $trash2, $returnType) {
|
||||||
|
if (defined ('METACONSOLE')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cluster_name = io_safe_output($cluster_name);
|
||||||
|
|
||||||
|
$value = cluster_get_id_by_name($cluster_name);
|
||||||
|
|
||||||
|
if ($value === false) {
|
||||||
|
returnError('id_not_found', $returnType);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array('type' => 'string', 'data' => $value);
|
||||||
|
|
||||||
|
returnData($returnType, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function api_get_agents_id_name_by_cluster_id($cluster_id, $trash1, $trash2, $returnType) {
|
||||||
|
if (defined ('METACONSOLE')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$all_agents = cluster_get_agents_id_name_by_cluster_id($cluster_id);
|
||||||
|
|
||||||
|
if (count($all_agents) > 0 and $all_agents !== false) {
|
||||||
|
$data = array('type' => 'array', 'data' => $all_agents);
|
||||||
|
|
||||||
|
returnData('json', $data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnError('error_agents', 'No agents retrieved.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function api_get_agents_id_name_by_cluster_name($cluster_name, $trash1, $trash2, $returnType) {
|
||||||
|
if (defined ('METACONSOLE')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$all_agents = cluster_get_agents_id_name_by_cluster_name($cluster_name);
|
||||||
|
|
||||||
|
if (count($all_agents) > 0 and $all_agents !== false) {
|
||||||
|
$data = array('type' => 'array', 'data' => $all_agents);
|
||||||
|
|
||||||
|
returnData('json', $data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnError('error_agents', 'No agents retrieved.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function api_get_modules_id_name_by_cluster_id ($cluster_id){
|
||||||
|
if (defined ('METACONSOLE')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$all_modules = cluster_get_modules_id_name_by_cluster_id($cluster_id);
|
||||||
|
|
||||||
|
if (count($all_modules) > 0 and $all_modules !== false) {
|
||||||
|
$data = array('type' => 'array', 'data' => $all_modules);
|
||||||
|
|
||||||
|
returnData('json', $data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnError('error_agent_modules', 'No modules retrieved.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function api_get_modules_id_name_by_cluster_name ($cluster_name){
|
||||||
|
if (defined ('METACONSOLE')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$all_modules = cluster_get_modules_id_name_by_cluster_name($cluster_name);
|
||||||
|
|
||||||
|
if (count($all_modules) > 0 and $all_modules !== false) {
|
||||||
|
$data = array('type' => 'array', 'data' => $all_modules);
|
||||||
|
|
||||||
|
returnData('json', $data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
returnError('error_agent_modules', 'No modules retrieved.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
// AUX FUNCTIONS
|
||||||
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR") {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$check_agent = agents_check_access_agent($id_agent, $access);
|
$check_agent = agents_check_access_agent($id_agent, $access);
|
||||||
@ -10777,4 +10904,6 @@ function api_check_agent_and_print_error($id_agent, $returnType, $access = "AR")
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@ -1927,6 +1927,72 @@ function graphic_combined_module (
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CUSTOM_GRAPH_THERMOMETER:
|
||||||
|
$datelimit = $date - $period;
|
||||||
|
$i = 0;
|
||||||
|
foreach ($module_list as $module_item) {
|
||||||
|
$automatic_custom_graph_meta = false;
|
||||||
|
if ($config['metaconsole']) {
|
||||||
|
// Automatic custom graph from the report template in metaconsole
|
||||||
|
if (is_array($module_list[$i])) {
|
||||||
|
$server = metaconsole_get_connection_by_id ($module_item['server']);
|
||||||
|
metaconsole_connect($server);
|
||||||
|
$automatic_custom_graph_meta = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($automatic_custom_graph_meta)
|
||||||
|
$module = $module_item['module'];
|
||||||
|
else
|
||||||
|
$module = $module_item;
|
||||||
|
|
||||||
|
$temp[$module] = modules_get_agentmodule($module);
|
||||||
|
$query_last_value = sprintf('
|
||||||
|
SELECT datos
|
||||||
|
FROM tagente_datos
|
||||||
|
WHERE id_agente_modulo = %d
|
||||||
|
AND utimestamp < %d
|
||||||
|
ORDER BY utimestamp DESC',
|
||||||
|
$module, $date);
|
||||||
|
$temp_data = db_get_value_sql($query_last_value);
|
||||||
|
if ( $temp_data ) {
|
||||||
|
if (is_numeric($temp_data))
|
||||||
|
$value = $temp_data;
|
||||||
|
else
|
||||||
|
$value = count($value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$value = false;
|
||||||
|
}
|
||||||
|
$temp[$module]['label'] = ($labels[$module] != '') ? $labels[$module] : $temp[$module]['nombre'];
|
||||||
|
|
||||||
|
$temp[$module]['value'] = $value;
|
||||||
|
$temp[$module]['label'] = ui_print_truncate_text($temp[$module]['label'],"module_small",false,true,false,"..");
|
||||||
|
|
||||||
|
if ($temp[$module]['unit'] == '%') {
|
||||||
|
$temp[$module]['min'] = 0;
|
||||||
|
$temp[$module]['max'] = 100;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$min = $temp[$module]['min'];
|
||||||
|
if ($temp[$module]['max'] == 0)
|
||||||
|
$max = reporting_get_agentmodule_data_max($module,$period,$date);
|
||||||
|
else
|
||||||
|
$max = $temp[$module]['max'];
|
||||||
|
$temp[$module]['min'] = ($min == 0 ) ? 0 : $min;
|
||||||
|
$temp[$module]['max'] = ($max == 0 ) ? 100 : $max;
|
||||||
|
}
|
||||||
|
$temp[$module]['gauge'] = uniqid('gauge_');
|
||||||
|
|
||||||
|
if ($config['metaconsole']) {
|
||||||
|
// Automatic custom graph from the report template in metaconsole
|
||||||
|
if (is_array($module_list[0])) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (!is_null($percentil) && $percentil) {
|
if (!is_null($percentil) && $percentil) {
|
||||||
foreach ($graph_values as $graph_group => $point) {
|
foreach ($graph_values as $graph_group => $point) {
|
||||||
@ -2403,6 +2469,13 @@ function graphic_combined_module (
|
|||||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||||
"", $ttl, $homeurl, $background_color);
|
"", $ttl, $homeurl, $background_color);
|
||||||
break;
|
break;
|
||||||
|
case CUSTOM_GRAPH_THERMOMETER:
|
||||||
|
return stacked_thermometers($flash_charts, $graph_values,
|
||||||
|
$width, $height, $color, $module_name_list, $long_index,
|
||||||
|
ui_get_full_url("images/image_problem_area_small.png", false, false, false),
|
||||||
|
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||||
|
"", $ttl, $homeurl, $background_color);
|
||||||
|
break;
|
||||||
case CUSTOM_GRAPH_HBARS:
|
case CUSTOM_GRAPH_HBARS:
|
||||||
return hbar_graph($flash_charts, $graph_values,
|
return hbar_graph($flash_charts, $graph_values,
|
||||||
$width, $height, $color, $module_name_list, $long_index,
|
$width, $height, $color, $module_name_list, $long_index,
|
||||||
|
@ -393,10 +393,8 @@ function groupview_monitor_alerts ($group_array, $strict_user = false, $id_group
|
|||||||
function groupview_monitor_fired_alerts ($group_array, $strict_user = false, $id_group_strict = false) {
|
function groupview_monitor_fired_alerts ($group_array, $strict_user = false, $id_group_strict = false) {
|
||||||
|
|
||||||
// If there are not groups to query, we jump to nextone
|
// If there are not groups to query, we jump to nextone
|
||||||
|
|
||||||
if (empty ($group_array)) {
|
if (empty ($group_array)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!is_array ($group_array)) {
|
else if (!is_array ($group_array)) {
|
||||||
$group_array = array($group_array);
|
$group_array = array($group_array);
|
||||||
@ -405,30 +403,12 @@ function groupview_monitor_fired_alerts ($group_array, $strict_user = false, $id
|
|||||||
$group_clause = implode (",", $group_array);
|
$group_clause = implode (",", $group_array);
|
||||||
$group_clause = "(" . $group_clause . ")";
|
$group_clause = "(" . $group_clause . ")";
|
||||||
|
|
||||||
|
return db_get_sql ("SELECT COUNT(talert_template_modules.id)
|
||||||
if ($strict_user) {
|
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
|
||||||
$group_clause_strict = implode (",", $id_group_strict);
|
WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente
|
||||||
$group_clause_strict = "(" . $group_clause_strict . ")";
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
if ($group_clause_strict !== '()'){
|
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
||||||
$sql = "SELECT COUNT(talert_template_modules.id)
|
AND times_fired > 0");
|
||||||
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
|
|
||||||
WHERE tagente.id_grupo IN $group_clause_strict AND tagente_modulo.id_agente = tagente.id_agente
|
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
|
||||||
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
|
||||||
AND times_fired > 0 ";
|
|
||||||
}
|
|
||||||
$count = db_get_sql ($sql);
|
|
||||||
return $count;
|
|
||||||
} else {
|
|
||||||
//TODO REVIEW ORACLE AND POSTGRES
|
|
||||||
return db_get_sql ("SELECT COUNT(talert_template_modules.id)
|
|
||||||
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
|
|
||||||
WHERE tagente.id_grupo IN $group_clause AND tagente_modulo.id_agente = tagente.id_agente
|
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
|
||||||
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
|
||||||
AND times_fired > 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupview_get_groups_list($id_user = false, $user_strict = false, $access = 'AR', $force_group_and_tag = true, $returnAllGroup = false) {
|
function groupview_get_groups_list($id_user = false, $user_strict = false, $access = 'AR', $force_group_and_tag = true, $returnAllGroup = false) {
|
||||||
@ -630,150 +610,9 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||||||
$list_groups = array();
|
$list_groups = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_metaconsole()) { // Agent cache
|
if (is_metaconsole() || ($config["realtimestats"] == 0)) { // Agent cache
|
||||||
foreach ($list_groups as $group) {
|
$list = group_view_get_cache_stats ($list, $list_groups, $user_groups_ids);
|
||||||
// If id group is 0 get all accesses groups
|
} else {
|
||||||
$group_id = $group['id_grupo'] == 0
|
|
||||||
? $user_groups_ids
|
|
||||||
: $group['id_grupo'];
|
|
||||||
$group_agents = db_get_row_sql("SELECT SUM(warning_count) AS _monitors_warning_,
|
|
||||||
SUM(critical_count) AS _monitors_critical_,
|
|
||||||
SUM(normal_count) AS _monitors_ok_,
|
|
||||||
SUM(unknown_count) AS _monitors_unknown_,
|
|
||||||
SUM(notinit_count) AS _monitors_not_init_,
|
|
||||||
SUM(fired_count) AS _monitors_alerts_fired_,
|
|
||||||
COUNT(*) AS _total_agents_, id_grupo, intervalo,
|
|
||||||
ultimo_contacto, disabled
|
|
||||||
FROM tmetaconsole_agent ta
|
|
||||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
|
||||||
ON tasg.id_agent = ta.id_agente
|
|
||||||
WHERE (
|
|
||||||
ta.id_grupo IN (" . $group_id . ")
|
|
||||||
OR tasg.id_group IN (" . $group_id . ")
|
|
||||||
)
|
|
||||||
AND disabled = 0");
|
|
||||||
|
|
||||||
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$group_agents['_monitors_critical_'];
|
|
||||||
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$group_agents['_monitors_warning_'];
|
|
||||||
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$group_agents['_monitors_unknown_'];
|
|
||||||
$list[$group['id_grupo']]['_monitors_not_init_'] = (int)$group_agents['_monitors_not_init_'];
|
|
||||||
$list[$group['id_grupo']]['_monitors_ok_'] = (int)$group_agents['_monitors_ok_'];
|
|
||||||
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = (int)$group_agents['_monitors_alerts_fired_'];
|
|
||||||
$list[$group['id_grupo']]['_total_agents_'] = (int)$group_agents['_total_agents_'];
|
|
||||||
$list[$group['id_grupo']]["_monitor_checks_"] = $list[$group['id_grupo']]["_monitors_not_init_"]
|
|
||||||
+ $list[$group['id_grupo']]["_monitors_unknown_"]
|
|
||||||
+ $list[$group['id_grupo']]["_monitors_warning_"]
|
|
||||||
+ $list[$group['id_grupo']]["_monitors_critical_"]
|
|
||||||
+ $list[$group['id_grupo']]["_monitors_ok_"];
|
|
||||||
|
|
||||||
if ($group['icon'])
|
|
||||||
$list[$group['id_grupo']]["_iconImg_"] = html_print_image ("images/".$group['icon'].".png", true, array ("style" => 'vertical-align: middle;'));
|
|
||||||
|
|
||||||
// Calculate not_normal monitors
|
|
||||||
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list["_monitor_checks_"] - $list["_monitors_ok_"];
|
|
||||||
|
|
||||||
$total_agents = $list[$group['id_grupo']]['_total_agents_'];
|
|
||||||
|
|
||||||
if ($total_agents > 0) {
|
|
||||||
$agents = db_get_all_rows_sql(sprintf ("SELECT warning_count,
|
|
||||||
critical_count,
|
|
||||||
normal_count,
|
|
||||||
unknown_count,
|
|
||||||
notinit_count,
|
|
||||||
fired_count,
|
|
||||||
disabled
|
|
||||||
FROM tmetaconsole_agent ta
|
|
||||||
LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
|
||||||
ON ta.id_agente = tasg.id_agent
|
|
||||||
WHERE ta.id_grupo IN (%s) OR tasg.id_group IN (%s)",
|
|
||||||
$group_id, $group_id));
|
|
||||||
foreach ($agents as $agent) {
|
|
||||||
if ($agent['critical_count'] > 0) {
|
|
||||||
$list[$group['id_grupo']]['_agents_critical_'] += 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (($agent['critical_count'] == 0) && ($agent['warning_count'] == 0) && ($group_agents['disabled'] == 0) && ($agent['normal_count'] == 0)) {
|
|
||||||
if ($agent['unknown_count'] > 0) {
|
|
||||||
$list[$group['id_grupo']]['_agents_unknown_'] += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (($agent['critical_count'] == 0) && ($agent['warning_count'] == 0) && ($group_agents['disabled'] == 0) && ($agent['normal_count'] == 0) && ($agent['unknown_count'] == 0)) {
|
|
||||||
if ($agent['notinit_count'] > 0) {
|
|
||||||
$list[$group['id_grupo']]['_agents_not_init_'] += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (false) { //FIXME: The cached group view is wasted. Avoid to reach this code.
|
|
||||||
|
|
||||||
$group_stat = db_get_all_rows_sql ("SELECT
|
|
||||||
SUM(ta.normal_count) as normal, SUM(ta.critical_count) as critical,
|
|
||||||
SUM(ta.warning_count) as warning,SUM(ta.unknown_count) as unknown,
|
|
||||||
SUM(ta.notinit_count) as not_init, SUM(fired_count) as alerts_fired
|
|
||||||
FROM tagente ta
|
|
||||||
WHERE id_grupo IN ($user_groups_ids)");
|
|
||||||
|
|
||||||
$list['_agents_unknown_'] = $group_stat[0]["unknown"];
|
|
||||||
$list['_monitors_alerts_fired_'] = $group_stat[0]["alerts_fired"];
|
|
||||||
|
|
||||||
$list['_monitors_ok_'] = $group_stat[0]["normal"];
|
|
||||||
$list['_monitors_warning_'] = $group_stat[0]["warning"];
|
|
||||||
$list['_monitors_critical_'] = $group_stat[0]["critical"];
|
|
||||||
$list['_monitors_unknown_'] = $group_stat[0]["unknown"];
|
|
||||||
$list['_monitors_not_init_'] = $group_stat[0]["not_init"];
|
|
||||||
$total_agentes = agents_get_agents (false, array('count(*) as total_agents'), $access,false, false);
|
|
||||||
$list['_total_agents_'] = $total_agentes[0]['total_agents'];
|
|
||||||
$list["_monitor_alerts_fire_count_"] = $group_stat[0]["alerts_fired"];
|
|
||||||
|
|
||||||
$list['_monitors_alerts_'] = groupview_monitor_alerts (explode(',',$user_groups_ids), $user_strict,explode(',',$user_groups_ids));
|
|
||||||
// Get total count of monitors for this group, except disabled.
|
|
||||||
$list["_monitor_checks_"] = $list["_monitors_not_init_"] + $list["_monitors_unknown_"] + $list["_monitors_warning_"] + $list["_monitors_critical_"] + $list["_monitors_ok_"];
|
|
||||||
|
|
||||||
// Calculate not_normal monitors
|
|
||||||
$list["_monitor_not_normal_"] = $list["_monitor_checks_"] - $list["_monitors_ok_"];
|
|
||||||
|
|
||||||
if ($list["_monitor_not_normal_"] > 0 && $list["_monitor_checks_"] > 0) {
|
|
||||||
$list["_monitor_health_"] = format_numeric (100 - ($list["_monitor_not_normal_"] / ($list["_monitor_checks_"] / 100)), 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$list["_monitor_health_"] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($list["_monitors_not_init_"] > 0 && $list["_monitor_checks_"] > 0) {
|
|
||||||
$list["_module_sanity_"] = format_numeric (100 - ($list["_monitors_not_init_"] / ($list["_monitor_checks_"] / 100)), 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$list["_module_sanity_"] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($list["_alerts_"])) {
|
|
||||||
if ($list["_monitors_alerts_fired_"] > 0 && $list["_alerts_"] > 0) {
|
|
||||||
$list["_alert_level_"] = format_numeric (100 - ($list["_monitors_alerts_fired_"] / ($list["_alerts_"] / 100)), 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$list["_alert_level_"] = 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$list["_alert_level_"] = 100;
|
|
||||||
$list["_alerts_"] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$list["_monitor_bad_"] = $list["_monitors_critical_"] + $list["_monitors_warning_"];
|
|
||||||
|
|
||||||
if ($list["_monitor_bad_"] > 0 && $list["_monitor_checks_"] > 0) {
|
|
||||||
$list["_global_health_"] = format_numeric (100 - ($list["_monitor_bad_"] / ($list["_monitor_checks_"] / 100)), 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$list["_global_health_"] = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
foreach ($list_groups as $group) {
|
foreach ($list_groups as $group) {
|
||||||
// If id group is 0 get all accesses groups
|
// If id group is 0 get all accesses groups
|
||||||
$group_id = $group['id_grupo'] == 0
|
$group_id = $group['id_grupo'] == 0
|
||||||
@ -954,4 +793,100 @@ function groupview_array_unique_multidim($groups, $key){
|
|||||||
return $temp_group;
|
return $temp_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the stats to group view using the cache
|
||||||
|
*
|
||||||
|
* @param array Skeleton to fill with the group information
|
||||||
|
* @param array Groups information
|
||||||
|
* @param string Groups that user has access separated by commas
|
||||||
|
*/
|
||||||
|
function group_view_get_cache_stats ($list, $list_groups, $user_groups_ids) {
|
||||||
|
|
||||||
|
$table_agent = 'tagente';
|
||||||
|
$table_secondary = 'tagent_secondary_group';
|
||||||
|
// Change the metaconsole tables
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$table_agent = 'tmetaconsole_agent';
|
||||||
|
$table_secondary = 'tmetaconsole_agent_secondary_group';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Walk for each group
|
||||||
|
foreach ($list_groups as $group) {
|
||||||
|
// If id group is 0 get all accesses groups
|
||||||
|
$group_id = $group['id_grupo'] == 0
|
||||||
|
? $user_groups_ids
|
||||||
|
: $group['id_grupo'];
|
||||||
|
$group_agents = db_get_row_sql("SELECT SUM(warning_count) AS _monitors_warning_,
|
||||||
|
SUM(critical_count) AS _monitors_critical_,
|
||||||
|
SUM(normal_count) AS _monitors_ok_,
|
||||||
|
SUM(unknown_count) AS _monitors_unknown_,
|
||||||
|
SUM(notinit_count) AS _monitors_not_init_,
|
||||||
|
SUM(fired_count) AS _monitors_alerts_fired_,
|
||||||
|
COUNT(*) AS _total_agents_, id_grupo, intervalo,
|
||||||
|
ultimo_contacto, disabled
|
||||||
|
FROM $table_agent ta
|
||||||
|
LEFT JOIN $table_secondary tasg
|
||||||
|
ON tasg.id_agent = ta.id_agente
|
||||||
|
WHERE (
|
||||||
|
ta.id_grupo IN (" . $group_id . ")
|
||||||
|
OR tasg.id_group IN (" . $group_id . ")
|
||||||
|
)
|
||||||
|
AND disabled = 0");
|
||||||
|
|
||||||
|
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$group_agents['_monitors_critical_'];
|
||||||
|
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$group_agents['_monitors_warning_'];
|
||||||
|
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$group_agents['_monitors_unknown_'];
|
||||||
|
$list[$group['id_grupo']]['_monitors_not_init_'] = (int)$group_agents['_monitors_not_init_'];
|
||||||
|
$list[$group['id_grupo']]['_monitors_ok_'] = (int)$group_agents['_monitors_ok_'];
|
||||||
|
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = (int)$group_agents['_monitors_alerts_fired_'];
|
||||||
|
$list[$group['id_grupo']]['_total_agents_'] = (int)$group_agents['_total_agents_'];
|
||||||
|
$list[$group['id_grupo']]["_monitor_checks_"] = $list[$group['id_grupo']]["_monitors_not_init_"]
|
||||||
|
+ $list[$group['id_grupo']]["_monitors_unknown_"]
|
||||||
|
+ $list[$group['id_grupo']]["_monitors_warning_"]
|
||||||
|
+ $list[$group['id_grupo']]["_monitors_critical_"]
|
||||||
|
+ $list[$group['id_grupo']]["_monitors_ok_"];
|
||||||
|
|
||||||
|
if ($group['icon'])
|
||||||
|
$list[$group['id_grupo']]["_iconImg_"] = html_print_image ("images/".$group['icon'].".png", true, array ("style" => 'vertical-align: middle;'));
|
||||||
|
|
||||||
|
// Calculate not_normal monitors
|
||||||
|
$list[$group['id_grupo']]["_monitor_not_normal_"] = $list["_monitor_checks_"] - $list["_monitors_ok_"];
|
||||||
|
|
||||||
|
$total_agents = $list[$group['id_grupo']]['_total_agents_'];
|
||||||
|
|
||||||
|
if ($total_agents > 0) {
|
||||||
|
$agents = db_get_all_rows_sql(sprintf ("SELECT warning_count,
|
||||||
|
critical_count,
|
||||||
|
normal_count,
|
||||||
|
unknown_count,
|
||||||
|
notinit_count,
|
||||||
|
fired_count,
|
||||||
|
disabled
|
||||||
|
FROM $table_agent ta
|
||||||
|
LEFT JOIN $table_secondary tasg
|
||||||
|
ON ta.id_agente = tasg.id_agent
|
||||||
|
WHERE ta.id_grupo IN (%s) OR tasg.id_group IN (%s)",
|
||||||
|
$group_id, $group_id));
|
||||||
|
foreach ($agents as $agent) {
|
||||||
|
if ($agent['critical_count'] > 0) {
|
||||||
|
$list[$group['id_grupo']]['_agents_critical_'] += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (($agent['critical_count'] == 0) && ($agent['warning_count'] == 0) && ($group_agents['disabled'] == 0) && ($agent['normal_count'] == 0)) {
|
||||||
|
if ($agent['unknown_count'] > 0) {
|
||||||
|
$list[$group['id_grupo']]['_agents_unknown_'] += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (($agent['critical_count'] == 0) && ($agent['warning_count'] == 0) && ($group_agents['disabled'] == 0) && ($agent['normal_count'] == 0) && ($agent['unknown_count'] == 0)) {
|
||||||
|
if ($agent['notinit_count'] > 0) {
|
||||||
|
$list[$group['id_grupo']]['_agents_not_init_'] += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -2713,8 +2713,8 @@ function get_module_realtime_link_graph ($module) {
|
|||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'graph' => 'snmp_module',
|
'graph' => 'snmp_module',
|
||||||
'agent_alias' => modules_get_agentmodule_agent_alias($module['id_agente_modulo']),
|
'agent_alias' => urlencode(modules_get_agentmodule_agent_alias($module['id_agente_modulo'])),
|
||||||
'module_name' => $module['nombre'],
|
'module_name' => urlencode($module['nombre']),
|
||||||
'snmp_address' => $module['ip_target'],
|
'snmp_address' => $module['ip_target'],
|
||||||
'snmp_community' => $module['snmp_community'],
|
'snmp_community' => $module['snmp_community'],
|
||||||
'snmp_oid' => $module['snmp_oid'],
|
'snmp_oid' => $module['snmp_oid'],
|
||||||
|
@ -344,7 +344,7 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
|
|||||||
|
|
||||||
$acl_column = get_acl_column($privilege);
|
$acl_column = get_acl_column($privilege);
|
||||||
|
|
||||||
if (array_key_exists($users_group_cache_key, $users_group_cache)) {
|
if (array_key_exists($users_group_cache_key, $users_group_cache) && $cache) {
|
||||||
return $users_group_cache[$users_group_cache_key];
|
return $users_group_cache[$users_group_cache_key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($is_a_link_to_other_visualconsole) {
|
else if ($is_a_link_to_other_visualconsole) {
|
||||||
if (empty($layout_data['id_metaconsole'])) {
|
if (!is_metaconsole()) {
|
||||||
$url = $config['homeurl'] . "index.php?sec=reporting&sec2=operation/visual_console/render_view&pure=" . $config["pure"] . "&id=" . $layoutData["id_layout_linked"];
|
$url = $config['homeurl'] . "index.php?sec=reporting&sec2=operation/visual_console/render_view&pure=" . $config["pure"] . "&id=" . $layoutData["id_layout_linked"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -531,6 +531,33 @@ function stacked_gauge($flash_chart, $chart_data, $width, $height,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stacked_thermometers($flash_chart, $chart_data, $width, $height,
|
||||||
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||||
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||||
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') {
|
||||||
|
|
||||||
|
include_once('functions_d3.php');
|
||||||
|
|
||||||
|
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||||
|
|
||||||
|
if (empty($chart_data)) {
|
||||||
|
return '<img src="' . $no_data_image . '" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
return d3_thermometers(
|
||||||
|
$chart_data,
|
||||||
|
$width,
|
||||||
|
$height,
|
||||||
|
$color,
|
||||||
|
$legend,
|
||||||
|
$homeurl,
|
||||||
|
$unit,
|
||||||
|
$font,
|
||||||
|
$font_size + 2,
|
||||||
|
$no_data_image
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
||||||
$legend, $long_index, $no_data_image, $xaxisname = "",
|
$legend, $long_index, $no_data_image, $xaxisname = "",
|
||||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||||
|
@ -285,6 +285,31 @@ function d3_gauges($chart_data, $width, $height, $color, $legend,
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function d3_thermometers($chart_data, $width, $height, $color, $legend,
|
||||||
|
$homeurl, $unit, $font, $font_size, $no_data_image) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
foreach ($chart_data as $key => $value) {
|
||||||
|
$chart_data[$key]['agent_name'] = agents_get_alias($chart_data[$key]['id_agente']);
|
||||||
|
$chart_data[$key]['label'] = io_safe_output($chart_data[$key]['label']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($chart_data))
|
||||||
|
$data = json_encode($chart_data);
|
||||||
|
$output = include_javascript_d3(true);
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
|
$output .= "<div id='thermometers_div' style='float:left; overflow: hidden; margin-left: 10px;'></div>";
|
||||||
|
|
||||||
|
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||||
|
var data = $data;
|
||||||
|
createthermometers(data, '$width', '$height','$font_size','$no_data_image','$font');
|
||||||
|
</script>";
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
function ux_console_phases_donut ($phases, $id, $return = false) {
|
function ux_console_phases_donut ($phases, $id, $return = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -638,7 +663,6 @@ function print_clock_digital_1 ($time_format, $timezone, $clock_animation,$width
|
|||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
||||||
|
@ -1061,6 +1061,228 @@ function createGauges(data, width, height, font_size, no_data_image, font) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createthermometers(data, width, height, font_size, no_data_image, font) {
|
||||||
|
|
||||||
|
for (var variable in data) {
|
||||||
|
module_data = data[variable];
|
||||||
|
}
|
||||||
|
|
||||||
|
// var svg = d3.select('.databox,.filters td')
|
||||||
|
|
||||||
|
var svg = d3.select('#thermometers_div')
|
||||||
|
.append("svg")
|
||||||
|
.attr("width", 250)
|
||||||
|
.attr("height", 400);
|
||||||
|
|
||||||
|
|
||||||
|
var rect = svg.append("rect")
|
||||||
|
.attr("x", 50)
|
||||||
|
.attr("y", 50)
|
||||||
|
.attr("width", 150)
|
||||||
|
.attr("height", 330)
|
||||||
|
.attr("fill", "black")
|
||||||
|
.attr("stroke-width", 5)
|
||||||
|
.attr("stroke", "rgb(37,133,177)")
|
||||||
|
.attr("rx", "10")
|
||||||
|
.attr("ry", "10")
|
||||||
|
.attr("fill", "rgb(235,235,235)");
|
||||||
|
|
||||||
|
var circle = svg.append("circle")
|
||||||
|
.attr("cx", 130)
|
||||||
|
.attr("cy", 280)
|
||||||
|
.attr("r", 12)
|
||||||
|
.attr("height", 300)
|
||||||
|
.attr("fill", "rgb(74,185,197)");
|
||||||
|
|
||||||
|
var progress_back = svg.append('rect')
|
||||||
|
.attr('fill', 'rgb(51,51,53)')
|
||||||
|
.attr('height', 200)
|
||||||
|
.attr('width', 12)
|
||||||
|
.attr('x', 123)
|
||||||
|
.attr('y', 70);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var defs = svg.append("defs");
|
||||||
|
|
||||||
|
var gradient = defs.append("linearGradient")
|
||||||
|
.attr("id", "svgGradient")
|
||||||
|
.attr("x1", "0%")
|
||||||
|
.attr("x2", "0%")
|
||||||
|
.attr("y1", "100%")
|
||||||
|
.attr("y2", "0%");
|
||||||
|
|
||||||
|
gradient.append("stop")
|
||||||
|
.attr('class', 'start')
|
||||||
|
.attr("offset", "0%")
|
||||||
|
.attr("stop-color", "rgb(74,185,197)");
|
||||||
|
|
||||||
|
if(parseFloat(module_data.value) >= parseFloat(module_data.min_warning) && parseFloat(module_data.value) < parseFloat(module_data.min_critical)){
|
||||||
|
gradient.append("stop")
|
||||||
|
.attr('class', 'end')
|
||||||
|
.attr("offset", "100%")
|
||||||
|
.attr("stop-color", "yellow");
|
||||||
|
}
|
||||||
|
else if((module_data.min_critical != 0 && module_data.max_critical != 0) && parseFloat(module_data.value) >= parseFloat(module_data.min_critical) && (parseFloat(module_data.value) <= parseFloat(module_data.max_critical) || parseFloat(module_data.max_critical) == 0)){
|
||||||
|
gradient.append("stop")
|
||||||
|
.attr('class', 'end')
|
||||||
|
.attr("offset", "100%")
|
||||||
|
.attr("stop-color", "red");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
gradient.append("stop")
|
||||||
|
.attr('class', 'end')
|
||||||
|
.attr("offset", "100%")
|
||||||
|
.attr("stop-color", "rgb(130,185,46)");
|
||||||
|
}
|
||||||
|
|
||||||
|
var progress_front = svg.append('rect')
|
||||||
|
.attr('fill', 'red')
|
||||||
|
.attr('height', 0)
|
||||||
|
.attr('width', 12)
|
||||||
|
.attr('x', 123)
|
||||||
|
.attr('y', 270)
|
||||||
|
.attr("fill", "url(#svgGradient)");
|
||||||
|
|
||||||
|
if(module_data.value.toString().indexOf('.') != -1){
|
||||||
|
if(Math.trunc(module_data.value).toString().length > 1){
|
||||||
|
module_data.value = Math.trunc(module_data.value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
module_data.value = parseFloat(module_data.value).toFixed(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(module_data.value >= 1000){
|
||||||
|
module_data.value_label = Math.trunc(module_data.value/1000);
|
||||||
|
var text = svg.append("text")
|
||||||
|
.attr("x", 100)
|
||||||
|
.attr("y", 320)
|
||||||
|
.style("font-size", "1.5em")
|
||||||
|
.text(module_data.value_label+"k"+" ["+module_data.unit+"]");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var text = svg.append("text")
|
||||||
|
.attr("x", 100)
|
||||||
|
.attr("y", 320)
|
||||||
|
.style("font-size", "1.5em")
|
||||||
|
.text(module_data.value+" ["+module_data.unit+"]");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
agent_text = module_data.agent_name;
|
||||||
|
|
||||||
|
if(agent_text.length > 12){
|
||||||
|
agent_text = agent_text.substring(0, 10)+"...";
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = svg.append("text")
|
||||||
|
.attr("x", 65)
|
||||||
|
.attr("y", 370)
|
||||||
|
.style("font-size", "1.5em")
|
||||||
|
.text(agent_text);
|
||||||
|
|
||||||
|
|
||||||
|
label_text = module_data.label;
|
||||||
|
|
||||||
|
if(label_text.length > 12){
|
||||||
|
label_text = label_text.substring(0, 10)+"...";
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = svg.append("text")
|
||||||
|
.attr("x", 65)
|
||||||
|
.attr("y", 350)
|
||||||
|
.style("font-size", "1.5em")
|
||||||
|
.text(label_text);
|
||||||
|
|
||||||
|
var temp_sum = module_data.max-module_data.min;
|
||||||
|
var div_sum = (temp_sum/10);
|
||||||
|
var max_temp = module_data.max;
|
||||||
|
var min_temp = module_data.min;
|
||||||
|
var y = 75;
|
||||||
|
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
|
var startPercent = 0;
|
||||||
|
var endPercent = module_data.value * 200 / max_temp;
|
||||||
|
|
||||||
|
var step = endPercent / 20;
|
||||||
|
|
||||||
|
while (max_temp >= min_temp) {
|
||||||
|
|
||||||
|
if(count != 9){
|
||||||
|
if(max_temp.toString().indexOf('.') != -1){
|
||||||
|
if(Math.trunc(max_temp).toString().length > 1){
|
||||||
|
max_temp = Math.trunc(max_temp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
max_temp = parseFloat(max_temp).toFixed(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(max_temp >= 1000){
|
||||||
|
max_temp_label = Math.trunc(max_temp/1000);
|
||||||
|
var text = svg.append("text")
|
||||||
|
.attr("x", 160)
|
||||||
|
.attr("y", y)
|
||||||
|
.style("font-size", "1.2em")
|
||||||
|
.text(max_temp_label+'k');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var text = svg.append("text")
|
||||||
|
.attr("x", 160)
|
||||||
|
.attr("y", y)
|
||||||
|
.style("font-size", "1.2em")
|
||||||
|
.text(max_temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
var line = svg.append("line")
|
||||||
|
.attr("x1", 142)
|
||||||
|
.attr("y1", y-4)
|
||||||
|
.attr("x2", 153)
|
||||||
|
.attr("y2", y-4)
|
||||||
|
.attr("stroke", "black")
|
||||||
|
.style("font-size", "1.2em")
|
||||||
|
.text(max_temp);
|
||||||
|
|
||||||
|
y += 20;
|
||||||
|
|
||||||
|
max_temp = max_temp-div_sum;
|
||||||
|
}
|
||||||
|
if(count==10){
|
||||||
|
max_temp = module_data.min;
|
||||||
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function updateProgress(bar_progress) {
|
||||||
|
var bar_progress = Number(bar_progress);
|
||||||
|
progress_front.attr('height', (bar_progress));
|
||||||
|
progress_front.attr('y', (270-bar_progress));
|
||||||
|
}
|
||||||
|
|
||||||
|
var bar_progress = startPercent;
|
||||||
|
|
||||||
|
(function loops() {
|
||||||
|
updateProgress(bar_progress);
|
||||||
|
|
||||||
|
if (bar_progress < endPercent) {
|
||||||
|
bar_progress += step;
|
||||||
|
setTimeout(loops, 30);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
delete data[module_data['id_agente_modulo']];
|
||||||
|
if(Object.keys(data).length > 0){
|
||||||
|
createthermometers(data, width, height, font_size, no_data_image, font)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function Gauge(placeholderName, configuration, font)
|
function Gauge(placeholderName, configuration, font)
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.723';
|
$version = '7.0NG.723';
|
||||||
$build = '180601';
|
$build = '180607';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -44,6 +44,7 @@ if (is_ajax ()) {
|
|||||||
$get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip");
|
$get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip");
|
||||||
$get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip");
|
$get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip");
|
||||||
$get_agent_id = (bool) get_parameter ("get_agent_id");
|
$get_agent_id = (bool) get_parameter ("get_agent_id");
|
||||||
|
$get_agents_source_json = (bool) get_parameter ("get_agents_source_json");
|
||||||
$cluster_mode = (bool) get_parameter ("cluster_mode",0);
|
$cluster_mode = (bool) get_parameter ("cluster_mode",0);
|
||||||
$agent_alias = get_parameter('alias', '');
|
$agent_alias = get_parameter('alias', '');
|
||||||
$agents_inserted = get_parameter('agents_inserted', array());
|
$agents_inserted = get_parameter('agents_inserted', array());
|
||||||
@ -1001,6 +1002,29 @@ if (is_ajax ()) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($get_agents_source_json) {
|
||||||
|
$source = get_parameter('source', '');
|
||||||
|
|
||||||
|
if (empty($source)) {
|
||||||
|
$sql_report_log = 'SELECT id_agente, alias
|
||||||
|
FROM tagente, tagent_module_log
|
||||||
|
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
|
||||||
|
} else {
|
||||||
|
$sql_report_log = 'SELECT id_agente, alias
|
||||||
|
FROM tagente, tagent_module_log
|
||||||
|
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0 AND tagent_module_log.source like "'. $source.'"';
|
||||||
|
}
|
||||||
|
|
||||||
|
$all_agent_log = db_get_all_rows_sql($sql_report_log);
|
||||||
|
|
||||||
|
foreach ($all_agent_log as $key => $value) {
|
||||||
|
$agents2[$value['id_agente']] = $value['alias'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($agents2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,7 +1084,7 @@ else {
|
|||||||
$tab = get_parameter ("tab", "main");
|
$tab = get_parameter ("tab", "main");
|
||||||
|
|
||||||
/* Manage tab */
|
/* Manage tab */
|
||||||
$managetab = "";
|
$managetab = array();
|
||||||
|
|
||||||
if (check_acl_one_of_groups ($config['id_user'],$all_groups, "AW") || $is_extra) {
|
if (check_acl_one_of_groups ($config['id_user'],$all_groups, "AW") || $is_extra) {
|
||||||
$managetab['text'] ='<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">'
|
$managetab['text'] ='<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">'
|
||||||
@ -1141,7 +1165,7 @@ if ($url_route_analyzer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* GIS tab */
|
/* GIS tab */
|
||||||
$gistab="";
|
$gistab=array();
|
||||||
if ($config['activate_gis']) {
|
if ($config['activate_gis']) {
|
||||||
$gistab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">'
|
$gistab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente.'">'
|
||||||
.html_print_image("images/op_gis.png", true, array( "title" => __('GIS data')))
|
.html_print_image("images/op_gis.png", true, array( "title" => __('GIS data')))
|
||||||
|
@ -107,7 +107,7 @@ if($count_events == 0){
|
|||||||
|
|
||||||
if ($search != "") {
|
if ($search != "") {
|
||||||
$filter_resume['free_search'] = $search;
|
$filter_resume['free_search'] = $search;
|
||||||
$sql_post .= " AND (evento LIKE '%". io_safe_input($search) . "%' OR id_evento LIKE '%$search%' ".$events_wi_cdata_id.")";
|
$sql_post .= " AND (evento LIKE '%". $search . "%' OR id_evento LIKE '%$search%' ".$events_wi_cdata_id.")";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_type != "") {
|
if ($event_type != "") {
|
||||||
|
@ -124,6 +124,12 @@ if ($view_graph) {
|
|||||||
$height = $graph["height"];
|
$height = $graph["height"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($stacked == CUSTOM_GRAPH_THERMOMETER ){
|
||||||
|
// Use the defined graph height, that's why
|
||||||
|
// the user can setup graph height.
|
||||||
|
$height = $graph["height"];
|
||||||
|
}
|
||||||
|
|
||||||
$name = $graph["name"];
|
$name = $graph["name"];
|
||||||
if (($graph["private"]==1) && ($graph["id_user"] != $id_user)) {
|
if (($graph["private"]==1) && ($graph["id_user"] != $id_user)) {
|
||||||
db_pandora_audit("ACL Violation",
|
db_pandora_audit("ACL Violation",
|
||||||
@ -235,6 +241,7 @@ if ($view_graph) {
|
|||||||
$stackeds[CUSTOM_GRAPH_HBARS] = __('Horizontal Bars');
|
$stackeds[CUSTOM_GRAPH_HBARS] = __('Horizontal Bars');
|
||||||
$stackeds[CUSTOM_GRAPH_VBARS] = __('Vertical Bars');
|
$stackeds[CUSTOM_GRAPH_VBARS] = __('Vertical Bars');
|
||||||
$stackeds[CUSTOM_GRAPH_PIE] = __('Pie');
|
$stackeds[CUSTOM_GRAPH_PIE] = __('Pie');
|
||||||
|
$stackeds[CUSTOM_GRAPH_THERMOMETER] = __('Thermometer');
|
||||||
html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
|
html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.723
|
%define version 7.0NG.723
|
||||||
%define release 180601
|
%define release 180607
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.723
|
%define version 7.0NG.723
|
||||||
%define release 180601
|
%define release 180607
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name apache2
|
%define httpd_name apache2
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.723-180601
|
Version: 7.0NG.723-180607
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.723-180601"
|
pandora_version="7.0NG.723-180607"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
@ -82,6 +82,7 @@ then
|
|||||||
mkdir -p temp_package/var/spool/pandora/data_in/trans
|
mkdir -p temp_package/var/spool/pandora/data_in/trans
|
||||||
chmod 770 temp_package/var/spool/pandora/data_in/trans
|
chmod 770 temp_package/var/spool/pandora/data_in/trans
|
||||||
mkdir -p temp_package/var/log/pandora/
|
mkdir -p temp_package/var/log/pandora/
|
||||||
|
chmod 754 temp_package/var/log/pandora/
|
||||||
mkdir -p temp_package/usr/share/pandora_server/conf/
|
mkdir -p temp_package/usr/share/pandora_server/conf/
|
||||||
mkdir -p temp_package/usr/share/tentacle_server/conf/
|
mkdir -p temp_package/usr/share/tentacle_server/conf/
|
||||||
mkdir -p temp_package/usr/lib/perl5/
|
mkdir -p temp_package/usr/lib/perl5/
|
||||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.723";
|
my $pandora_version = "7.0NG.723";
|
||||||
my $pandora_build = "180601";
|
my $pandora_build = "180607";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
|
@ -31,7 +31,7 @@ our @ISA = qw(Exporter);
|
|||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.723";
|
my $pandora_version = "7.0NG.723";
|
||||||
my $pandora_build = "180601";
|
my $pandora_build = "180607";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
@ -40,6 +40,7 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
|||||||
|
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
api_available
|
api_available
|
||||||
|
api_call
|
||||||
api_create_custom_field
|
api_create_custom_field
|
||||||
api_create_tag
|
api_create_tag
|
||||||
api_create_group
|
api_create_group
|
||||||
@ -50,11 +51,12 @@ our @EXPORT = qw(
|
|||||||
extract_dbpass
|
extract_dbpass
|
||||||
extract_key_map
|
extract_key_map
|
||||||
get_addresses
|
get_addresses
|
||||||
|
get_current_utime_milis
|
||||||
get_lib_version
|
get_lib_version
|
||||||
get_unit
|
get_unit
|
||||||
get_unix_time
|
get_unix_time
|
||||||
get_sys_environment
|
get_sys_environment
|
||||||
get_current_utime_milis
|
get_value_translated
|
||||||
getCurrentUTimeMilis
|
getCurrentUTimeMilis
|
||||||
head
|
head
|
||||||
in_array
|
in_array
|
||||||
@ -295,6 +297,37 @@ sub get_unit {
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Get unit
|
||||||
|
################################################################################
|
||||||
|
sub get_value_translated {
|
||||||
|
my $str = shift;
|
||||||
|
|
||||||
|
if (empty($str)) {
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
$str = trim($str);
|
||||||
|
|
||||||
|
my $value = $str;
|
||||||
|
my $unit = get_unit($str);
|
||||||
|
if(empty($unit)) {
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value =~ s/$unit//g;
|
||||||
|
|
||||||
|
if ($unit =~ /kb/i) { return $value * (2**10);}
|
||||||
|
if ($unit =~ /kib/i) { return $value * (2**10);}
|
||||||
|
if ($unit =~ /mb/i) { return $value * (2**20);}
|
||||||
|
if ($unit =~ /mib/i) { return $value * (2**20);}
|
||||||
|
if ($unit =~ /gb/i) { return $value * (2**30);}
|
||||||
|
if ($unit =~ /gib/i) { return $value * (2**30);}
|
||||||
|
if ($unit =~ /tb/i) { return $value * (2**40);}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
## Decodes a json strin into an hash
|
## Decodes a json strin into an hash
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -1433,10 +1466,10 @@ sub api_available {
|
|||||||
($api_url, $api_pass, $api_user, $api_user_pass) = @{$apidata};
|
($api_url, $api_pass, $api_user, $api_user_pass) = @{$apidata};
|
||||||
}
|
}
|
||||||
|
|
||||||
$api_url = $conf->{'api_url'} unless empty($api_url);
|
$api_url = $conf->{'api_url'} if empty($api_url);
|
||||||
$api_pass = $conf->{'api_pass'} unless empty($api_pass);
|
$api_pass = $conf->{'api_pass'} if empty($api_pass);
|
||||||
$api_user = $conf->{'api_user'} unless empty($api_user);
|
$api_user = $conf->{'api_user'} if empty($api_user);
|
||||||
$api_user_pass = $conf->{'api_user_pass'} unless empty($api_user_pass);
|
$api_user_pass = $conf->{'api_user_pass'} if empty($api_user_pass);
|
||||||
|
|
||||||
my $op = "get";
|
my $op = "get";
|
||||||
my $op2 = "test";
|
my $op2 = "test";
|
||||||
@ -1460,7 +1493,83 @@ sub api_available {
|
|||||||
id => (empty($rs)?undef:trim($rs))
|
id => (empty($rs)?undef:trim($rs))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
# Pandora API call
|
||||||
|
# apidata->{other} = [field1,field2,...,fieldi,...,fieldn]
|
||||||
|
#########################################################################################
|
||||||
|
sub api_call {
|
||||||
|
my ($conf, $apidata) = @_;
|
||||||
|
my ($api_url, $api_pass, $api_user, $api_user_pass,
|
||||||
|
$op, $op2, $other_mode, $other, $return_type);
|
||||||
|
my $separator;
|
||||||
|
|
||||||
|
if (ref $apidata eq "ARRAY") {
|
||||||
|
($api_url, $api_pass, $api_user, $api_user_pass,
|
||||||
|
$op, $op2, $return_type, $other_mode, $other) = @{$apidata};
|
||||||
|
}
|
||||||
|
if (ref $apidata eq "HASH") {
|
||||||
|
$api_url = $apidata->{'api_url'};
|
||||||
|
$api_pass = $apidata->{'api_pass'};
|
||||||
|
$api_user = $apidata->{'api_user'};
|
||||||
|
$api_user_pass = $apidata->{'api_user_pass'};
|
||||||
|
$op = $apidata->{'op'};
|
||||||
|
$op2 = $apidata->{'op2'};
|
||||||
|
$return_type = $apidata->{'return_type'};
|
||||||
|
$other_mode = "url_encode_separator_" . $apidata->{'url_encode_separator'} unless empty($apidata->{'url_encode_separator'});
|
||||||
|
$other_mode = "url_encode_separator_|" if empty($other_mode);
|
||||||
|
($separator) = $other_mode =~ /url_encode_separator_(.*)/;
|
||||||
|
}
|
||||||
|
|
||||||
|
$api_url = $conf->{'api_url'} if empty($api_url);
|
||||||
|
$api_pass = $conf->{'api_pass'} if empty($api_pass);
|
||||||
|
$api_user = $conf->{'api_user'} if empty($api_user);
|
||||||
|
$api_user_pass = $conf->{'api_user_pass'} if empty($api_user_pass);
|
||||||
|
$op = $conf->{'op'} if empty($op);
|
||||||
|
$op2 = $conf->{'op2'} if empty($op2);
|
||||||
|
$return_type = $conf->{'return_type'} if empty($return_type);
|
||||||
|
$return_type = 'json' if empty($return_type);
|
||||||
|
if (ref ($apidata->{'other'}) eq "ARRAY") {
|
||||||
|
$other_mode = "url_encode_separator_|" if empty($other_mode);
|
||||||
|
($separator) = $other_mode =~ /url_encode_separator_(.*)/;
|
||||||
|
|
||||||
|
if (empty($separator)) {
|
||||||
|
$separator = "|";
|
||||||
|
$other_mode = "url_encode_separator_|";
|
||||||
|
}
|
||||||
|
|
||||||
|
$other = join $separator, @{$apidata->{'other'}};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$other = $apidata->{'other'};
|
||||||
|
}
|
||||||
|
|
||||||
|
my $call;
|
||||||
|
|
||||||
|
$call = $api_url . '?';
|
||||||
|
$call .= 'op=' . $op . '&op2=' . $op2;
|
||||||
|
$call .= '&other_mode=url_encode_separator_' . $separator;
|
||||||
|
$call .= '&other=' . $other;
|
||||||
|
$call .= '&apipass=' . $api_pass . '&user=' . $api_user . '&pass=' . $api_user_pass;
|
||||||
|
$call .= '&return_type=' . $return_type;
|
||||||
|
|
||||||
|
my $rs = call_url($conf, "$call");
|
||||||
|
|
||||||
|
if (ref($rs) ne "HASH") {
|
||||||
|
return {
|
||||||
|
rs => (empty($rs)?1:0),
|
||||||
|
error => (empty($rs)?"Empty response.":undef),
|
||||||
|
id => (empty($rs)?undef:trim($rs)),
|
||||||
|
response => (empty($rs)?undef:$rs),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return {
|
||||||
|
rs => 1,
|
||||||
|
error => $rs->{'error'},
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
@ -1473,10 +1582,10 @@ sub api_create_custom_field {
|
|||||||
($api_url, $api_pass, $api_user, $api_user_pass) = @{$apidata};
|
($api_url, $api_pass, $api_user, $api_user_pass) = @{$apidata};
|
||||||
}
|
}
|
||||||
|
|
||||||
$api_url = $conf->{'api_url'} unless empty($api_url);
|
$api_url = $conf->{'api_url'} if empty($api_url);
|
||||||
$api_pass = $conf->{'api_pass'} unless empty($api_pass);
|
$api_pass = $conf->{'api_pass'} if empty($api_pass);
|
||||||
$api_user = $conf->{'api_user'} unless empty($api_user);
|
$api_user = $conf->{'api_user'} if empty($api_user);
|
||||||
$api_user_pass = $conf->{'api_user_pass'} unless empty($api_user_pass);
|
$api_user_pass = $conf->{'api_user_pass'} if empty($api_user_pass);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1572,10 +1681,10 @@ sub api_create_tag {
|
|||||||
($api_url, $api_pass, $api_user, $api_user_pass) = @{$apidata};
|
($api_url, $api_pass, $api_user, $api_user_pass) = @{$apidata};
|
||||||
}
|
}
|
||||||
|
|
||||||
$api_url = $conf->{'api_url'} unless empty($api_url);
|
$api_url = $conf->{'api_url'} if empty($api_url);
|
||||||
$api_pass = $conf->{'api_pass'} unless empty($api_pass);
|
$api_pass = $conf->{'api_pass'} if empty($api_pass);
|
||||||
$api_user = $conf->{'api_user'} unless empty($api_user);
|
$api_user = $conf->{'api_user'} if empty($api_user);
|
||||||
$api_user_pass = $conf->{'api_user_pass'} unless empty($api_user_pass);
|
$api_user_pass = $conf->{'api_user_pass'} if empty($api_user_pass);
|
||||||
|
|
||||||
my $op = "set";
|
my $op = "set";
|
||||||
my $op2 = "create_tag";
|
my $op2 = "create_tag";
|
||||||
|
@ -19,6 +19,7 @@ use Socket qw/inet_aton/;
|
|||||||
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
||||||
|
|
||||||
# Some useful OIDs.
|
# Some useful OIDs.
|
||||||
|
our $ATPHYSADDRESS = ".1.3.6.1.2.1.3.1.1.2";
|
||||||
our $DOT1DBASEBRIDGEADDRESS = ".1.3.6.1.2.1.17.1.1.0";
|
our $DOT1DBASEBRIDGEADDRESS = ".1.3.6.1.2.1.17.1.1.0";
|
||||||
our $DOT1DBASEPORTIFINDEX = ".1.3.6.1.2.1.17.1.4.1.2";
|
our $DOT1DBASEPORTIFINDEX = ".1.3.6.1.2.1.17.1.4.1.2";
|
||||||
our $DOT1DTPFDBADDRESS = ".1.3.6.1.2.1.17.4.3.1.1";
|
our $DOT1DTPFDBADDRESS = ".1.3.6.1.2.1.17.4.3.1.1";
|
||||||
@ -30,11 +31,12 @@ our $IFINDEX = ".1.3.6.1.2.1.2.2.1.1";
|
|||||||
our $IFINOCTECTS = ".1.3.6.1.2.1.2.2.1.10";
|
our $IFINOCTECTS = ".1.3.6.1.2.1.2.2.1.10";
|
||||||
our $IFOPERSTATUS = ".1.3.6.1.2.1.2.2.1.8";
|
our $IFOPERSTATUS = ".1.3.6.1.2.1.2.2.1.8";
|
||||||
our $IFOUTOCTECTS = ".1.3.6.1.2.1.2.2.1.16";
|
our $IFOUTOCTECTS = ".1.3.6.1.2.1.2.2.1.16";
|
||||||
|
our $IFTYPE = ".1.3.6.1.2.1.2.2.1.3";
|
||||||
our $IPENTADDR = ".1.3.6.1.2.1.4.20.1.1";
|
our $IPENTADDR = ".1.3.6.1.2.1.4.20.1.1";
|
||||||
our $IFNAME = ".1.3.6.1.2.1.31.1.1.1.1";
|
our $IFNAME = ".1.3.6.1.2.1.31.1.1.1.1";
|
||||||
our $IFPHYSADDRESS = ".1.3.6.1.2.1.2.2.1.6";
|
our $IFPHYSADDRESS = ".1.3.6.1.2.1.2.2.1.6";
|
||||||
our $IPNETTOMEDIAPHYSADDRESS = ".1.3.6.1.2.1.4.22.1.2";
|
|
||||||
our $IPADENTIFINDEX = ".1.3.6.1.2.1.4.20.1.2";
|
our $IPADENTIFINDEX = ".1.3.6.1.2.1.4.20.1.2";
|
||||||
|
our $IPNETTOMEDIAPHYSADDRESS = ".1.3.6.1.2.1.4.22.1.2";
|
||||||
our $IPROUTEIFINDEX = ".1.3.6.1.2.1.4.21.1.2";
|
our $IPROUTEIFINDEX = ".1.3.6.1.2.1.4.21.1.2";
|
||||||
our $IPROUTENEXTHOP = ".1.3.6.1.2.1.4.21.1.7";
|
our $IPROUTENEXTHOP = ".1.3.6.1.2.1.4.21.1.7";
|
||||||
our $IPROUTETYPE = ".1.3.6.1.2.1.4.21.1.8";
|
our $IPROUTETYPE = ".1.3.6.1.2.1.4.21.1.8";
|
||||||
@ -88,6 +90,9 @@ sub new {
|
|||||||
# Keep our own ARP cache to connect hosts to switches/routers.
|
# Keep our own ARP cache to connect hosts to switches/routers.
|
||||||
arp_cache => {},
|
arp_cache => {},
|
||||||
|
|
||||||
|
# Found children.
|
||||||
|
children => {},
|
||||||
|
|
||||||
# Working SNMP community for each device.
|
# Working SNMP community for each device.
|
||||||
community_cache => {},
|
community_cache => {},
|
||||||
|
|
||||||
@ -290,19 +295,8 @@ sub snmp_discovery($$) {
|
|||||||
# Find interfaces for the device.
|
# Find interfaces for the device.
|
||||||
$self->find_ifaces($device);
|
$self->find_ifaces($device);
|
||||||
|
|
||||||
# Try to learn more MAC addresses from the device's ARP cache.
|
# Check remote ARP caches.
|
||||||
my @output = $self->snmp_get($device, $IPNETTOMEDIAPHYSADDRESS);
|
$self->remote_arp($device);
|
||||||
foreach my $line (@output) {
|
|
||||||
next unless ($line =~ /^$IPNETTOMEDIAPHYSADDRESS.\d+.(\S+)\s+=\s+\S+:\s+(.*)$/);
|
|
||||||
my ($ip_addr, $mac_addr) = ($1, $2);
|
|
||||||
|
|
||||||
# Skip broadcast, net and local addresses.
|
|
||||||
next if ($ip_addr =~ m/\.255$|\.0$|127\.0\.0\.1$/);
|
|
||||||
|
|
||||||
$mac_addr = parse_mac($mac_addr);
|
|
||||||
$self->add_mac($mac_addr, $ip_addr);
|
|
||||||
$self->call('message', "Found MAC $mac_addr for host $ip_addr in the ARP cache of host $device.", 5);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,6 +405,9 @@ sub find_ifaces($$) {
|
|||||||
|
|
||||||
next unless ($if_index =~ /^[0-9]+$/);
|
next unless ($if_index =~ /^[0-9]+$/);
|
||||||
|
|
||||||
|
# Ignore virtual interfaces.
|
||||||
|
next if ($self->get_if_type($device, $if_index) eq '53');
|
||||||
|
|
||||||
# Get the MAC.
|
# Get the MAC.
|
||||||
my $mac = $self->get_if_mac($device, $if_index);
|
my $mac = $self->get_if_mac($device, $if_index);
|
||||||
next unless (defined($mac) && $mac ne '');
|
next unless (defined($mac) && $mac ne '');
|
||||||
@ -636,7 +633,7 @@ sub get_if_ip($$$) {
|
|||||||
my @output = $self->snmp_get($device, $IPADENTIFINDEX);
|
my @output = $self->snmp_get($device, $IPADENTIFINDEX);
|
||||||
foreach my $line (@output) {
|
foreach my $line (@output) {
|
||||||
chomp ($line);
|
chomp ($line);
|
||||||
return $1 if ($line =~ m/^IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/);
|
return $1 if ($line =~ m/^$IPADENTIFINDEX.(\S+)\s+=\s+\S+:\s+$if_index$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@ -657,6 +654,18 @@ sub get_if_mac($$$) {
|
|||||||
return $mac;
|
return $mac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
########################################################################################
|
||||||
|
# Returns the type of the given interface (by index).
|
||||||
|
########################################################################################
|
||||||
|
sub get_if_type($$$) {
|
||||||
|
my ($self, $device, $if_index) = @_;
|
||||||
|
|
||||||
|
my $type = $self->snmp_get_value($device, "$IFTYPE.$if_index");
|
||||||
|
return '' unless defined($type);
|
||||||
|
|
||||||
|
return $type;
|
||||||
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# Get an IP address from the ARP cache given the MAC address.
|
# Get an IP address from the ARP cache given the MAC address.
|
||||||
########################################################################################
|
########################################################################################
|
||||||
@ -858,6 +867,20 @@ sub guess_device_type($$) {
|
|||||||
$self->set_device_type($device, $device_type);
|
$self->set_device_type($device, $device_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
########################################################################################
|
||||||
|
# Return 1 if the given device has children.
|
||||||
|
########################################################################################
|
||||||
|
sub has_children($$) {
|
||||||
|
my ($self, $device) = @_;
|
||||||
|
|
||||||
|
# Check for aliases!
|
||||||
|
$device = $self->{'aliases'}->{$device} if defined($self->{'aliases'}->{$device});
|
||||||
|
|
||||||
|
return 1 if (defined($self->{'children'}->{$device}));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# Return 1 if the given device has a parent.
|
# Return 1 if the given device has a parent.
|
||||||
########################################################################################
|
########################################################################################
|
||||||
@ -949,6 +972,7 @@ sub mark_connected($$;$$$) {
|
|||||||
# A parent-child relationship is always created to help complete the map with
|
# A parent-child relationship is always created to help complete the map with
|
||||||
# layer 3 information.
|
# layer 3 information.
|
||||||
$self->{'parents'}->{$child} = $parent;
|
$self->{'parents'}->{$child} = $parent;
|
||||||
|
$self->{'children'}->{$parent} = $child;
|
||||||
$self->call('set_parent', $child, $parent);
|
$self->call('set_parent', $child, $parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -999,6 +1023,54 @@ sub snmp_responds($$) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Parse the local ARP cache.
|
||||||
|
##############################################################################
|
||||||
|
sub local_arp($) {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
|
my @output = `arp -an 2>/dev/null`;
|
||||||
|
foreach my $line (@output) {
|
||||||
|
next unless ($line =~ m/\((\S+)\) at ([0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+)/);
|
||||||
|
$self->add_mac(parse_mac($2), $1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Parse remote SNMP ARP caches.
|
||||||
|
##############################################################################
|
||||||
|
sub remote_arp($$) {
|
||||||
|
my ($self, $device) = @_;
|
||||||
|
|
||||||
|
# Try to learn more MAC addresses from the device's ARP cache.
|
||||||
|
my @output = $self->snmp_get($device, $IPNETTOMEDIAPHYSADDRESS);
|
||||||
|
foreach my $line (@output) {
|
||||||
|
next unless ($line =~ /^$IPNETTOMEDIAPHYSADDRESS\.\d+\.(\S+)\s+=\s+\S+:\s+(.*)$/);
|
||||||
|
my ($ip_addr, $mac_addr) = ($1, $2);
|
||||||
|
|
||||||
|
# Skip broadcast, net and local addresses.
|
||||||
|
next if ($ip_addr =~ m/\.255$|\.0$|127\.0\.0\.1$/);
|
||||||
|
|
||||||
|
$mac_addr = parse_mac($mac_addr);
|
||||||
|
$self->add_mac($mac_addr, $ip_addr);
|
||||||
|
$self->call('message', "Found MAC $mac_addr for host $ip_addr in the ARP cache of host $device.", 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Look in atPhysAddress for MAC addresses too.
|
||||||
|
@output = $self->snmp_get($device, $ATPHYSADDRESS);
|
||||||
|
foreach my $line (@output) {
|
||||||
|
next unless ($line =~ m/^$ATPHYSADDRESS\.\d+\.\d+\.(\S+)\s+=\s+\S+:\s+(.*)$/);
|
||||||
|
my ($ip_addr, $mac_addr) = ($1, $2);
|
||||||
|
|
||||||
|
# Skip broadcast, net and local addresses.
|
||||||
|
next if ($ip_addr =~ m/\.255$|\.0$|127\.0\.0\.1$/);
|
||||||
|
|
||||||
|
$mac_addr = parse_mac($mac_addr);
|
||||||
|
$self->add_mac($mac_addr, $ip_addr);
|
||||||
|
$self->call('message', "Found MAC $mac_addr for host $ip_addr in the ARP cache (atPhysAddress) of host $device.", 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Ping the given host. Returns 1 if the host is alive, 0 otherwise.
|
# Ping the given host. Returns 1 if the host is alive, 0 otherwise.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -1152,6 +1224,9 @@ sub scan($) {
|
|||||||
$self->call('message', "[1/5] Scanning the network...", 3);
|
$self->call('message', "[1/5] Scanning the network...", 3);
|
||||||
$self->scan_subnet();
|
$self->scan_subnet();
|
||||||
|
|
||||||
|
# Read the local ARP cache.
|
||||||
|
$self->local_arp();
|
||||||
|
|
||||||
# Get a list of found hosts.
|
# Get a list of found hosts.
|
||||||
my @hosts = @{$self->get_hosts()};
|
my @hosts = @{$self->get_hosts()};
|
||||||
if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) {
|
if (scalar(@hosts) > 0 && $self->{'parent_detection'} == 1) {
|
||||||
@ -1173,7 +1248,7 @@ sub scan($) {
|
|||||||
foreach my $host (@hosts) {
|
foreach my $host (@hosts) {
|
||||||
$self->call('update_progress', $progress);
|
$self->call('update_progress', $progress);
|
||||||
$progress += $step;
|
$progress += $step;
|
||||||
next if ($self->has_parent($host));
|
next if ($self->has_parent($host) || $self->has_children($host));
|
||||||
$self->traceroute_connectivity($host);
|
$self->traceroute_connectivity($host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.723
|
%define version 7.0NG.723
|
||||||
%define release 180601
|
%define release 180607
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
@ -176,10 +176,12 @@ exit 0
|
|||||||
%{_bindir}/pandora_exec
|
%{_bindir}/pandora_exec
|
||||||
%{_bindir}/pandora_server
|
%{_bindir}/pandora_server
|
||||||
%{_bindir}/tentacle_server
|
%{_bindir}/tentacle_server
|
||||||
%dir %{_localstatedir}/log/pandora
|
|
||||||
%dir %{_sysconfdir}/pandora
|
%dir %{_sysconfdir}/pandora
|
||||||
%dir %{_localstatedir}/spool/pandora
|
%dir %{_localstatedir}/spool/pandora
|
||||||
|
|
||||||
|
%defattr(-,pandora,root, 754)
|
||||||
|
%dir %{_localstatedir}/log/pandora
|
||||||
|
|
||||||
%defattr(600,root,root)
|
%defattr(600,root,root)
|
||||||
/etc/pandora/pandora_server.conf.new
|
/etc/pandora/pandora_server.conf.new
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.723
|
%define version 7.0NG.723
|
||||||
%define release 180601
|
%define release 180607
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.723"
|
PI_VERSION="7.0NG.723"
|
||||||
PI_BUILD="180601"
|
PI_BUILD="180607"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
@ -317,7 +317,7 @@ install () {
|
|||||||
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/trans
|
chmod 2770 $DESTDIR$PANDORA_SPOOL/data_in/trans
|
||||||
mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null
|
mkdir -p $DESTDIR$PANDORA_LOG 2> /dev/null
|
||||||
chown -R pandora $DESTDIR$PANDORA_LOG 2> /dev/null
|
chown -R pandora $DESTDIR$PANDORA_LOG 2> /dev/null
|
||||||
chmod 2770 $DESTDIR$PANDORA_LOG 2> /dev/null
|
chmod 2774 $DESTDIR$PANDORA_LOG 2> /dev/null
|
||||||
|
|
||||||
echo "Giving proper permission to /var/spool/pandora"
|
echo "Giving proper permission to /var/spool/pandora"
|
||||||
for group in "www-data" wwwrun www apache
|
for group in "www-data" wwwrun www apache
|
||||||
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.723 PS180601";
|
my $version = "7.0NG.723 PS180607";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||||||
Encode::Locale::decode_argv;
|
Encode::Locale::decode_argv;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.723 PS180601";
|
my $version = "7.0NG.723 PS180607";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user