mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch 'develop' into 1134-url-routes-analyzer-feature-dev
This commit is contained in:
commit
3652f0a0ea
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.712-170907
|
||||
Version: 7.0NG.712-170919
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.712-170907"
|
||||
pandora_version="7.0NG.712-170919"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.712';
|
||||
use constant AGENT_BUILD => '170907';
|
||||
use constant AGENT_BUILD => '170919';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.712
|
||||
%define release 170907
|
||||
%define release 170919
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.712
|
||||
%define release 170907
|
||||
%define release 170919
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.712"
|
||||
PI_BUILD="170907"
|
||||
PI_BUILD="170919"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{170907}
|
||||
{170919}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.712(Build 170907)")
|
||||
#define PANDORA_VERSION ("7.0NG.712(Build 170919)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.712(Build 170907))"
|
||||
VALUE "ProductVersion", "(7.0NG.712(Build 170919))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.712-170907
|
||||
Version: 7.0NG.712-170919
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.712-170907"
|
||||
pandora_version="7.0NG.712-170919"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -167,7 +167,7 @@ function dbmgr_extension_main () {
|
||||
echo '<strong>An error has occured when querying the database.</strong><br />';
|
||||
echo $error;
|
||||
|
||||
db_pandora_audit("Extension DB inface", "Error in SQL", false, false, $sql);
|
||||
db_pandora_audit("DB Interface Extension", "Error in SQL", false, false, $sql);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -175,7 +175,7 @@ function dbmgr_extension_main () {
|
||||
if (! is_array ($result)) {
|
||||
echo "<strong>Output: <strong>".$result;
|
||||
|
||||
db_pandora_audit("Extension DB inface", "SQL", false, false, $sql);
|
||||
db_pandora_audit("DB Interface Extension", "SQL", false, false, $sql);
|
||||
|
||||
return;
|
||||
}
|
||||
|
4
pandora_console/extras/mr/7.sql
Normal file
4
pandora_console/extras/mr/7.sql
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
START TRANSACTION;
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0';
|
||||
COMMIT;
|
@ -1230,6 +1230,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area';
|
||||
ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down';
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_custom_fields`
|
||||
|
@ -561,10 +561,23 @@ if ($agents !== false) {
|
||||
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
|
||||
"</a>";
|
||||
echo "</strong>";
|
||||
|
||||
$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"]));
|
||||
|
||||
if ($agent["disabled"]) {
|
||||
ui_print_help_tip(__('Disabled'));
|
||||
|
||||
if (!$in_planned_downtime) {
|
||||
echo "</em>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($in_planned_downtime) {
|
||||
ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png');
|
||||
|
||||
echo "</em>";
|
||||
}
|
||||
|
||||
echo '</span><div class="left actions" style="visibility: hidden; clear: left">';
|
||||
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
echo '<a href="index.php?sec=gagente&
|
||||
|
@ -88,6 +88,8 @@ $id_agent = (int) get_parameter ('id_agent');
|
||||
$insert_downtime_agent = (int) get_parameter ('insert_downtime_agent');
|
||||
$delete_downtime_agent = (int) get_parameter ('delete_downtime_agent');
|
||||
|
||||
$modules_selection_mode = (string) get_parameter('modules_selection_mode');
|
||||
|
||||
// User groups with AD or AW permission for ACL checks
|
||||
$user_groups_ad = array_keys(users_get_groups($config['id_user'], $access));
|
||||
|
||||
@ -116,7 +118,20 @@ if ($insert_downtime_agent === 1) {
|
||||
}
|
||||
else {
|
||||
foreach ($agents as $agent_id) {
|
||||
//check module belongs to the agent
|
||||
if($modules_selection_mode == 'all'){
|
||||
$check = false;
|
||||
foreach ($module_names as $module_name) {
|
||||
$check_module = modules_get_agentmodule_id($module_name, $agent_id);
|
||||
if (!empty($check_module)){
|
||||
$check = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$check){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Check AD permission on agent
|
||||
$agent_group = db_get_value('id_grupo', 'tagente', 'id_agente', $agent_id);
|
||||
|
||||
@ -710,13 +725,25 @@ if ($id_downtime > 0) {
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
|
||||
echo html_print_select ($agents, "id_agents[]", -1, '', _("Any"), -2, false, true, true, '', false, 'width: 180px;');
|
||||
|
||||
if ($type_downtime != 'quiet'){
|
||||
echo '<div id="available_modules_selection_mode" style="padding-top:20px;display: none;">';
|
||||
} else {
|
||||
echo '<div id="available_modules_selection_mode" style="padding-top:20px">';
|
||||
}
|
||||
echo html_print_select (array('common' => __('Show common modules'), 'all' => __('Show all modules')), 'modules_selection_mode',
|
||||
'common', false, '', '', true,false,true,'',false,'min-width:180px;');
|
||||
echo '</div>';
|
||||
|
||||
echo '<h4>' . __('Available modules:') .
|
||||
ui_print_help_tip (__('Only for type Quiet for downtimes.'), true) . '</h4>';
|
||||
|
||||
if ($type_downtime != 'quiet')
|
||||
if ($type_downtime != 'quiet'){
|
||||
echo '<div id="available_modules" style="display: none;">';
|
||||
else
|
||||
} else {
|
||||
echo '<div id="available_modules" style="">';
|
||||
}
|
||||
|
||||
echo html_print_select (array(), "module[]", '', '', '', 0, false, true, true, '', false, 'width: 180px;');
|
||||
echo "</div>";
|
||||
echo "<br /><br /><br />";
|
||||
@ -904,8 +931,10 @@ ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascri
|
||||
case 'disable_agents_alerts':
|
||||
case 'disable_agents':
|
||||
$("#available_modules").hide();
|
||||
$("#available_modules_selection_mode").hide();
|
||||
break;
|
||||
case 'quiet':
|
||||
$("#available_modules_selection_mode").show();
|
||||
$("#available_modules").show();
|
||||
break;
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ $table->data['edit3'][1] = html_print_extended_select_for_post_process('post_pro
|
||||
|
||||
$table->data['edit3'][2] = __('SMNP community');
|
||||
$table->data['edit3'][3] = html_print_input_text ('snmp_community', '',
|
||||
'', 10, 15, true);
|
||||
'', 10, 100, true);
|
||||
|
||||
$target_ip_values = array();
|
||||
$target_ip_values['auto'] = __('Auto');
|
||||
|
@ -212,7 +212,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
||||
*/
|
||||
|
||||
ui_print_page_header(
|
||||
__('Massive operations') . ' » '. $options[$option],
|
||||
__('Bulk operations') . ' » '. $options[$option],
|
||||
"images/gm_massive_operations.png", false, "", true, $onheader,true, "massivemodal");
|
||||
|
||||
// Checks if the PHP configuration is correctly
|
||||
|
@ -196,7 +196,7 @@ if (!empty($sub)) {
|
||||
}
|
||||
|
||||
|
||||
if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM")) {
|
||||
if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0, "RR")) {
|
||||
// Servers
|
||||
$menu_godmode["gservers"]["text"] = __('Servers');
|
||||
$menu_godmode["gservers"]["sec2"] = "godmode/servers/modificar_server";
|
||||
|
@ -69,6 +69,8 @@ $exception_condition = REPORT_EXCEPTION_CONDITION_EVERYTHING;
|
||||
$exception_condition_value = 10;
|
||||
$modulegroup = 0;
|
||||
$period = SECONDS_1DAY;
|
||||
$search = "";
|
||||
$log_number = 1000;
|
||||
// Added support for projection graphs
|
||||
$period_pg = SECONDS_5DAY;
|
||||
$projection_period = SECONDS_5DAY;
|
||||
@ -201,9 +203,12 @@ switch ($action) {
|
||||
case 'event_report_log':
|
||||
$period = $item['period'];
|
||||
$description = $item['description'];
|
||||
|
||||
$es = json_decode($item['external_source'], true);
|
||||
$id_agents = $es['id_agents'];
|
||||
$source = $es['source'];
|
||||
$search = $es['search'];
|
||||
$log_number = empty($es['log_number']) ? $log_number : $es['log_number'];
|
||||
break;
|
||||
case 'simple_graph':
|
||||
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
|
||||
@ -705,6 +710,29 @@ You can of course remove the warnings, that's why we include the source and do n
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_search" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php echo __('Search') ?>
|
||||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_input_text('search', $search, '', 40, 100);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_log_number" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php echo __('Log number');
|
||||
ui_print_help_tip(__('Warning: this parameter limits the contents of the logs and affects the performance.')); ?>
|
||||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
echo "<input name='log_number' max='10000' min='1' size='10' type='number' value='$log_number'>";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_period" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
@ -1026,20 +1054,30 @@ 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>
|
||||
<?php
|
||||
$agents = agents_get_group_agents($group);
|
||||
if ((empty($agents)) || $agents == -1) $agents = array();
|
||||
$sql = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent';
|
||||
$all_agent_log = db_get_all_rows_sql($sql);
|
||||
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
}
|
||||
|
||||
// $agents = agents_get_group_agents($group);
|
||||
if ((empty($agents2)) || $agents2 == -1) $agents = array();
|
||||
|
||||
$agents_select = array();
|
||||
if (is_array($id_agents) || is_object($id_agents)){
|
||||
foreach ($id_agents as $id) {
|
||||
foreach ($agents as $key => $a) {
|
||||
foreach ($agents2 as $key => $a) {
|
||||
if ($key == (int)$id) {
|
||||
$agents_select[$key] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
html_print_select($agents, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
||||
// html_debug($agents);
|
||||
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -2578,6 +2616,8 @@ function chooseType() {
|
||||
$("#row_agent").hide();
|
||||
$("#row_module").hide();
|
||||
$("#row_period").hide();
|
||||
$("#row_search").hide();
|
||||
$("#row_log_number").hide();
|
||||
$("#row_period1").hide();
|
||||
$("#row_estimate").hide();
|
||||
$("#row_interval").hide();
|
||||
@ -2675,6 +2715,8 @@ function chooseType() {
|
||||
$("#log_help_tip").css("visibility", "visible");
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
$("#row_search").show();
|
||||
$("#row_log_number").show();
|
||||
$("#agents_row").show();
|
||||
$("#row_source").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
|
@ -925,9 +925,13 @@ switch ($action) {
|
||||
case 'event_report_log':
|
||||
$agents_to_report = get_parameter('id_agents2');
|
||||
$source = get_parameter('source', "");
|
||||
$search = get_parameter('search', "");
|
||||
$log_number = get_parameter('log_number', "");
|
||||
|
||||
$es['source'] = $source;
|
||||
$es['id_agents'] = $agents_to_report;
|
||||
$es['search']=$search;
|
||||
$es['log_number']=$log_number;
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
$values['period'] = get_parameter('period');
|
||||
@ -1281,9 +1285,13 @@ switch ($action) {
|
||||
case 'event_report_log':
|
||||
$agents_to_report = get_parameter('id_agents2');
|
||||
$source = get_parameter('source', "");
|
||||
$search = get_parameter('search', "");
|
||||
$log_number = get_parameter('log_number', "");
|
||||
|
||||
$es['source'] = $source;
|
||||
$es['id_agents'] = $agents_to_report;
|
||||
$es['search']=$search;
|
||||
$es['log_number']=$log_number;
|
||||
|
||||
$values['external_source'] = json_encode($es);
|
||||
$values['period'] = get_parameter('period');
|
||||
|
@ -15,6 +15,7 @@ var creationItem = null;
|
||||
var is_opened_palette = false;
|
||||
var idItem = 0;
|
||||
var selectedItem = null;
|
||||
var selectedItems = null;
|
||||
var lines = Array();
|
||||
var user_lines = Array();
|
||||
var toolbuttonActive = null;
|
||||
@ -305,32 +306,62 @@ function update_button_palette_callback() {
|
||||
}
|
||||
|
||||
$("#text_" + idItem).html(values['label']);
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
|
||||
if(values['show_statistics'] == 1){
|
||||
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 520);
|
||||
$("#image_" + idItem).attr('height', 80);
|
||||
$("#image_" + idItem).css('width', '520px');
|
||||
$("#image_" + idItem).css('height', '80px');
|
||||
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
|
||||
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 70);
|
||||
$("#image_" + idItem).attr('height', 70);
|
||||
$("#image_" + idItem).css('width', '70px');
|
||||
$("#image_" + idItem).css('height', '70px');
|
||||
$("#image_" + idItem).attr('width', values['width']);
|
||||
$("#image_" + idItem).attr('height', values['height']);
|
||||
$("#image_" + idItem).css('width', values['width'] + 'px');
|
||||
$("#image_" + idItem).css('height', values['height'] + 'px');
|
||||
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', 70);
|
||||
$("#image_" + idItem).attr('height', 70);
|
||||
$("#image_" + idItem).css('width', '70px');
|
||||
$("#image_" + idItem).css('height', '70px');
|
||||
}
|
||||
else{
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
|
||||
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
|
||||
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
|
||||
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
|
||||
$("#image_" + idItem).attr('width', values['width']);
|
||||
$("#image_" + idItem).attr('height', values['height']);
|
||||
$("#image_" + idItem).css('width', values['width'] + 'px');
|
||||
$("#image_" + idItem).css('height', values['height'] + 'px');
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
$("#image_" + idItem).removeAttr('height');
|
||||
$("#image_" + idItem).attr('width', values['width']);
|
||||
$("#image_" + idItem).attr('height', values['height']);
|
||||
$("#image_" + idItem).css('width', values['width'] + 'px');
|
||||
$("#image_" + idItem).css('height', values['height'] + 'px');
|
||||
}
|
||||
|
||||
break;
|
||||
case 'percentile_bar':
|
||||
case 'percentile_item':
|
||||
@ -613,6 +644,7 @@ function readFields() {
|
||||
$("input[name='line_width']").val());
|
||||
values['line_color'] = $("input[name='line_color']").val();
|
||||
values['label_position'] = $(".labelpos[sel=yes]").attr('position');
|
||||
values['show_statistics'] = $("input[name=show_statistics]").is(':checked') ? 1 : 0;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
values['metaconsole'] = 1;
|
||||
@ -659,7 +691,7 @@ function create_button_palette_callback() {
|
||||
alert('Undefined height');
|
||||
validate = false;
|
||||
}
|
||||
if ((values['label'] == '') && (values['image'] == '')) {
|
||||
if ((values['label'] == '') && (values['image'] == '') && (values['show_statistics']) == false) {
|
||||
alert($("#message_alert_no_label_no_image").html());
|
||||
validate = false;
|
||||
}
|
||||
@ -1140,6 +1172,17 @@ function loadFieldsFromDB(item) {
|
||||
}
|
||||
}
|
||||
|
||||
if (key == 'show_statistics') {
|
||||
if (val == "1") {
|
||||
$("input[name=show_statistics]")
|
||||
.prop("checked", true);
|
||||
}
|
||||
else {
|
||||
$("input[name=show_statistics]")
|
||||
.prop("checked", false);
|
||||
}
|
||||
}
|
||||
|
||||
if (key == 'type_graph') {
|
||||
$("select[name=type_graph]").val(val);
|
||||
}
|
||||
@ -1428,6 +1471,9 @@ function hiddenFields(item) {
|
||||
$("#enable_link_row").css('display', 'none');
|
||||
$("#enable_link_row." + item).css('display', '');
|
||||
|
||||
$("#show_statistics_row").css('display', 'none');
|
||||
$("#show_statistics_row." + item).css('display', '');
|
||||
|
||||
$("#preview_row").css('display', 'none');
|
||||
$("#preview_row." + item).css('display', '');
|
||||
|
||||
@ -1621,11 +1667,13 @@ function set_static_graph_status(idElement, image, status) {
|
||||
data: parameter,
|
||||
success: function (data) {
|
||||
set_static_graph_status(idElement, image, data);
|
||||
if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){
|
||||
$('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2);
|
||||
}
|
||||
else{
|
||||
$('#'+idElement+ ' img').css('margin-left', parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2);
|
||||
if(values['show_statistics'] == 1){
|
||||
if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){
|
||||
$('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2);
|
||||
}
|
||||
else{
|
||||
$('#'+idElement+ ' img').css('margin-left', parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1660,15 +1708,25 @@ function set_static_graph_status(idElement, image, status) {
|
||||
}
|
||||
|
||||
function set_image(type, idElement, image) {
|
||||
if (type == "image") {
|
||||
|
||||
if(image == 'show_statistics_bad.png' || image == 'show_statistics_ok.png' || image == 'show_statistics_warning.png' || image == 'show_statistics.png'){
|
||||
item = "#image_" + idElement;
|
||||
img_src = "images/console/icons/" + image;
|
||||
img_src = "images/console/signes/group_status.png";
|
||||
}
|
||||
else if (type == "background") {
|
||||
item = "#background_img";
|
||||
img_src = "images/console/background/" + image;
|
||||
else{
|
||||
|
||||
if (type == "image") {
|
||||
item = "#image_" + idElement;
|
||||
img_src = "images/console/icons/" + image;
|
||||
}
|
||||
else if (type == "background") {
|
||||
item = "#background_img";
|
||||
img_src = "images/console/background/" + image;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
var params = [];
|
||||
params.push("get_image_path=1");
|
||||
params.push("img_src=" + img_src);
|
||||
@ -1682,6 +1740,12 @@ function set_image(type, idElement, image) {
|
||||
url: get_url_ajax(),
|
||||
success: function (data) {
|
||||
$(item).attr('src', data);
|
||||
|
||||
if(image == 'show_statistics_bad.png' || image == 'show_statistics_ok.png' || image == 'show_statistics_warning.png' || image == 'show_statistics.png'){
|
||||
$(item).attr('width', 520);
|
||||
$(item).attr('height', 80);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -2173,21 +2237,28 @@ function createItem(type, values, id_data) {
|
||||
|
||||
}
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
// Do none
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
if(values['show_statistics'] != 1){
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
// Do none
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
}
|
||||
else{
|
||||
$image.attr('width', $('#preview > img')[0].naturalWidth)
|
||||
.attr('height', $('#preview > img')[0].naturalHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$image.attr('width', values['width'])
|
||||
.attr('height', values['height']);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$image.attr('width', $('#preview > img')[0].naturalWidth)
|
||||
.attr('height', $('#preview > img')[0].naturalHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$image.attr('width', values['width'])
|
||||
.attr('height', values['height']);
|
||||
}
|
||||
// else{
|
||||
// $('#image_'+id_data).css('width', values['width']+'px');
|
||||
// $('#image_'+id_data).css('height', values['height']+'px');
|
||||
// }
|
||||
/*
|
||||
var $span = $('<span></span>')
|
||||
.attr('id', 'text_' + id_data)
|
||||
@ -2246,7 +2317,31 @@ function createItem(type, values, id_data) {
|
||||
.append($input);
|
||||
}
|
||||
|
||||
set_static_graph_status(id_data, values['image']);
|
||||
if(values['show_statistics'] != 1){
|
||||
set_static_graph_status(id_data, values['image']);
|
||||
}
|
||||
else{
|
||||
set_static_graph_status(id_data, 'show_statistics');
|
||||
}
|
||||
|
||||
if(values['show_statistics'] != 1){
|
||||
|
||||
if ((values['width'] == 0) || (values['height'] == 0)) {
|
||||
// Do none
|
||||
if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
|
||||
$image.attr('width', '70')
|
||||
.attr('height', '70');
|
||||
}
|
||||
else{
|
||||
$image.attr('width', $('#preview > img')[0].naturalWidth)
|
||||
.attr('height', $('#preview > img')[0].naturalHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$image.attr('width', values['width'])
|
||||
.attr('height', values['height']);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'auto_sla_graph':
|
||||
@ -2580,9 +2675,9 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
||||
case 'static_graph':
|
||||
if ((event != 'resizestop') && (event != 'show_grid')
|
||||
&& (event != 'dragstop')) {
|
||||
|
||||
set_static_graph_status(idElement, values['image']);
|
||||
|
||||
if(values['show_statistics'] != 1){
|
||||
set_static_graph_status(idElement, values['image']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'percentile_item':
|
||||
@ -2811,6 +2906,9 @@ function updateDB(type, idElement , values, event) {
|
||||
}
|
||||
|
||||
function copyDB(idItem) {
|
||||
|
||||
console.log(idItem);
|
||||
|
||||
metaconsole = $("input[name='metaconsole']").val();
|
||||
|
||||
parameter = Array();
|
||||
@ -2931,10 +3029,19 @@ function activeToolboxButton(id, active) {
|
||||
}
|
||||
|
||||
function click_delete_item_callback() {
|
||||
activeToolboxButton('edit_item', false);
|
||||
deleteDB(idItem);
|
||||
idItem = 0;
|
||||
selectedItem = null;
|
||||
if(selectedItems == null){
|
||||
activeToolboxButton('edit_item', false);
|
||||
deleteDB(idItem);
|
||||
idItem = 0;
|
||||
selectedItem = null;
|
||||
}
|
||||
else{
|
||||
idItem = 0;
|
||||
selectedItem = null;
|
||||
selectedItems.forEach( function(valor, indice, array) {
|
||||
deleteDB(valor);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2953,6 +3060,7 @@ function eventsItems(drag) {
|
||||
//$(".item").resizable(); //Disable but run in ff and in the waste (aka micro$oft IE) show ungly borders
|
||||
|
||||
$('.item').bind('click', function(event, ui) {
|
||||
|
||||
event.stopPropagation();
|
||||
if (!is_opened_palette) {
|
||||
var divParent = $(event.target);
|
||||
@ -3070,6 +3178,62 @@ function eventsItems(drag) {
|
||||
enterprise_click_item_callback(divParent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!event.ctrlKey){
|
||||
firstItem = event.currentTarget.id;
|
||||
selectedItems = null;
|
||||
selectedItems = Array();
|
||||
selectedItems.push(event.currentTarget.id);
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
selectedItem = null;
|
||||
|
||||
unselectAll();
|
||||
|
||||
if(selectedItems.indexOf(event.currentTarget.id) > -1){
|
||||
|
||||
$('#'+event.currentTarget.id).css('left', '+=1');
|
||||
$('#'+event.currentTarget.id).css('top', '+=1');
|
||||
$('#'+event.currentTarget.id).css('border', '');
|
||||
$('#'+event.currentTarget.id).attr('withborder') == 'false';
|
||||
|
||||
|
||||
selectedItems.splice(selectedItems.indexOf(event.currentTarget.id),1);
|
||||
}
|
||||
else{
|
||||
$('#'+event.currentTarget.id).css('left', '-=1');
|
||||
$('#'+event.currentTarget.id).css('top', '-=1');
|
||||
$('#'+event.currentTarget.id).css('border', '1px dotted rgb(0, 0, 255)');
|
||||
$('#'+event.currentTarget.id).attr('withborder') == 'true';
|
||||
|
||||
|
||||
selectedItems.push(event.currentTarget.id);
|
||||
}
|
||||
|
||||
|
||||
selectedItems.forEach( function(valor, indice, array) {
|
||||
if(selectedItems.indexOf(valor) > -1 && $('#'+valor).css('border') != '1px dotted rgb(0, 0, 255)'){
|
||||
// $('#'+valor).css('left', '-=1');
|
||||
// $('#'+valor).css('top', '-=1');
|
||||
$('#'+valor).css('border', '1px dotted rgb(0, 0, 255)');
|
||||
$('#'+valor).attr('withborder') == 'true';
|
||||
}
|
||||
});
|
||||
|
||||
$('#'+firstItem).css('left', '-=1');
|
||||
$('#'+firstItem).css('top', '-=1');
|
||||
|
||||
firstItem = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
//Double click in the item
|
||||
@ -3120,7 +3284,8 @@ function eventsItems(drag) {
|
||||
|
||||
$('.item').bind('dragstart', function(event, ui) {
|
||||
|
||||
event.stopPropagation();
|
||||
if(selectedItems == null || selectedItems.length < 2){
|
||||
event.stopPropagation();
|
||||
if (!is_opened_palette) {
|
||||
unselectAll();
|
||||
$(event.target).css('border', '1px blue dotted');
|
||||
@ -3189,6 +3354,7 @@ function eventsItems(drag) {
|
||||
break;
|
||||
default:
|
||||
idItem = $(event.target).attr('id');
|
||||
|
||||
break;
|
||||
}
|
||||
activeToolboxButton('copy_item', true);
|
||||
@ -3196,10 +3362,17 @@ function eventsItems(drag) {
|
||||
activeToolboxButton('delete_item', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.log('Dragstart');
|
||||
|
||||
multiDragStart(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('.item').bind('dragstop', function(event, ui) {
|
||||
|
||||
if(selectedItems == null || selectedItems.length < 2){
|
||||
event.stopPropagation();
|
||||
|
||||
var values = {};
|
||||
@ -3207,9 +3380,16 @@ function eventsItems(drag) {
|
||||
values['mov_top'] = ui.position.top;
|
||||
|
||||
updateDB(selectedItem, idItem, values, 'dragstop');
|
||||
}
|
||||
else{
|
||||
|
||||
console.log('Dragstop');
|
||||
multidragStop(event);
|
||||
}
|
||||
});
|
||||
|
||||
$('.item').bind('drag', function(event, ui) {
|
||||
if(selectedItems == null || selectedItems.length < 2){
|
||||
if ($(event.target).hasClass('handler_start')) {
|
||||
selectedItem = 'handler_start';
|
||||
}
|
||||
@ -3290,6 +3470,11 @@ function eventsItems(drag) {
|
||||
draw_user_lines("", 0, 0, 0 , 0, 0, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.log('Drag');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -3355,6 +3540,8 @@ function eventsBackground() {
|
||||
|
||||
// Event click for background
|
||||
$("#background").click(function(event) {
|
||||
selectedItems = null;
|
||||
selectedItems = Array();
|
||||
event.stopPropagation();
|
||||
if (!is_opened_palette) {
|
||||
unselectAll();
|
||||
@ -3731,3 +3918,49 @@ function showGrid() {
|
||||
eventsItems();
|
||||
}
|
||||
}
|
||||
|
||||
function multiDragStart(event){
|
||||
multiDragMouse(event);
|
||||
|
||||
}
|
||||
|
||||
function multidragStop(event){
|
||||
$('#background').off("mousemove");
|
||||
values = [];
|
||||
selectedItems.forEach( function(valor, indice, array) {
|
||||
$('#'+valor).css('left','+=1');
|
||||
$('#'+valor).css('top','+=1');
|
||||
classItem = $('#'+valor).attr('class').replace(/item|ui-draggable|ui-draggable-dragging|-dragging/g, '').trim();
|
||||
values['mov_left'] = parseInt($('#'+valor).css('left'));
|
||||
values['mov_top'] = parseInt($('#'+valor).css('top'));
|
||||
updateDB(classItem, valor, values,'dragstop');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function multiDragMouse(eventDrag){
|
||||
var preX = [];
|
||||
var preY = [];
|
||||
|
||||
selectedItems.forEach( function(valor, indice, array) {
|
||||
preX[indice] = $('#'+valor).css('left');
|
||||
preY[indice] = $('#'+valor).css('top');
|
||||
});
|
||||
|
||||
$('#background').on('mousemove',function(event){
|
||||
var moveDiffX = event.clientX - eventDrag.clientX;
|
||||
var moveDiffY = event.clientY - eventDrag.clientY;
|
||||
selectedItems.forEach( function(valor, indice, array) {
|
||||
if(!(parseInt($('#'+valor).css('left')) < 0 && parseInt(moveDiffX)+parseInt(preX[indice]) < 0) &&
|
||||
!(parseInt($('#'+valor).css('left')) + parseInt($('#'+valor).css('width')) > parseInt($('#background').css('width')) && parseInt(moveDiffX+preX[indice]) > 0)){
|
||||
$('#'+valor).css('left',parseInt(moveDiffX)+parseInt(preX[indice])+'px');
|
||||
}
|
||||
if(!(parseInt($('#'+valor).css('top')) < 0 && parseInt(moveDiffY)+parseInt(preY[indice]) < 0) &&
|
||||
!(parseInt($('#'+valor).css('top')) + parseInt($('#'+valor).css('height')) > parseInt($('#background').css('height')) && parseInt(moveDiffY+preY[indice]) > 0)){
|
||||
$('#'+valor).css('top',parseInt(moveDiffY)+parseInt(preY[indice])+'px');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
@ -357,6 +357,7 @@ switch ($activeTab) {
|
||||
break;
|
||||
case GROUP_ITEM:
|
||||
$values['id_group'] = get_parameter('group_' . $id, 0);
|
||||
$values['show_statistics'] = get_parameter('show_statistics', 0);
|
||||
break;
|
||||
}
|
||||
$agentName = get_parameter('agent_' . $id, '');
|
||||
@ -410,6 +411,7 @@ switch ($activeTab) {
|
||||
$width = (int) get_parameter ("width", 0);
|
||||
$height = (int) get_parameter ("height", 0);
|
||||
$period = (int) get_parameter ("period", 0);
|
||||
$show_statistics = get_parameter ("show_statistics", 0);
|
||||
$process_value = (int) get_parameter ("process_value", 0);
|
||||
$percentileitem_width = (int) get_parameter ("percentileitem_width", 0);
|
||||
$max_value = (int) get_parameter ("max_value", 0);
|
||||
|
@ -209,7 +209,7 @@ $table->data[34][0] = __('Allow create planned downtimes in the past') .
|
||||
$table->data[34][1] = __('Yes').' '.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).' ';
|
||||
$table->data[34][1] .= __('No').' '.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true);
|
||||
|
||||
$table->data[35][0] = __('Limit parameters massive') .
|
||||
$table->data[35][0] = __('Limit parameters bulk') .
|
||||
ui_print_help_tip(__('Your PHP environment is setted with %d max_input_vars. Maybe you must not set this value with upper values.', ini_get("max_input_vars")), true);
|
||||
$table->data[35][1] = html_print_input_text('limit_parameters_massive',
|
||||
$config['limit_parameters_massive'], '', 10, 10, true);
|
||||
|
@ -577,7 +577,7 @@ $row++;
|
||||
|
||||
$dirItems = scandir($config['homedir'] . '/images/custom_logo');
|
||||
foreach ($dirItems as $entryDir) {
|
||||
if (strstr($entryDir, '.jpg') !== false) {
|
||||
if (strstr($entryDir, '.jpg') !== false || strstr($entryDir, '.png') !== false) {
|
||||
$customLogos['images/custom_logo/' . $entryDir] = $entryDir;
|
||||
}
|
||||
}
|
||||
@ -600,7 +600,7 @@ $table_other->data['custom_report_front-font'][1] = html_print_select ($_fonts,
|
||||
$table_other->data['custom_report_front-logo'][0] = __('Custom report front') . ' - ' .
|
||||
__('Custom logo') .
|
||||
ui_print_help_tip(
|
||||
__("The dir of custom logos is in your www Pandora Console in \"images/custom_logo\". You can upload more files (ONLY JPEG) in upload tool in console."), true);
|
||||
__("The dir of custom logos is in your www Pandora Console in \"images/custom_logo\". You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), true);
|
||||
$table_other->data['custom_report_front-logo'][1] = html_print_select(
|
||||
$customLogos,
|
||||
'custom_report_front_logo',
|
||||
|
BIN
pandora_console/images/console/signes/group_status.png
Normal file
BIN
pandora_console/images/console/signes/group_status.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
pandora_console/images/minireloj-16.png
Normal file
BIN
pandora_console/images/minireloj-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 439 B |
@ -275,12 +275,16 @@ if ($get_module_detail) {
|
||||
// Detect string data with \n and convert to <br>'s
|
||||
$datos = $row[$attr[0]];
|
||||
|
||||
// Because this *SHIT* of print_table monster, I cannot format properly this cells
|
||||
// so, eat this, motherfucker :))
|
||||
$datos = preg_replace("/\n/", "</br></br>", $datos);
|
||||
$datos = preg_replace ('/</', '<', $datos);
|
||||
$datos = preg_replace ('/>/', '>', $datos);
|
||||
$datos = preg_replace ('/\n/i','<br>',$datos);
|
||||
$datos = preg_replace ('/\s/i',' ',$datos);
|
||||
$datos_format = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
|
||||
$datos_format .= $datos;
|
||||
$datos_format .= "</div>";
|
||||
|
||||
// I dont why, but using index (value) method, data is automatically converted to html entities ¿?
|
||||
$data[] = $datos;
|
||||
$data[] = $datos_format;
|
||||
}
|
||||
elseif ($is_web_content_string) {
|
||||
//Fixed the goliat sends the strings from web
|
||||
|
@ -132,6 +132,7 @@ $get_element_status = get_parameter('get_element_status', 0);
|
||||
$enable_link = get_parameter('enable_link', 1);
|
||||
$type_graph = get_parameter('type_graph', 'area');
|
||||
$label_position = get_parameter('label_position', 'down');
|
||||
$show_statistics = get_parameter('show_statistics', 0);
|
||||
|
||||
switch ($action) {
|
||||
case 'get_font':
|
||||
@ -569,6 +570,9 @@ switch ($action) {
|
||||
if ($height !== null) {
|
||||
$values['height'] = $height;
|
||||
}
|
||||
if ($show_statistics !== null) {
|
||||
$values['show_statistics'] = $show_statistics;
|
||||
}
|
||||
break;
|
||||
case 'module_graph':
|
||||
if ($height_module_graph !== null) {
|
||||
@ -640,6 +644,7 @@ switch ($action) {
|
||||
switch ($type) {
|
||||
case 'group_item':
|
||||
unset($values['id_group']);
|
||||
unset($values['show_statistics']);
|
||||
break;
|
||||
case 'module_graph':
|
||||
unset($values['image']);
|
||||
@ -948,6 +953,7 @@ switch ($action) {
|
||||
$values['width'] = $width;
|
||||
$values['height'] = $height;
|
||||
$values['id_group'] = $id_group;
|
||||
$values['show_statistics'] = $show_statistics;
|
||||
breaK;
|
||||
case 'simple_value':
|
||||
//This allows min, max and avg process in a simple value
|
||||
|
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC170907';
|
||||
$build_version = 'PC170919';
|
||||
$pandora_version = 'v7.0NG.712';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -1807,6 +1807,17 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) {
|
||||
$id_group = (int) $id_group;
|
||||
}
|
||||
|
||||
$three_eyes_crow_groups = db_get_all_rows_sql("SELECT tperfil.*, tusuario_perfil.id_perfil FROM tperfil, tusuario_perfil WHERE tusuario_perfil.id_usuario = '" .
|
||||
$id_user . "' AND tusuario_perfil.id_grupo = 0 AND tusuario_perfil.id_perfil = tperfil.id_perfil");
|
||||
if ($three_eyes_crow_groups && !empty($three_eyes_crow_groups)) {
|
||||
$acl_column = get_acl_column($access);
|
||||
foreach ($three_eyes_crow_groups as $three_eyes_crow_group) {
|
||||
if (isset($three_eyes_crow_group[$acl_column])) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$parents_id = array($id_group);
|
||||
if ($id_group != 0 && $onlyOneGroup !== true) {
|
||||
$group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group));
|
||||
|
@ -853,11 +853,13 @@ function agents_get_group_agents ($id_group = 0, $search = false,
|
||||
//No added search. Show both disabled and non-disabled
|
||||
}
|
||||
else if (is_array ($search)) {
|
||||
$filter['disabled'] = 0;
|
||||
if (isset ($search["disabled"])) {
|
||||
$filter['disabled'] = (int) $search["disabled"];
|
||||
if (!$search['all_agents']) {
|
||||
$filter['disabled'] = 0;
|
||||
if (isset ($search["disabled"])) {
|
||||
$filter['disabled'] = (int) $search["disabled"];
|
||||
|
||||
unset ($search["disabled"]);
|
||||
unset ($search["disabled"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset ($search["string"])) {
|
||||
|
@ -9942,6 +9942,13 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
|
||||
:
|
||||
SECONDS_1HOUR; // 1 hour by default
|
||||
|
||||
$graph_threshold =
|
||||
(!empty($other) && isset($other['data'][2]))
|
||||
?
|
||||
$other['data'][2]
|
||||
:
|
||||
0;
|
||||
|
||||
if (is_nan($graph_seconds) || $graph_seconds <= 0) {
|
||||
// returnError('error_module_graph', __(''));
|
||||
return;
|
||||
@ -9952,41 +9959,44 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
|
||||
$id_module, $graph_seconds, false, 600, 300, '',
|
||||
'', false, false, true, time(), '', 0, 0, true, true,
|
||||
ui_get_full_url(false) . '/', 1, false, '', false, true,
|
||||
true, 'white', null, false, false, $config['type_module_charts']);
|
||||
true, 'white', null, false, false, $config['type_module_charts'],
|
||||
false, false);
|
||||
|
||||
$graph_image_file_encoded = false;
|
||||
$graph_image_file_encoded = false;
|
||||
if (preg_match("/<img src='(.+)'./", $graph_html, $matches)) {
|
||||
$file_url = $matches[1];
|
||||
|
||||
if (preg_match("/\?(.+)&(.+)&(.+)&(.+)/", $file_url,$parameters)) {
|
||||
array_shift ($parameters);
|
||||
foreach ($parameters as $parameter){
|
||||
$value = explode ("=",$parameter);
|
||||
if (preg_match("/\?(.+)&(.+)&(.+)&(.+)/", $file_url,$parameters)) {
|
||||
array_shift ($parameters);
|
||||
foreach ($parameters as $parameter){
|
||||
$value = explode ("=",$parameter);
|
||||
|
||||
if (strcmp($value[0], "static_graph") == 0){
|
||||
$static_graph = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "graph_type") == 0){
|
||||
$graph_type = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "ttl") == 0){
|
||||
$ttl = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "id_graph") == 0){
|
||||
$id_graph = $value[1];
|
||||
}
|
||||
}
|
||||
if (strcmp($value[0], "static_graph") == 0){
|
||||
$static_graph = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "graph_type") == 0){
|
||||
$graph_type = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "ttl") == 0){
|
||||
$ttl = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "id_graph") == 0){
|
||||
$id_graph = $value[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check values are OK
|
||||
if ( (isset ($graph_type))
|
||||
&& (isset ($ttl))
|
||||
&& (isset ($id_graph))) {
|
||||
$_GET["ttl"] = $ttl;
|
||||
$_GET["id_graph"] = $id_graph;
|
||||
$_GET["graph_type"] = $graph_type;
|
||||
$_GET["static_graph"] = $static_graph;
|
||||
$_GET["ttl"] = $ttl;
|
||||
$_GET["id_graph"] = $id_graph;
|
||||
$_GET["graph_type"] = $graph_type;
|
||||
$_GET["static_graph"] = $static_graph;
|
||||
$_GET["graph_threshold"] = $graph_threshold;
|
||||
$_GET["id_module"] = $id_module;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
@ -201,7 +201,7 @@ function config_update_config () {
|
||||
if (!config_update_value ('past_planned_downtimes', get_parameter('past_planned_downtimes')))
|
||||
$error_update[] = __('Allow create planned downtimes in the past');
|
||||
if (!config_update_value ('limit_parameters_massive', get_parameter('limit_parameters_massive')))
|
||||
$error_update[] = __('Limit parameters massive');
|
||||
$error_update[] = __('Limit parameters bulk');
|
||||
if (!config_update_value ('identification_reminder', get_parameter('identification_reminder')))
|
||||
$error_update[] = __('Identification_reminder');
|
||||
if (!config_update_value ('include_agents', (bool)get_parameter('include_agents')))
|
||||
|
@ -126,7 +126,7 @@ function events_get_events_no_grouped($sql_post, $offset = 0,
|
||||
|
||||
function events_get_events_grouped($sql_post, $offset = 0,
|
||||
$pagination = 1, $meta = false, $history = false, $total = false,
|
||||
$history_db = false, $order = "ASC") {
|
||||
$history_db = false, $order = "DESC") {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -2031,7 +2031,8 @@ function events_page_details ($event, $server = "") {
|
||||
|
||||
$data = array();
|
||||
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('OS').'</div>';
|
||||
$data[1] = ui_print_os_icon ($agent["id_os"], true, true).' ('.$agent["os_version"].')';
|
||||
$data[1] = ui_print_os_icon ($agent["id_os"], true, true);
|
||||
if (!empty($agent["os_version"])) $data[1] .= ' ('.$agent["os_version"].')';
|
||||
$table_details->data[] = $data;
|
||||
|
||||
$data = array();
|
||||
|
@ -3851,12 +3851,69 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
|
||||
if ($fullscale) {
|
||||
// Get module data
|
||||
$data = db_get_all_rows_filter ('tagente_datos',
|
||||
array ('id_agente_modulo' => $agent_module_id,
|
||||
$events = db_get_all_rows_filter('tevento',
|
||||
array ('id_agentmodule' => $agent_module_id,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('datos', 'utimestamp'), 'AND', true);
|
||||
array ('evento', 'utimestamp', 'event_type', 'id_evento'));
|
||||
|
||||
$table = "tagente_datos";
|
||||
$module_type_str = modules_get_type_name ($agent_module_id);
|
||||
if (strstr ($module_type_str, 'string') !== false) {
|
||||
$table = "tagente_datos_string";
|
||||
}
|
||||
|
||||
$query = " SELECT utimestamp, datos FROM $table ";
|
||||
$query .= " WHERE id_agente_modulo=$agent_module_id ";
|
||||
$query .= " ORDER BY utimestamp ASC LIMIT 1";
|
||||
|
||||
$ret = db_get_all_rows_sql( $query , true);
|
||||
|
||||
$first_data = $ret[0]['utimestamp'];
|
||||
/*
|
||||
// Get the last event after inverval to know if graph start on unknown
|
||||
$prev_event = db_get_row_filter ('tevento',
|
||||
array ('id_agentmodule' => $agent_module_id,
|
||||
"utimestamp <= $datelimit",
|
||||
'order' => 'utimestamp DESC'));
|
||||
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
|
||||
$start_unknown = true;
|
||||
}
|
||||
*/
|
||||
if ($events === false) {
|
||||
$events = array ();
|
||||
}
|
||||
|
||||
$data_uncompress = db_uncompress_module_data($agent_module_id, $datelimit, $date);
|
||||
|
||||
$i = 0;
|
||||
$data = array();
|
||||
if(is_array($data_uncompress)){
|
||||
foreach ($data_uncompress as $value) {
|
||||
foreach ($value['data'] as $key => $value) {
|
||||
$data[$i]['datos'] = $value['datos'];
|
||||
if(empty($value['datos'])){
|
||||
if($value['utimestamp'] < $first_data){
|
||||
$data[$i]['unknown'] = 0;
|
||||
$data[$i]['not_init'] = 1;
|
||||
$data[$i]['utimestamp'] = $value['utimestamp'];
|
||||
}
|
||||
else{
|
||||
$data[$i]['not_init'] = 0;
|
||||
$data[$i]['unknown'] = 1;
|
||||
$data[$i]['utimestamp'] = $value['utimestamp'];
|
||||
}
|
||||
}
|
||||
else{
|
||||
$data[$i]['not_init'] = 0;
|
||||
$data[$i]['unknown'] = 0;
|
||||
}
|
||||
$data[$i]['utimestamp'] = $value['utimestamp'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($data) > $resolution) {
|
||||
$resolution = count($data); //Number of points of the graph
|
||||
@ -3938,26 +3995,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
|
||||
$max_value = 0;
|
||||
|
||||
if ($fullscale) {
|
||||
$data2 = array();
|
||||
$previus_datas_cont = -1;
|
||||
$k = 0;
|
||||
for ($i = 0; $i <= $resolution; $i++) {
|
||||
$timestamp = $datelimit + ($interval * $i);
|
||||
|
||||
if ($timestamp < $data[0]['utimestamp']) {
|
||||
$previus_datas_cont++;
|
||||
$data2[$k]['utimestamp'] = $timestamp;
|
||||
$data2[$k]['datos'] = 0;
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
html_debug($data2);
|
||||
html_debug($data);
|
||||
$data = array_merge($data2, $data);
|
||||
$resolution += $previus_datas_cont;
|
||||
}
|
||||
|
||||
// Calculate chart data
|
||||
$last_known = $previous_data;
|
||||
for ($i = 0; $i <= $resolution; $i++) {
|
||||
@ -3970,7 +4007,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
$zero = 0;
|
||||
$total = 0;
|
||||
$count = 0;
|
||||
|
||||
$is_unknown = false;
|
||||
// Read data that falls in the current interval
|
||||
while (isset ($data[$j]) &&
|
||||
$data[$j]['utimestamp'] >= $timestamp &&
|
||||
@ -3984,6 +4021,10 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
}
|
||||
|
||||
$last_known = $data[$j]['datos'];
|
||||
|
||||
if ($show_unknown && $data[$j]['unknown']){
|
||||
$is_unknown = true;
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
@ -3996,7 +4037,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
$event_value = 0;
|
||||
$alert_value = 0;
|
||||
$unknown_value = 0;
|
||||
$is_unknown = false;
|
||||
|
||||
// Is the first point of a unknown interval
|
||||
$first_unknown = false;
|
||||
|
||||
@ -4107,7 +4148,6 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
|
||||
if (!isset($chart[$timestamp]['unknown'.$series_suffix])) {
|
||||
$chart[$timestamp]['unknown'.$series_suffix] = 0;
|
||||
}
|
||||
|
||||
$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
|
||||
$series_type['unknown'.$series_suffix] = 'area';
|
||||
}
|
||||
|
@ -102,14 +102,15 @@ function io_safe_input($value) {
|
||||
// Replace ( for the html entitie
|
||||
$valueHtmlEncode = str_replace(')', ")", $valueHtmlEncode);
|
||||
|
||||
$valueHtmlEncode = str_replace(')', ")", $valueHtmlEncode);
|
||||
|
||||
|
||||
// Fixed the º character, because the Perl in the Pandora Server
|
||||
// use the hex value instead the human readble.
|
||||
// TICKET: #1495
|
||||
$valueHtmlEncode = str_replace('º', "º", $valueHtmlEncode);
|
||||
|
||||
// Fixed the ° character.
|
||||
// TICKET: 1223
|
||||
$valueHtmlEncode = str_replace('°', "°", $valueHtmlEncode);
|
||||
|
||||
|
||||
//Replace some characteres for html entities
|
||||
|
@ -1808,6 +1808,26 @@ function networkmap_get_new_nodes_from_ip_mask($ip_mask,
|
||||
return $agents;
|
||||
}
|
||||
|
||||
function modules_get_all_interfaces($id_agent) {
|
||||
$return = array();
|
||||
|
||||
$modules = db_get_all_rows_filter('tagente_modulo',
|
||||
array('id_agente' => $id_agent));
|
||||
|
||||
if (empty($modules))
|
||||
$modules = array();
|
||||
|
||||
foreach ($modules as $module) {
|
||||
if (preg_match ("/(.+)_ifOperStatus$/" , (string)$module['nombre'], $matches)) {
|
||||
if ($matches[1]) {
|
||||
$return[] = $module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
|
@ -69,6 +69,7 @@ function networkmap_process_networkmap($id = 0) {
|
||||
$layout = "spring2";
|
||||
break;
|
||||
}
|
||||
|
||||
$simple = 0;
|
||||
$font_size = 12;
|
||||
$nooverlap = false;
|
||||
@ -154,6 +155,7 @@ function networkmap_process_networkmap($id = 0) {
|
||||
break;
|
||||
default:
|
||||
$filename_plain = sys_get_temp_dir() . "/plain.txt";
|
||||
|
||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
break;
|
||||
@ -329,6 +331,9 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area
|
||||
$item['id_agent'] = (int)$node['style']['id_agent'];
|
||||
$item['id_module'] = (int)$node['source_data'];
|
||||
}
|
||||
else {
|
||||
$item['type'] = 3;
|
||||
}
|
||||
|
||||
$item['fixed'] = true;
|
||||
$item['x'] = (int)$node['x'];
|
||||
|
@ -123,19 +123,61 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
return reporting_check_structure_report($report);
|
||||
}
|
||||
|
||||
$metaconsole_on = is_metaconsole();
|
||||
|
||||
foreach ($contents as $content) {
|
||||
if (!empty($period)) {
|
||||
$content['period'] = $period;
|
||||
}
|
||||
|
||||
$content['style'] = json_decode(io_safe_output($content['style']), true);
|
||||
|
||||
$graphs_to_macro = db_get_all_rows_field_filter ("tgraph_source",
|
||||
"id_graph", $content['id_gs']);
|
||||
|
||||
if ($graphs_to_macro === false)
|
||||
$graphs_to_macro = array();
|
||||
|
||||
$modules_to_macro = 0;
|
||||
$agents_to_macro = array();
|
||||
foreach ($graphs_to_macro as $graph_item) {
|
||||
$modules_to_macro++;
|
||||
|
||||
if (in_array('label', $content['style'])) {
|
||||
if ($content['id_agent'] == 0) {
|
||||
//Metaconsole connection
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module']));
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$agents_to_macro_aux = array();
|
||||
foreach ($agents_to_macro as $ag) {
|
||||
if (!in_array($ag, $agents_to_macro_aux)) {
|
||||
$agents_to_macro_aux[$ag] = $ag;
|
||||
}
|
||||
}
|
||||
$agents_to_macro = $agents_to_macro_aux;
|
||||
|
||||
if(isset($content['style']['name_label'])){
|
||||
//Add macros name
|
||||
$items_label = array();
|
||||
$items_label['type'] = $content['type'];
|
||||
$items_label['id_agent'] = $content['id_agent'];
|
||||
$items_label['id_agent_module'] = $content['id_agent_module'];
|
||||
$metaconsole_on = is_metaconsole();
|
||||
$items_label['modules'] = $modules_to_macro;
|
||||
$items_label['agents'] = $agents_to_macro;
|
||||
$server_name = $content['server_name'];
|
||||
|
||||
//Metaconsole connection
|
||||
@ -147,7 +189,6 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(sizeof($content['id_agent']) != 1){
|
||||
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
|
||||
}
|
||||
@ -5800,12 +5841,6 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
if ($config['metaconsole'] && $type_report != 'automatic_graph') {
|
||||
$id_meta = metaconsole_get_id_server($content["server_name"]);
|
||||
$server = metaconsole_get_connection_by_id ($id_meta);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
|
||||
$return = array();
|
||||
$return['type'] = 'custom_graph';
|
||||
@ -5844,21 +5879,40 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
array_push ($modules, $graph_item['id_agent_module']);
|
||||
}
|
||||
|
||||
array_push ($weights, $graph_item["weight"]);
|
||||
if (in_array('label',$content['style'])) {
|
||||
if (defined('METACONSOLE')) {
|
||||
$server_name = $content['server_name'];
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||
continue;
|
||||
}
|
||||
$item = array('type' => 'custom_graph',
|
||||
'id_agent' =>$content['id_agent'],
|
||||
'id_agent_module'=>$graph_item['id_agent_module']);
|
||||
'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']),
|
||||
'id_agent_module'=>$graph_item['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
$item = array('type' => 'custom_graph',
|
||||
$item = array('type' => 'custom_graph',
|
||||
'id_agent' =>modules_get_agentmodule_agent($graph_item['id_agent_module']),
|
||||
'id_agent_module'=>$graph_item['id_agent_module']);
|
||||
}
|
||||
|
||||
$label = reporting_label_macro($item, $content['style']['label']);
|
||||
|
||||
$labels[$graph_item['id_agent_module']] = $label;
|
||||
if (defined('METACONSOLE')) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
array_push ($weights, $graph_item["weight"]);
|
||||
}
|
||||
|
||||
if ($config['metaconsole'] && $type_report != 'automatic_graph') {
|
||||
$id_meta = metaconsole_get_id_server($content["server_name"]);
|
||||
$server = metaconsole_get_connection_by_id ($id_meta);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$return['chart'] = '';
|
||||
@ -10313,32 +10367,65 @@ function reporting_label_macro ($item, $label) {
|
||||
case 'MTTR':
|
||||
case 'automatic_graph':
|
||||
if (preg_match("/_agent_/", $label)) {
|
||||
$agent_name = agents_get_alias($item['id_agent']);
|
||||
if (count($item['agents']) > 1) {
|
||||
$agent_name = count($item['agents']) . __(' agents');
|
||||
}
|
||||
else {
|
||||
$agent_name = agents_get_alias($item['id_agent']);
|
||||
}
|
||||
|
||||
$label = str_replace("_agent_", $agent_name, $label);
|
||||
}
|
||||
|
||||
if (preg_match("/_agentdescription_/", $label)) {
|
||||
$agent_name = agents_get_description($item['id_agent']);
|
||||
if (count($item['agents']) > 1) {
|
||||
$agent_name = "";
|
||||
}
|
||||
else {
|
||||
$agent_name = agents_get_description($item['id_agent']);
|
||||
}
|
||||
$label = str_replace("_agentdescription_", $agent_name, $label);
|
||||
}
|
||||
|
||||
if (preg_match("/_agentgroup_/", $label)) {
|
||||
$agent_name = groups_get_name(agents_get_agent_group($item['id_agent']),true);
|
||||
if (count($item['agents']) > 1) {
|
||||
$agent_name = "";
|
||||
}
|
||||
else {
|
||||
$agent_name = groups_get_name(agents_get_agent_group($item['id_agent']),true);
|
||||
}
|
||||
$label = str_replace("_agentgroup_", $agent_name, $label);
|
||||
}
|
||||
|
||||
if (preg_match("/_address_/", $label)) {
|
||||
$agent_name = agents_get_address($item['id_agent']);
|
||||
if (count($item['agents']) > 1) {
|
||||
$agent_name = "";
|
||||
}
|
||||
else {
|
||||
$agent_name = agents_get_address($item['id_agent']);
|
||||
}
|
||||
$label = str_replace("_address_", $agent_name, $label);
|
||||
}
|
||||
|
||||
if (preg_match("/_module_/", $label)) {
|
||||
$module_name = modules_get_agentmodule_name($item['id_agent_module']);
|
||||
if ($item['modules'] > 1) {
|
||||
$module_name = $item['modules'] . __(' modules');
|
||||
}
|
||||
else {
|
||||
$module_name = modules_get_agentmodule_name($item['id_agent_module']);
|
||||
}
|
||||
|
||||
$label = str_replace("_module_", $module_name, $label);
|
||||
}
|
||||
|
||||
if (preg_match("/_moduledescription_/", $label)) {
|
||||
$module_description = modules_get_agentmodule_descripcion($item['id_agent_module']);
|
||||
if ($item['modules'] > 1) {
|
||||
$module_description = "";
|
||||
}
|
||||
else {
|
||||
$module_description = modules_get_agentmodule_descripcion($item['id_agent_module']);
|
||||
}
|
||||
|
||||
$label = str_replace("_moduledescription_", $module_description, $label);
|
||||
}
|
||||
break;
|
||||
|
@ -3882,6 +3882,20 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
EVENT_CRIT_CRITICAL => COL_CRITICAL
|
||||
);
|
||||
|
||||
$user_groups = users_get_groups($config['id_user'], 'ER');
|
||||
$user_groups_ids = array_keys($user_groups);
|
||||
|
||||
if (empty($user_groups)) {
|
||||
$groups_condition = ' 1 = 0 ';
|
||||
}
|
||||
else {
|
||||
$groups_condition = ' id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
|
||||
}
|
||||
|
||||
if (!check_acl ($config['id_user'], 0, "PM")) {
|
||||
$groups_condition .= " AND id_grupo != 0";
|
||||
}
|
||||
|
||||
$cont = 0;
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
@ -3912,7 +3926,8 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
$event = db_get_row_filter ('tmetaconsole_event',
|
||||
array (
|
||||
'utimestamp > '.$bottom,
|
||||
'utimestamp < '.$top),
|
||||
'utimestamp < '.$top,
|
||||
$groups_condition),
|
||||
'criticity, utimestamp');
|
||||
|
||||
if (!empty($event['utimestamp'])) {
|
||||
|
@ -250,7 +250,7 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
|
||||
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)");
|
||||
WHERE disabled = 0 AND id_grupo IN ($user_groups_ids)");
|
||||
|
||||
$list['_agents_unknown_'] = $group_stat[0]["unknown"];
|
||||
$list['_monitors_alerts_fired_'] = $group_stat[0]["alerts_fired"];
|
||||
|
@ -1094,12 +1094,10 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
else {
|
||||
if ($width == 0 || $height == 0) {
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
|
||||
@ -1107,12 +1105,10 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
else{
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' .
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
|
||||
@ -1217,7 +1213,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
break;
|
||||
case STATIC_GRAPH:
|
||||
case GROUP_ITEM:
|
||||
if ($layoutData['image'] != null) {
|
||||
if ($layoutData['image'] != null || $layoutData['show_statistics'] == 1) {
|
||||
|
||||
|
||||
$img_style_title = strip_tags($label);
|
||||
@ -1274,35 +1270,130 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
|
||||
$varsize = getimagesize($img);
|
||||
|
||||
if ($width == 0 || $height == 0) {
|
||||
if($varsize[0] > 150 || $varsize[1] > 150){
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => "70px",
|
||||
"height" => "70px",
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
|
||||
if($layoutData['show_statistics'] == 1){
|
||||
|
||||
if (get_parameter('action') == 'edit') {
|
||||
|
||||
if ($width == 0 || $height == 0) {
|
||||
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
|
||||
}
|
||||
else{
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
|
||||
$agents_critical = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_CRITICAL),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_warning = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_WARNING),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_unknown = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_UNKNOWN),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_ok = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_OK),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
|
||||
|
||||
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
|
||||
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
|
||||
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
|
||||
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
|
||||
|
||||
if($width == 0 || $height == 0){
|
||||
$dyn_width = 520;
|
||||
$dyn_height = 80;
|
||||
}
|
||||
else{
|
||||
$dyn_width = $width;
|
||||
$dyn_height = $height;
|
||||
}
|
||||
|
||||
|
||||
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
|
||||
|
||||
if($layoutData['label_position'] == 'left'){
|
||||
echo "float:right;";
|
||||
}
|
||||
elseif ($layoutData['label_position'] == 'right') {
|
||||
echo "float:left;";
|
||||
}
|
||||
|
||||
echo '">';
|
||||
|
||||
echo "<tr style='height:10%;'>";
|
||||
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
|
||||
|
||||
echo "</tr>";
|
||||
echo "<tr style='background-color:whitesmoke;height:90%;'>";
|
||||
echo "<td>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#FC4444;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Critical</div>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#f8db3f;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Warning</div>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#84b83c;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_ok, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => $width,
|
||||
"height" => $height,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
|
||||
if ($width == 0 || $height == 0) {
|
||||
if($varsize[0] > 150 || $varsize[1] > 150){
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => "70px",
|
||||
"height" => "70px",
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => $width,
|
||||
"height" => $height,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -453,6 +453,13 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$form_items['period_row']['html'] = '<td align="left">' . __('Period') . '</td>
|
||||
<td align="left">' . html_print_extended_select_for_time ('period', SECONDS_5MINUTES, '', '', '', false, true) . '</td>';
|
||||
|
||||
$form_items['show_statistics_row'] = array();
|
||||
$form_items['show_statistics_row']['items'] = array('group_item');
|
||||
$form_items['show_statistics_row']['html'] =
|
||||
'<td align="left" style="">' . __('Show statistics') . '</td>
|
||||
<td align="left" style="">' .
|
||||
html_print_checkbox('show_statistics', 1, '', true) . '</td>';
|
||||
|
||||
|
||||
$form_items['module_graph_size_row'] = array();
|
||||
$form_items['module_graph_size_row']['items'] = array('module_graph', 'datos');
|
||||
|
@ -835,7 +835,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
||||
alert_ids, legend_alerts, yellow_threshold, red_threshold,
|
||||
force_integer, separator, separator2,
|
||||
yellow_up, red_up, yellow_inverse, red_inverse,
|
||||
series_suffix_str, dashboard, vconsole, xaxisname,background_color,legend_color) {
|
||||
series_suffix_str, dashboard, vconsole, xaxisname,background_color,legend_color,
|
||||
short_data) {
|
||||
|
||||
var threshold = true;
|
||||
var thresholded = false;
|
||||
@ -1714,7 +1715,6 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
||||
y = y / 1000000;
|
||||
}
|
||||
else if (y < -1000) {
|
||||
console.log('entra por negativo');
|
||||
how_bigger = "K";
|
||||
y = y / 1000;
|
||||
}
|
||||
@ -1880,7 +1880,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
||||
|
||||
function yFormatter(v, axis) {
|
||||
axis.datamin = 0;
|
||||
var formatted = number_format(v, force_integer, "");
|
||||
if (short_data) {
|
||||
var formatted = number_format(v, force_integer, "");
|
||||
}
|
||||
else {
|
||||
var formatted = v;
|
||||
}
|
||||
|
||||
return '<div class='+font+' style="font-size:'+font_size+'pt;">'+formatted+'</div>';
|
||||
}
|
||||
|
@ -490,6 +490,16 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
||||
$return .= html_print_input_hidden('unknown_text', __('Unknown'),
|
||||
true);
|
||||
|
||||
if (!isset($config["short_module_graph_data"]))
|
||||
$config["short_module_graph_data"] = true;
|
||||
|
||||
if ($config["short_module_graph_data"]) {
|
||||
$short_data = true;
|
||||
}
|
||||
else {
|
||||
$short_data = false;
|
||||
}
|
||||
|
||||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "$(document).ready( function () {";
|
||||
@ -530,7 +540,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
||||
" . json_encode($vconsole) . ",\n" .
|
||||
"'$xaxisname', \n" .
|
||||
"'$background_color', \n" .
|
||||
"'$legend_color'
|
||||
"'$legend_color', \n" .
|
||||
"'$short_data'
|
||||
);";
|
||||
$return .= "});";
|
||||
$return .= "</script>";
|
||||
|
@ -55,12 +55,12 @@ function clippy_start_page_homepage() {
|
||||
$return_tours['tours']['homepage']['steps'][] = array(
|
||||
'element'=> '#clippy',
|
||||
'intro' =>
|
||||
'<div style="text-align: left; padding-left: 20px; padding-right: 20px;">'.
|
||||
'<div class="clippy_body" style="text-align: left; padding-left: 20px; padding-right: 20px;">'.
|
||||
__('Hi, can I help you?') . '<br/><br/>' .
|
||||
__('Let me introduce my self: I am Pandorin, the annoying assistant of Pandora FMS. You can follow my steps to do basic tasks in Pandora FMS or you can close me and never see me again.') .
|
||||
'<br /> ' .
|
||||
'<br /> ' .
|
||||
'<div style="font-size: 7pt;">' .
|
||||
'<div class="clippy_body" style="font-size: 7pt;">' .
|
||||
html_print_checkbox_extended
|
||||
('clippy_is_annoying', 1, $clippy_is_annoying, false,
|
||||
'set_clippy_annoying()', '', true) .
|
||||
|
@ -51,7 +51,7 @@
|
||||
<tr><td>Group Management<td>PM
|
||||
<tr><td>Creating inventory modules<td>PM
|
||||
<tr><td>Module Management (includes all suboptions)<td>PM
|
||||
<tr><td>Massive Management Operations <td>AW
|
||||
<tr><td>Bulk Management Operations <td>AW
|
||||
<tr><td>Creating agents<td>AW
|
||||
<tr><td>Duplicating remote configurations<td>AW
|
||||
<tr><td>Downtime Management<td>AW
|
||||
|
@ -1589,8 +1589,14 @@ function show_menu(item, data) {
|
||||
name: interface_link_add,
|
||||
icon: "interface_link_children",
|
||||
disabled : function() {
|
||||
console.log(data);
|
||||
if (enterprise_installed) {
|
||||
return false;
|
||||
if (data.type == 3) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
@ -1657,7 +1663,12 @@ function show_menu(item, data) {
|
||||
icon: "interface_link_parent",
|
||||
disabled : function() {
|
||||
if (enterprise_installed) {
|
||||
return false;
|
||||
if (data.type == 3) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
@ -1681,7 +1692,12 @@ function show_menu(item, data) {
|
||||
icon: "interface_link_cancel",
|
||||
disabled : function() {
|
||||
if (enterprise_installed) {
|
||||
return false;
|
||||
if (data.type == 3) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
|
@ -4139,6 +4139,8 @@ div#main_help_new_content {
|
||||
padding-top: 10px;
|
||||
background: white;
|
||||
height: 100%;
|
||||
font-size: 12pt;
|
||||
font-family: 'lato-bolder';
|
||||
}
|
||||
|
||||
div#main_help_new_content h1 {
|
||||
@ -4150,6 +4152,15 @@ div#main_help_new_content p {
|
||||
font-family: 'lato-bolder';
|
||||
font-size: 12pt;
|
||||
}
|
||||
div#main_help_new_content b {
|
||||
font-family: 'lato-bolder';
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
div#main_help_new_content li {
|
||||
font-family: 'lato-bolder';
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
div#footer_help{
|
||||
background: #333;
|
||||
|
@ -2951,6 +2951,10 @@ table#policy_modules td * {
|
||||
border-top-right-radius: 2px;
|
||||
}
|
||||
|
||||
.clippy_body {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#dialog-double_auth-container {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
@ -71,7 +71,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.712';
|
||||
$build = '170907';
|
||||
$build = '170919';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -85,7 +85,7 @@ class Agent {
|
||||
$agent_id = $system->getRequest('agent_id', '0');
|
||||
$width = $system->getRequest('width', '400');
|
||||
graph_graphic_agentevents(
|
||||
$this->id, $width, 30, SECONDS_1DAY, ui_get_full_url(false));
|
||||
$agent_id, $width, 30, SECONDS_1DAY, ui_get_full_url(false));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ $data[0][0] .=
|
||||
<tr><th>' .
|
||||
__('Events (24h)') .
|
||||
'</th></tr>' .
|
||||
'<tr><td style="text-align:center;"><br />' .
|
||||
'<tr><td style="text-align:center;padding-left:20px;padding-right:20px;"><br />' .
|
||||
graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true, true) .
|
||||
'<br /></td></tr>' .
|
||||
'</table>';
|
||||
|
@ -213,6 +213,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||
$values = array();
|
||||
$values['name'] = $name;
|
||||
$values['id_group'] = $id_group;
|
||||
|
||||
/*
|
||||
if ($source == 'group') {
|
||||
$values['source'] = 0;
|
||||
$values['source_data'] = $id_group;
|
||||
@ -225,6 +227,32 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
||||
$values['source'] = 2;
|
||||
$values['source_data'] = $ip_mask;
|
||||
}
|
||||
*/
|
||||
|
||||
switch ($method) {
|
||||
case 'twopi':
|
||||
$values['generation_method'] = 2;
|
||||
break;
|
||||
case 'dot':
|
||||
$values['generation_method'] = 1;
|
||||
break;
|
||||
case 'circo':
|
||||
$values['generation_method'] = 0;
|
||||
break;
|
||||
case 'neato':
|
||||
$values['generation_method'] = 3;
|
||||
break;
|
||||
case 'fdp':
|
||||
$values['generation_method'] = 4;
|
||||
break;
|
||||
case 'radial_dinamic':
|
||||
$values['generation_method'] = 6;
|
||||
break;
|
||||
default:
|
||||
$values['generation_method'] = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
$description = get_parameter('description', '');
|
||||
$values['description'] = $description;
|
||||
|
||||
|
@ -756,6 +756,7 @@ else {
|
||||
}
|
||||
|
||||
$nodes_and_relations = networkmap_process_networkmap($id);
|
||||
|
||||
show_networkmap($id, $user_readonly, $nodes_and_relations, $dash_mode, $map_dash_details);
|
||||
}
|
||||
?>
|
||||
|
@ -561,9 +561,8 @@ $selectDataDown = '';
|
||||
$selectTimestampUp = '';
|
||||
$selectTimestampDown = '';
|
||||
$order = null;
|
||||
|
||||
switch ($sortField) {
|
||||
case 'agent_name':
|
||||
case 'agent_alias':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectAgentNameUp = $selected;
|
||||
|
@ -282,7 +282,12 @@ $ignored_params['refr'] = '';
|
||||
|
||||
$('.item:not(.icon) img:not(.b64img)').each( function() {
|
||||
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
|
||||
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
|
||||
if( $(this).parent()[0].tagName == 'DIV'){
|
||||
$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
|
||||
}
|
||||
else if ( $(this).parent()[0].tagName == 'A') {
|
||||
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
|
||||
}
|
||||
$(this).css('margin-left','');
|
||||
}
|
||||
else {
|
||||
@ -290,7 +295,12 @@ $ignored_params['refr'] = '';
|
||||
$(this).css('margin-left','');
|
||||
$(this).css('margin-top','');
|
||||
} else {
|
||||
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
|
||||
if( $(this).parent()[0].tagName == 'DIV'){
|
||||
$(this).css('margin-left',(parseInt($(this).parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
|
||||
}
|
||||
else if ( $(this).parent()[0].tagName == 'A') {
|
||||
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
|
||||
}
|
||||
$(this).css('margin-top','');
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.712
|
||||
%define release 170907
|
||||
%define release 170919
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.712
|
||||
%define release 170907
|
||||
%define release 170919
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -1355,6 +1355,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
|
||||
`label_position` varchar(50) NOT NULL default 'down',
|
||||
`border_color` varchar(200) DEFAULT "",
|
||||
`fill_color` varchar(200) DEFAULT "",
|
||||
`show_statistics` tinyint(2) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.712-170907
|
||||
Version: 7.0NG.712-170919
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.712-170907"
|
||||
pandora_version="7.0NG.712-170919"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -607,7 +607,10 @@ sub main() {
|
||||
$server->update();
|
||||
}
|
||||
|
||||
db_do ($DBH, "UPDATE tserver SET status = 0 WHERE now()-keepalive > 2*server_keepalive");
|
||||
db_do ($DBH,
|
||||
"UPDATE tserver SET status = 0
|
||||
WHERE UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(keepalive) > 2*server_keepalive"
|
||||
);
|
||||
|
||||
# Set the master server
|
||||
pandora_set_master(\%Config, $DBH);
|
||||
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.712";
|
||||
my $pandora_build = "170907";
|
||||
my $pandora_build = "170919";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -1110,8 +1110,10 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
|
||||
# Check for _module_graph_Xh_ macros
|
||||
# Check for _module_graph_Xh_ macros and _module_graphth_Xh_
|
||||
my $module_graph_list = {};
|
||||
my $macro_regexp = "_modulegraph_(\\d+)h_";
|
||||
my $macro_regexp2 = "_modulegraphth_(\\d+)h_";
|
||||
|
||||
# API connection
|
||||
my $ua = new LWP::UserAgent;
|
||||
@ -1124,13 +1126,21 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
$params->{"op"} = "get";
|
||||
$params->{"op2"} = "module_graph";
|
||||
$params->{"id"} = $module->{'id_agente_modulo'};
|
||||
|
||||
my $cid ='';
|
||||
my $subst_func = sub {
|
||||
my $hours = shift;
|
||||
my $threshold = shift;
|
||||
my $period = $hours * 3600; # Hours to seconds
|
||||
$params->{"other"} = $period . '%7C0';
|
||||
if($threshold == 0){
|
||||
$params->{"other"} = $period . '%7C0%7C0';
|
||||
$cid = 'module_graph_' . $hours . 'h';
|
||||
}
|
||||
else{
|
||||
$params->{"other"} = $period . '%7C0%7C1';
|
||||
$cid = 'module_graphth_' . $hours . 'h';
|
||||
}
|
||||
|
||||
$params->{"other_mode"} = 'url_encode_separator_%7C';
|
||||
my $cid = 'module_graph_' . $hours . 'h';
|
||||
|
||||
if (! exists($module_graph_list->{$cid}) && defined $url) {
|
||||
# Get the module graph image in base 64
|
||||
@ -1150,7 +1160,8 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
||||
eval {
|
||||
no warnings;
|
||||
local $SIG{__DIE__};
|
||||
$field3 =~ s/$macro_regexp/$subst_func->($1)/ige;
|
||||
$field3 =~ s/$macro_regexp/$subst_func->($1, 0)/ige;
|
||||
$field3 =~ s/$macro_regexp2/$subst_func->($1, 1)/ige;
|
||||
};
|
||||
|
||||
# Default content type
|
||||
|
@ -312,7 +312,7 @@ sub process_xml_data ($$$$$) {
|
||||
|
||||
# Check some variables
|
||||
$interval = 300 if (! defined ($interval) || $interval eq '');
|
||||
$os_version = 'N/A' if (! defined ($os_version) || $os_version eq '');
|
||||
$os_version = undef if (! defined ($os_version) || $os_version eq '');
|
||||
|
||||
# Get agent address from the XML if available
|
||||
my $address = '' ;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.712
|
||||
%define release 170907
|
||||
%define release 170919
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.712
|
||||
%define release 170907
|
||||
%define release 170919
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.712"
|
||||
PI_BUILD="170907"
|
||||
PI_BUILD="170919"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.712 PS170907";
|
||||
my $version = "7.0NG.712 PS170919";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
@ -93,7 +93,7 @@ sub pandora_purgedb ($$) {
|
||||
}
|
||||
|
||||
# Delete old inventory data
|
||||
if (defined($conf->{'_inventory_purge'}) && $conf->{'_inventory_purge'} > 0) {
|
||||
if (defined ($conf->{'_inventory_purge'}) && $conf->{'_inventory_purge'} > 0) {
|
||||
if (enterprise_load (\%conf) != 0) {
|
||||
my $ulimit_timestamp_inventory = time() - (86400 * $conf->{'_inventory_purge'});
|
||||
|
||||
@ -431,6 +431,9 @@ sub pandora_purgedb ($$) {
|
||||
WHERE date < CURDATE() - $conf->{'_num_past_special_days'} AND date > '0001-01-01'");
|
||||
}
|
||||
}
|
||||
|
||||
# Delete old tgraph_source data
|
||||
db_do ($dbh,"DELETE FROM tgraph_source WHERE id_graph NOT IN (SELECT id_graph FROM tgraph)");
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@ -609,6 +612,7 @@ sub pandora_load_config ($) {
|
||||
$conf->{'dbengine'} = 'mysql' unless defined ($conf->{'dbengine'});
|
||||
$conf->{'dbport'} = '3306' unless defined ($conf->{'dbport'});
|
||||
$conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'});
|
||||
$conf->{'verbosity'} = '3' unless defined ($conf->{'verbosity'});
|
||||
|
||||
# Dynamic interval configuration.
|
||||
$conf->{"dynamic_constant"} = 0.10 unless defined($conf->{"dynamic_constant"});
|
||||
@ -784,10 +788,10 @@ sub pandora_checkdb_consistency {
|
||||
log_message ('CHECKDB', "Ignoring not-init data.");
|
||||
}
|
||||
|
||||
log_message ('CHECKDB',
|
||||
"Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days).");
|
||||
|
||||
if (defined($conf{'_days_delete_unknown'}) && $conf{'_days_delete_unknown'} > 0) {
|
||||
log_message ('CHECKDB',
|
||||
"Deleting unknown data (More than " . $conf{'_days_delete_unknown'} . " days).");
|
||||
|
||||
my @modules = get_db_rows($dbh,
|
||||
'SELECT tagente_modulo.id_agente_modulo, tagente_modulo.id_agente
|
||||
FROM tagente_modulo, tagente_estado
|
||||
|
@ -21,6 +21,7 @@ use JSON qw(decode_json encode_json);
|
||||
use MIME::Base64;
|
||||
use Encode qw(decode encode_utf8);
|
||||
use LWP::Simple;
|
||||
use Data::Dumper;
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
@ -35,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.712 PS170907";
|
||||
my $version = "7.0NG.712 PS170919";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
@ -214,6 +215,15 @@ sub help_screen{
|
||||
help_screen_line('--add_tag_to_user_profile', '<user_id> <tag_name> <group_name> <profile_name>', 'Add a tag to the given user profile');
|
||||
help_screen_line('--add_tag_to_module', '<agent_name> <module_name> <tag_name>', 'Add a tag to the given module');
|
||||
|
||||
print "\nVISUAL CONSOLES\n\n" unless $param ne '';
|
||||
help_screen_line('--create_visual_console', '<name> <background> <width> <height> <group> <mode> [<position_to_locate_elements>] [<background_color>] [<elements>]', 'Create a new visual console');
|
||||
help_screen_line('--edit_visual_console', '<id> [<name>] [<background>] [<width>] [<height>] [<group>] [<mode>] [<position_to_locate_elements>] [<background_color>] [<elements>]', 'Edit a visual console');
|
||||
help_screen_line('--delete_visual_console', '<id>', 'Delete a visual console');
|
||||
help_screen_line('--delete_visual_console_objects', '<id> <mode> <id_mode>', 'Delete a visual console elements');
|
||||
help_screen_line('--duplicate_visual_console', '<id> <times> [<prefix>]', 'Duplicate a visual console');
|
||||
help_screen_line('--export_json_visual_console', '<id> [<path>]', 'Creates a json with the visual console elements information');
|
||||
|
||||
|
||||
print "\n";
|
||||
exit;
|
||||
}
|
||||
@ -4753,6 +4763,784 @@ sub cli_delete_special_day() {
|
||||
exist_check($result,'special day',$special_day);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Creates a new visual console.
|
||||
# Related option: --create_visual_console
|
||||
##############################################################################
|
||||
|
||||
sub cli_create_visual_console() {
|
||||
my ($name,$background,$width,$height,$group,$mode,$element_square_positions,$background_color,$elements) = @ARGV[2..10];
|
||||
|
||||
if($name eq '') {
|
||||
print_log "[ERROR] Name field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif ($background eq '') {
|
||||
print_log "[ERROR] Background field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif (($width eq '') || ($height eq '')) {
|
||||
print_log "[ERROR] Please specify size.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif ($group eq '') {
|
||||
print_log "[ERROR] Group field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif ($mode eq '') {
|
||||
print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ($background_color eq '') {
|
||||
$background_color = '#FFF';
|
||||
}
|
||||
|
||||
print_log "[INFO] Creating visual console '$name' \n\n";
|
||||
|
||||
my $vc_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color)
|
||||
VALUES (?, ?, ?, ?, ?, ?)', safe_input($name), $group, $background, $width, $height, $background_color);
|
||||
|
||||
print_log "[INFO] The visual console id is '$vc_id' \n\n";
|
||||
|
||||
if ($elements ne '') {
|
||||
my $elements_in_array = decode_json($elements);
|
||||
|
||||
if ($mode eq 'static_objects') {
|
||||
my $elem_count = 1;
|
||||
|
||||
foreach my $elem (@$elements_in_array) {
|
||||
my $pos_x = $elem->{'pos_x'};
|
||||
my $pos_y = $elem->{'pos_y'};
|
||||
my $width = $elem->{'width'};
|
||||
my $height = $elem->{'height'};
|
||||
my $label = $elem->{'label'};
|
||||
my $image = $elem->{'image'};
|
||||
my $type = $elem->{'type'};
|
||||
my $period = $elem->{'period'};
|
||||
my $id_agente_modulo = $elem->{'id_agente_modulo'};
|
||||
my $id_agent = $elem->{'id_agent'};
|
||||
my $id_layout_linked = $elem->{'id_layout_linked'};
|
||||
my $parent_item = $elem->{'parent_item'};
|
||||
my $enable_link = $elem->{'enable_link'};
|
||||
my $id_metaconsole = $elem->{'id_metaconsole'};
|
||||
my $id_group = $elem->{'id_group'};
|
||||
my $id_custom_graph = $elem->{'id_custom_graph'};
|
||||
my $border_width = $elem->{'border_width'};
|
||||
my $type_graph = $elem->{'type_graph'};
|
||||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
|
||||
my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
|
||||
print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n";
|
||||
|
||||
$elem_count++;
|
||||
}
|
||||
}
|
||||
elsif ($mode eq 'auto_creation') {
|
||||
if ($element_square_positions eq '') {
|
||||
print_log "[ERROR] With this mode, square positions is obligatory'.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
else {
|
||||
my $positions = decode_json($element_square_positions);
|
||||
|
||||
my $pos1X = $positions->{'pos1x'};
|
||||
my $pos1Y = $positions->{'pos1y'};
|
||||
my $pos2X = $positions->{'pos2x'};
|
||||
my $pos2Y = $positions->{'pos2y'};
|
||||
|
||||
my $number_of_elements = scalar(@$elements_in_array);
|
||||
|
||||
my $x_divider = 4;
|
||||
my $y_divider = 1;
|
||||
|
||||
for (my $i = 1; $i <= 1000; $i++) {
|
||||
if (($i * 4) < $number_of_elements) {
|
||||
$y_divider++;
|
||||
}
|
||||
else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $elem_width = ($pos2X - $pos1X) / $x_divider;
|
||||
my $elem_height = ($pos2Y - $pos1Y) / $y_divider;
|
||||
|
||||
if ($number_of_elements < 4) {
|
||||
$elem_height = ($pos2Y - $pos1Y) / 3;
|
||||
}
|
||||
|
||||
my $elem_count = 1;
|
||||
my $pos_helper_x = 0;
|
||||
my $pos_helper_y = 0;
|
||||
foreach my $elem (@$elements_in_array) {
|
||||
my $pos_x = $pos_helper_x * $elem_width;
|
||||
my $pos_y = $pos_helper_y * $elem_height;
|
||||
my $width = $elem_width;
|
||||
my $height = $elem_height;
|
||||
my $label = $elem->{'label'};
|
||||
my $image = $elem->{'image'};
|
||||
my $type = $elem->{'type'};
|
||||
my $period = $elem->{'period'};
|
||||
my $id_agente_modulo = $elem->{'id_agente_modulo'};
|
||||
my $id_agent = $elem->{'id_agent'};
|
||||
my $id_layout_linked = $elem->{'id_layout_linked'};
|
||||
my $parent_item = $elem->{'parent_item'};
|
||||
my $enable_link = $elem->{'enable_link'};
|
||||
my $id_metaconsole = $elem->{'id_metaconsole'};
|
||||
my $id_group = $elem->{'id_group'};
|
||||
my $id_custom_graph = $elem->{'id_custom_graph'};
|
||||
my $border_width = $elem->{'border_width'};
|
||||
my $type_graph = $elem->{'type_graph'};
|
||||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
|
||||
my $elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $vc_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
|
||||
print_log "[INFO] The element id in position $elem_count is '$elem_id' \n\n";
|
||||
|
||||
$elem_count++;
|
||||
|
||||
if ($pos_helper_x == 3) {
|
||||
$pos_helper_x = 0;
|
||||
$pos_helper_y++;
|
||||
}
|
||||
else {
|
||||
$pos_helper_x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Edit a visual console.
|
||||
# Related option: --edit_visual_console
|
||||
##############################################################################
|
||||
|
||||
sub cli_edit_visual_console() {
|
||||
my ($id,$name,$background,$width,$height,$group,$mode,$element_square_positions,$background_color,$elements) = @ARGV[2..11];
|
||||
|
||||
if($id eq '') {
|
||||
print_log "[ERROR] ID field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $console = get_db_single_row ($dbh, "SELECT *
|
||||
FROM tlayout
|
||||
WHERE id = $id");
|
||||
|
||||
my $new_name = $console->{'name'};
|
||||
my $new_background = $console->{'background'};
|
||||
my $new_console_width = $console->{'width'};
|
||||
my $new_console_height = $console->{'height'};
|
||||
my $new_console_id_group = $console->{'id_group'};
|
||||
my $new_background_color = $console->{'background_color'};
|
||||
|
||||
if($name ne '') {
|
||||
$new_name = $name;
|
||||
}
|
||||
if ($background ne '') {
|
||||
$new_background = $background;
|
||||
}
|
||||
if ($width ne '') {
|
||||
$new_console_width = $width;
|
||||
}
|
||||
if ($height ne '') {
|
||||
$new_console_height = $height;
|
||||
}
|
||||
if ($group ne '') {
|
||||
$new_console_id_group = $group;
|
||||
}
|
||||
if ($background_color ne '') {
|
||||
$new_background_color = $background_color;
|
||||
}
|
||||
|
||||
print_log "[INFO] The visual console with id $id is updated \n\n";
|
||||
|
||||
db_update ($dbh, "UPDATE tlayout SET name = '" . $new_name . "', background = '" . $new_background . "', width = " . $new_console_width . ", height = " . $new_console_height . ", id_group = " . $new_console_id_group . ", background_color = '" . $new_background_color . "' WHERE id = " . $id);
|
||||
|
||||
if ($elements ne '') {
|
||||
my $elements_in_array = decode_json($elements);
|
||||
|
||||
if ($mode eq 'static_objects') {
|
||||
foreach my $elem (@$elements_in_array) {
|
||||
if (defined($elem->{'id'})) {
|
||||
|
||||
print_log "[INFO] Edit element with id " . $elem->{'id'} . " \n\n";
|
||||
|
||||
my $element_in_db = get_db_single_row ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id = " . $elem->{'id'});
|
||||
|
||||
my $new_pos_x = $element_in_db->{'pos_x'};
|
||||
my $new_pos_y = $element_in_db->{'pos_y'};
|
||||
my $new_width = $element_in_db->{'width'};
|
||||
my $new_height = $element_in_db->{'height'};
|
||||
my $new_label = $element_in_db->{'label'};
|
||||
my $new_image = $element_in_db->{'image'};
|
||||
my $new_type = $element_in_db->{'type'};
|
||||
my $new_period = $element_in_db->{'period'};
|
||||
my $new_id_agente_modulo = $element_in_db->{'id_agente_modulo'};
|
||||
my $new_id_agent = $element_in_db->{'id_agent'};
|
||||
my $new_id_layout_linked = $element_in_db->{'id_layout_linked'};
|
||||
my $new_parent_item = $element_in_db->{'parent_item'};
|
||||
my $new_enable_link = $element_in_db->{'enable_link'};
|
||||
my $new_id_metaconsole = $element_in_db->{'id_metaconsole'};
|
||||
my $new_id_group = $element_in_db->{'id_group'};
|
||||
my $new_id_custom_graph = $element_in_db->{'id_custom_graph'};
|
||||
my $new_border_width = $element_in_db->{'border_width'};
|
||||
my $new_type_graph = $element_in_db->{'type_graph'};
|
||||
my $new_label_position = $element_in_db->{'label_position'};
|
||||
my $new_border_color = $element_in_db->{'border_color'};
|
||||
my $new_fill_color = $element_in_db->{'fill_color'};
|
||||
|
||||
if(defined($elem->{'pos_x'})) {
|
||||
$new_pos_x = $elem->{'pos_x'};
|
||||
}
|
||||
if(defined($elem->{'pos_y'})) {
|
||||
$new_pos_y = $elem->{'pos_y'};
|
||||
}
|
||||
if(defined($elem->{'width'})) {
|
||||
$new_width = $elem->{'width'};
|
||||
}
|
||||
if(defined($elem->{'height'})) {
|
||||
$new_height = $elem->{'height'};
|
||||
}
|
||||
if(defined($elem->{'label'})) {
|
||||
$new_label = $elem->{'label'};
|
||||
}
|
||||
if(defined($elem->{'image'})) {
|
||||
$new_image = $elem->{'image'};
|
||||
}
|
||||
if(defined($elem->{'type'})) {
|
||||
$new_type = $elem->{'type'};
|
||||
}
|
||||
if(defined($elem->{'period'})) {
|
||||
$new_period = $elem->{'period'};
|
||||
}
|
||||
if(defined($elem->{'id_agente_modulo'})) {
|
||||
$new_id_agente_modulo = $elem->{'id_agente_modulo'};
|
||||
}
|
||||
if(defined($elem->{'id_agent'})) {
|
||||
$new_id_agent = $elem->{'id_agent'};
|
||||
}
|
||||
if(defined($elem->{'id_layout_linked'})) {
|
||||
$new_id_layout_linked = $elem->{'id_layout_linked'};
|
||||
}
|
||||
if(defined($elem->{'parent_item'})) {
|
||||
$new_parent_item = $elem->{'parent_item'};
|
||||
}
|
||||
if(defined($elem->{'enable_link'})) {
|
||||
$new_enable_link = $elem->{'enable_link'};
|
||||
}
|
||||
if(defined($elem->{'id_metaconsole'})) {
|
||||
$new_id_metaconsole = $elem->{'id_metaconsole'};
|
||||
}
|
||||
if(defined($elem->{'id_group'})) {
|
||||
$new_id_group = $elem->{'id_group'};
|
||||
}
|
||||
if(defined($elem->{'id_custom_graph'})) {
|
||||
$new_id_custom_graph = $elem->{'id_custom_graph'};
|
||||
}
|
||||
if(defined($elem->{'border_width'})) {
|
||||
$new_border_width = $elem->{'border_width'};
|
||||
}
|
||||
if(defined($elem->{'type_graph'})) {
|
||||
$new_type_graph = $elem->{'type_graph'};
|
||||
}
|
||||
if(defined($elem->{'label_position'})) {
|
||||
$new_label_position = $elem->{'label_position'};
|
||||
}
|
||||
if(defined($elem->{'border_color'})) {
|
||||
$new_border_color = $elem->{'border_color'};
|
||||
}
|
||||
if(defined($elem->{'fill_color'})) {
|
||||
$new_fill_color = $elem->{'fill_color'};
|
||||
}
|
||||
|
||||
db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width .
|
||||
", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image .
|
||||
"', type = " . $new_type . ", period = " . $new_period . ", id_agente_modulo = " . $new_id_agente_modulo .
|
||||
", id_agent = " . $new_id_agent . ", id_layout_linked = " . $new_id_layout_linked . ", parent_item = " . $new_parent_item .
|
||||
", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group .
|
||||
", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph .
|
||||
"', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color .
|
||||
"' WHERE id = " . $elem->{'id'});
|
||||
|
||||
print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n";
|
||||
}
|
||||
else {
|
||||
my $pos_x = $elem->{'pos_x'};
|
||||
my $pos_y = $elem->{'pos_y'};
|
||||
my $width = $elem->{'width'};
|
||||
my $height = $elem->{'height'};
|
||||
my $label = $elem->{'label'};
|
||||
my $image = $elem->{'image'};
|
||||
my $type = $elem->{'type'};
|
||||
my $period = $elem->{'period'};
|
||||
my $id_agente_modulo = $elem->{'id_agente_modulo'};
|
||||
my $id_agent = $elem->{'id_agent'};
|
||||
my $id_layout_linked = $elem->{'id_layout_linked'};
|
||||
my $parent_item = $elem->{'parent_item'};
|
||||
my $enable_link = $elem->{'enable_link'};
|
||||
my $id_metaconsole = $elem->{'id_metaconsole'};
|
||||
my $id_group = $elem->{'id_group'};
|
||||
my $id_custom_graph = $elem->{'id_custom_graph'};
|
||||
my $border_width = $elem->{'border_width'};
|
||||
my $type_graph = $elem->{'type_graph'};
|
||||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
|
||||
my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
|
||||
print_log "[INFO] New element with id $new_elem_id has been created \n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($mode eq 'auto_creation') {
|
||||
if ($element_square_positions eq '') {
|
||||
print_log "[ERROR] With this mode, square positions is obligatory'.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
else {
|
||||
foreach my $elem (@$elements_in_array) {
|
||||
if (defined($elem->{'id'})) {
|
||||
print_log "[INFO] Edit element with id " . $elem->{'id'} . " \n\n";
|
||||
|
||||
my $element_in_db = get_db_single_row ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id = " . $elem->{'id'});
|
||||
|
||||
my $new_pos_x = $element_in_db->{'pos_x'};
|
||||
my $new_pos_y = $element_in_db->{'pos_y'};
|
||||
my $new_width = $element_in_db->{'width'};
|
||||
my $new_height = $element_in_db->{'height'};
|
||||
my $new_label = $element_in_db->{'label'};
|
||||
my $new_image = $element_in_db->{'image'};
|
||||
my $new_type = $element_in_db->{'type'};
|
||||
my $new_period = $element_in_db->{'period'};
|
||||
my $new_id_agente_modulo = $element_in_db->{'id_agente_modulo'};
|
||||
my $new_id_agent = $element_in_db->{'id_agent'};
|
||||
my $new_id_layout_linked = $element_in_db->{'id_layout_linked'};
|
||||
my $new_parent_item = $element_in_db->{'parent_item'};
|
||||
my $new_enable_link = $element_in_db->{'enable_link'};
|
||||
my $new_id_metaconsole = $element_in_db->{'id_metaconsole'};
|
||||
my $new_id_group = $element_in_db->{'id_group'};
|
||||
my $new_id_custom_graph = $element_in_db->{'id_custom_graph'};
|
||||
my $new_border_width = $element_in_db->{'border_width'};
|
||||
my $new_type_graph = $element_in_db->{'type_graph'};
|
||||
my $new_label_position = $element_in_db->{'label_position'};
|
||||
my $new_border_color = $element_in_db->{'border_color'};
|
||||
my $new_fill_color = $element_in_db->{'fill_color'};
|
||||
|
||||
if(defined($elem->{'width'})) {
|
||||
$new_width = $elem->{'width'};
|
||||
}
|
||||
if(defined($elem->{'height'})) {
|
||||
$new_height = $elem->{'height'};
|
||||
}
|
||||
if(defined($elem->{'label'})) {
|
||||
$new_label = $elem->{'label'};
|
||||
}
|
||||
if(defined($elem->{'image'})) {
|
||||
$new_image = $elem->{'image'};
|
||||
}
|
||||
if(defined($elem->{'type'})) {
|
||||
$new_type = $elem->{'type'};
|
||||
}
|
||||
if(defined($elem->{'period'})) {
|
||||
$new_period = $elem->{'period'};
|
||||
}
|
||||
if(defined($elem->{'id_agente_modulo'})) {
|
||||
$new_id_agente_modulo = $elem->{'id_agente_modulo'};
|
||||
}
|
||||
if(defined($elem->{'id_agent'})) {
|
||||
$new_id_agent = $elem->{'id_agent'};
|
||||
}
|
||||
if(defined($elem->{'id_layout_linked'})) {
|
||||
$new_id_layout_linked = $elem->{'id_layout_linked'};
|
||||
}
|
||||
if(defined($elem->{'parent_item'})) {
|
||||
$new_parent_item = $elem->{'parent_item'};
|
||||
}
|
||||
if(defined($elem->{'enable_link'})) {
|
||||
$new_enable_link = $elem->{'enable_link'};
|
||||
}
|
||||
if(defined($elem->{'id_metaconsole'})) {
|
||||
$new_id_metaconsole = $elem->{'id_metaconsole'};
|
||||
}
|
||||
if(defined($elem->{'id_group'})) {
|
||||
$new_id_group = $elem->{'id_group'};
|
||||
}
|
||||
if(defined($elem->{'id_custom_graph'})) {
|
||||
$new_id_custom_graph = $elem->{'id_custom_graph'};
|
||||
}
|
||||
if(defined($elem->{'border_width'})) {
|
||||
$new_border_width = $elem->{'border_width'};
|
||||
}
|
||||
if(defined($elem->{'type_graph'})) {
|
||||
$new_type_graph = $elem->{'type_graph'};
|
||||
}
|
||||
if(defined($elem->{'label_position'})) {
|
||||
$new_label_position = $elem->{'label_position'};
|
||||
}
|
||||
if(defined($elem->{'border_color'})) {
|
||||
$new_border_color = $elem->{'border_color'};
|
||||
}
|
||||
if(defined($elem->{'fill_color'})) {
|
||||
$new_fill_color = $elem->{'fill_color'};
|
||||
}
|
||||
|
||||
db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y . ", width = " . $new_width .
|
||||
", height = " . $new_height . ", label = '" . $new_label . "', image = '" . $new_image .
|
||||
"', type = " . $new_type . ", period = " . $new_period . ", id_agente_modulo = " . $new_id_agente_modulo .
|
||||
", id_agent = " . $new_id_agent . ", id_layout_linked = " . $new_id_layout_linked . ", parent_item = " . $new_parent_item .
|
||||
", enable_link = " . $new_enable_link . ", id_metaconsole = " . $new_id_metaconsole . ", id_group = " . $new_id_group .
|
||||
", id_custom_graph = " . $new_id_custom_graph . ", border_width = " . $new_border_width . ", type_graph = '" . $new_type_graph .
|
||||
"', label_position = '" . $new_label_position . "', border_color = '" . $new_border_color . "', fill_color = '" . $new_fill_color .
|
||||
"' WHERE id = " . $elem->{'id'});
|
||||
|
||||
print_log "[INFO] Element with id " . $elem->{'id'} . " has been updated \n\n";
|
||||
}
|
||||
else {
|
||||
my $pos_x = 0;
|
||||
my $pos_y = 0;
|
||||
my $width = $elem->{'width'};
|
||||
my $height = $elem->{'height'};
|
||||
my $label = $elem->{'label'};
|
||||
my $image = $elem->{'image'};
|
||||
my $type = $elem->{'type'};
|
||||
my $period = $elem->{'period'};
|
||||
my $id_agente_modulo = $elem->{'id_agente_modulo'};
|
||||
my $id_agent = $elem->{'id_agent'};
|
||||
my $id_layout_linked = $elem->{'id_layout_linked'};
|
||||
my $parent_item = $elem->{'parent_item'};
|
||||
my $enable_link = $elem->{'enable_link'};
|
||||
my $id_metaconsole = $elem->{'id_metaconsole'};
|
||||
my $id_group = $elem->{'id_group'};
|
||||
my $id_custom_graph = $elem->{'id_custom_graph'};
|
||||
my $border_width = $elem->{'border_width'};
|
||||
my $type_graph = $elem->{'type_graph'};
|
||||
my $label_position = $elem->{'label_position'};
|
||||
my $border_color = $elem->{'border_color'};
|
||||
my $fill_color = $elem->{'fill_color'};
|
||||
|
||||
my $new_elem_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
|
||||
print_log "[INFO] New element with id $new_elem_id has been created \n\n";
|
||||
}
|
||||
}
|
||||
|
||||
my $positions = decode_json($element_square_positions);
|
||||
|
||||
my $pos1X = $positions->{'pos1x'};
|
||||
my $pos1Y = $positions->{'pos1y'};
|
||||
my $pos2X = $positions->{'pos2x'};
|
||||
my $pos2Y = $positions->{'pos2y'};
|
||||
|
||||
my @console_elements = get_db_rows ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id_layout = $id");
|
||||
|
||||
my $number_of_elements = scalar(@console_elements);
|
||||
|
||||
my $x_divider = 4;
|
||||
my $y_divider = 1;
|
||||
|
||||
for (my $i = 1; $i <= 1000; $i++) {
|
||||
if (($i * 4) < $number_of_elements) {
|
||||
$y_divider++;
|
||||
}
|
||||
else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $elem_width = ($pos2X - $pos1X) / $x_divider;
|
||||
my $elem_height = ($pos2Y - $pos1Y) / $y_divider;
|
||||
|
||||
if ($number_of_elements < 4) {
|
||||
$elem_height = ($pos2Y - $pos1Y) / 3;
|
||||
}
|
||||
|
||||
my $elem_count = 1;
|
||||
my $pos_helper_x = 0;
|
||||
my $pos_helper_y = 0;
|
||||
foreach my $elem (@console_elements) {
|
||||
my $new_pos_x = $pos_helper_x * $elem_width;
|
||||
my $new_pos_y = $pos_helper_y * $elem_height;
|
||||
my $new_elem_width = $elem_width;
|
||||
my $new_elem_height = $elem_height;
|
||||
|
||||
db_update ($dbh, "UPDATE tlayout_data SET pos_x = " . $new_pos_x . ", pos_y = " . $new_pos_y .
|
||||
", width = " . $new_elem_width . ", height = " . $new_elem_height .
|
||||
" WHERE id = " . $elem->{'id'});
|
||||
|
||||
print_log "[INFO] Recolocate element with id " . $elem->{'id'} . " \n\n";
|
||||
|
||||
$elem_count++;
|
||||
|
||||
if ($pos_helper_x == 3) {
|
||||
$pos_helper_x = 0;
|
||||
$pos_helper_y++;
|
||||
}
|
||||
else {
|
||||
$pos_helper_x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Mode parameter must be 'static_objects' or 'auto_creation'.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Delete a visual console.
|
||||
# Related option: --delete_visual_console
|
||||
##############################################################################
|
||||
|
||||
sub cli_delete_visual_console() {
|
||||
my ($id) = @ARGV[2];
|
||||
|
||||
if($id eq '') {
|
||||
print_log "[ERROR] ID field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print_log "[INFO] Delete visual console with ID '$id' \n\n";
|
||||
|
||||
my $delete_layout = db_do($dbh, 'DELETE FROM tlayout WHERE id = ?', $id);
|
||||
|
||||
if ($delete_layout eq 1) {
|
||||
db_do($dbh, 'DELETE FROM tlayout_data WHERE id_layout = ?', $id);
|
||||
|
||||
print_log "[INFO] Delete visual console elements with console ID '$id' \n\n";
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Error at remove the visual console.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Delete a visual console objects.
|
||||
# Related option: --delete_visual_console_objects
|
||||
##############################################################################
|
||||
|
||||
sub cli_delete_visual_console_objects() {
|
||||
my ($id_console,$mode,$id_mode) = @ARGV[2..4];
|
||||
|
||||
if($id_console eq '') {
|
||||
print_log "[ERROR] Console ID field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif ($mode eq '') {
|
||||
print_log "[ERROR] Mode field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
elsif ($id_mode eq '') {
|
||||
print_log "[ERROR] Mode index field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (($mode eq 'type') || ($mode eq 'image') || ($mode eq 'id_agent') ||
|
||||
($mode eq 'id_agente_modulo') || ($mode eq 'id_group') || ($mode eq 'type_graph')) {
|
||||
print_log "[INFO] Removind objects with mode '$mode' and id '$id_mode' \n\n";
|
||||
|
||||
db_do($dbh, 'DELETE FROM tlayout_data WHERE id_layout = ' . $id_console . ' AND ' . $mode . ' = "' . $id_mode . '"');
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Mode is not correct.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Duplicate a visual console.
|
||||
# Related option: --duplicate_visual_console
|
||||
##############################################################################
|
||||
|
||||
sub cli_duplicate_visual_console () {
|
||||
my ($id_console,$prefix) = @ARGV[2..3];
|
||||
|
||||
if($id_console eq '') {
|
||||
print_log "[ERROR] Console ID field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $console = get_db_single_row ($dbh, "SELECT *
|
||||
FROM tlayout
|
||||
WHERE id = $id_console");
|
||||
|
||||
my $name_to_compare = $console->{'name'};
|
||||
my $new_name = $console->{'name'} . "_1";
|
||||
my $name_count = 2;
|
||||
|
||||
if ($prefix ne '') {
|
||||
$new_name = $prefix;
|
||||
$name_to_compare = $prefix;
|
||||
$name_count = 1;
|
||||
}
|
||||
|
||||
my $exist = 1;
|
||||
while ($exist == 1) {
|
||||
my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'");
|
||||
|
||||
if (defined($name_in_db->{'name'}) && ($name_in_db->{'name'} eq $new_name)) {
|
||||
$new_name = $name_to_compare . "_" . $name_count;
|
||||
$name_count++;
|
||||
}
|
||||
else {
|
||||
$exist = 0;
|
||||
}
|
||||
}
|
||||
|
||||
my $new_console_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color)
|
||||
VALUES (?, ?, ?, ?, ?, ?)', $new_name, $console->{'id_group'}, $console->{'background'}, $console->{'width'}, $console->{'height'}, $console->{'background_color'});
|
||||
|
||||
print_log "[INFO] The new visual console '$new_name' has been created. The new ID is '$new_console_id' \n\n";
|
||||
|
||||
my @console_elements = get_db_rows ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id_layout = $id_console");
|
||||
|
||||
foreach my $element (@console_elements) {
|
||||
my $pos_x = $element->{'pos_x'};
|
||||
my $pos_y = $element->{'pos_y'};
|
||||
my $width = $element->{'width'};
|
||||
my $height = $element->{'height'};
|
||||
my $label = $element->{'label'};
|
||||
my $image = $element->{'image'};
|
||||
my $type = $element->{'type'};
|
||||
my $period = $element->{'period'};
|
||||
my $id_agente_modulo = $element->{'id_agente_modulo'};
|
||||
my $id_agent = $element->{'id_agent'};
|
||||
my $id_layout_linked = $element->{'id_layout_linked'};
|
||||
my $parent_item = $element->{'parent_item'};
|
||||
my $enable_link = $element->{'enable_link'};
|
||||
my $id_metaconsole = $element->{'id_metaconsole'};
|
||||
my $id_group = $element->{'id_group'};
|
||||
my $id_custom_graph = $element->{'id_custom_graph'};
|
||||
my $border_width = $element->{'border_width'};
|
||||
my $type_graph = $element->{'type_graph'};
|
||||
my $label_position = $element->{'label_position'};
|
||||
my $border_color = $element->{'border_color'};
|
||||
my $fill_color = $element->{'fill_color'};
|
||||
|
||||
my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
|
||||
print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Export a visual console elements to json.
|
||||
# Related option: --export_json_visual_console
|
||||
##############################################################################
|
||||
|
||||
sub cli_export_visual_console() {
|
||||
my ($id,$path) = @ARGV[2..3];
|
||||
|
||||
if($id eq '') {
|
||||
print_log "[ERROR] ID field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print_log "[INFO] Exporting visual console elements with ID '$id' \n\n";
|
||||
|
||||
my @console_elements = get_db_rows ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id_layout = $id");
|
||||
|
||||
my $data_to_json = '[';
|
||||
my $first = 1;
|
||||
|
||||
foreach my $element (@console_elements) {
|
||||
my $pos_x = $element->{'pos_x'};
|
||||
my $pos_y = $element->{'pos_y'};
|
||||
my $width = $element->{'width'};
|
||||
my $height = $element->{'height'};
|
||||
my $label = $element->{'label'};
|
||||
my $image = $element->{'image'};
|
||||
my $type = $element->{'type'};
|
||||
my $period = $element->{'period'};
|
||||
my $id_agente_modulo = $element->{'id_agente_modulo'};
|
||||
my $id_agent = $element->{'id_agent'};
|
||||
my $id_layout_linked = $element->{'id_layout_linked'};
|
||||
my $parent_item = $element->{'parent_item'};
|
||||
my $enable_link = $element->{'enable_link'};
|
||||
my $id_metaconsole = $element->{'id_metaconsole'};
|
||||
my $id_group = $element->{'id_group'};
|
||||
my $id_custom_graph = $element->{'id_custom_graph'};
|
||||
my $border_width = $element->{'border_width'};
|
||||
my $type_graph = $element->{'type_graph'};
|
||||
my $label_position = $element->{'label_position'};
|
||||
my $border_color = $element->{'border_color'};
|
||||
my $fill_color = $element->{'fill_color'};
|
||||
|
||||
if ($first == 0) {
|
||||
$data_to_json .= ','
|
||||
}
|
||||
else {
|
||||
$first = 0;
|
||||
}
|
||||
|
||||
$data_to_json .= '{"image":"' . $image . '"';
|
||||
$data_to_json .= ',"pos_y":' . $pos_y;
|
||||
$data_to_json .= ',"pos_x":' . $pos_x;
|
||||
$data_to_json .= ',"width":' . $width;
|
||||
$data_to_json .= ',"height":' . $height;
|
||||
$data_to_json .= ',"label":"' . $label . '"';
|
||||
$data_to_json .= ',"type":' . $type;
|
||||
$data_to_json .= ',"period":' . $period;
|
||||
$data_to_json .= ',"id_agente_modulo":' . $id_agente_modulo;
|
||||
$data_to_json .= ',"id_agent":' . $id_agent;
|
||||
$data_to_json .= ',"id_layout_linked":' . $id_layout_linked;
|
||||
$data_to_json .= ',"parent_item":' . $parent_item;
|
||||
$data_to_json .= ',"enable_link":' . $enable_link;
|
||||
$data_to_json .= ',"id_metaconsole":' . $id_metaconsole;
|
||||
$data_to_json .= ',"id_group":' . $id_group;
|
||||
$data_to_json .= ',"id_custom_graph":' . $id_custom_graph;
|
||||
$data_to_json .= ',"border_width":' . $border_width;
|
||||
$data_to_json .= ',"type_graph":"' . $type_graph . '"';
|
||||
$data_to_json .= ',"label_position":"' . $label_position . '"';
|
||||
$data_to_json .= ',"border_color":"' . $border_color . '"';
|
||||
$data_to_json .= ',"fill_color":"' . $fill_color . '"';
|
||||
$data_to_json .= '}';
|
||||
}
|
||||
|
||||
$data_to_json .= ']';
|
||||
|
||||
if ($path eq '') {
|
||||
open(FicheroJSON, ">console_" . $id . "_elements");
|
||||
}
|
||||
else {
|
||||
open(FicheroJSON, ">" . $path . "/console_" . $id . "_elements");
|
||||
}
|
||||
|
||||
print FicheroJSON $data_to_json;
|
||||
|
||||
print_log "[INFO] JSON file now contents: \n" . $data_to_json . "\n\n";
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
@ -5184,6 +5972,30 @@ sub pandora_manage_main ($$$) {
|
||||
param_check($ltotal, 1);
|
||||
cli_locate_agent();
|
||||
}
|
||||
elsif ($param eq '--create_visual_console') {
|
||||
param_check($ltotal, 9, 3);
|
||||
cli_create_visual_console();
|
||||
}
|
||||
elsif ($param eq '--edit_visual_console') {
|
||||
param_check($ltotal, 10, 9);
|
||||
cli_edit_visual_console();
|
||||
}
|
||||
elsif ($param eq '--delete_visual_console') {
|
||||
param_check($ltotal, 1);
|
||||
cli_delete_visual_console();
|
||||
}
|
||||
elsif ($param eq '--delete_visual_console_objects') {
|
||||
param_check($ltotal, 3);
|
||||
cli_delete_visual_console_objects();
|
||||
}
|
||||
elsif ($param eq '--duplicate_visual_console') {
|
||||
param_check($ltotal, 2, 1);
|
||||
cli_duplicate_visual_console();
|
||||
}
|
||||
elsif ($param eq '--export_json_visual_console') {
|
||||
param_check($ltotal, 2, 1);
|
||||
cli_export_visual_console();
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Invalid option '$param'.\n\n";
|
||||
$param = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user