Merge remote-tracking branch 'origin/develop' into ent-6384-consola-visual-nuevo-elemento-interfaz-de-red
This commit is contained in:
commit
326d1dac49
|
@ -31,4 +31,6 @@ ALTER TABLE `treport` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
|||
ALTER TABLE `treport_template` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport_template` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
UPDATE `tconfig` SET value = '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}' WHERE token = 'post_process_custom_values';
|
||||
|
||||
COMMIT;
|
|
@ -1405,6 +1405,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_type', '');
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
|
|
|
@ -149,7 +149,7 @@ if (is_ajax()) {
|
|||
|
||||
ui_require_javascript_file('openlayers.pandora');
|
||||
|
||||
$new_agent = (bool) get_parameter('new_agent');
|
||||
$new_agent = (empty($id_agente)) ? true : false;
|
||||
|
||||
if (! isset($id_agente) && ! $new_agent) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access agent manager witout an agent');
|
||||
|
@ -1222,6 +1222,7 @@ ui_require_jquery_file('bgiframe');
|
|||
|
||||
$(document).ready (function() {
|
||||
|
||||
var $id_agent = '<?php echo $id_agente; ?>';
|
||||
var previous_primary_group_select;
|
||||
$("#grupo").on('focus', function () {
|
||||
previous_primary_group_select = this.value;
|
||||
|
@ -1276,12 +1277,14 @@ ui_require_jquery_file('bgiframe');
|
|||
}
|
||||
});
|
||||
|
||||
paint_qrcode(
|
||||
"<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>",
|
||||
"#qr_code_agent_view",
|
||||
128,
|
||||
128
|
||||
);
|
||||
if (typeof $id_agent !== 'undefined' && $id_agent !== '0') {
|
||||
paint_qrcode(
|
||||
"<?php echo ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente); ?>",
|
||||
"#qr_code_agent_view",
|
||||
128,
|
||||
128
|
||||
);
|
||||
}
|
||||
$("#text-agente").prop('readonly', true);
|
||||
|
||||
});
|
||||
|
|
|
@ -754,7 +754,6 @@ if (check_acl($config['id_user'], 0, 'AW')) {
|
|||
// Create agent button.
|
||||
echo '<div style="text-align: right;">';
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
html_print_input_hidden('new_agent', 1);
|
||||
html_print_submit_button(
|
||||
__('Create agent'),
|
||||
'crt-2',
|
||||
|
|
|
@ -115,7 +115,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
|||
$return_all_group,
|
||||
'ag_group',
|
||||
$ag_group,
|
||||
'this.form.submit();',
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
false,
|
||||
|
@ -126,7 +126,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
|||
);
|
||||
echo "</li></ul></li><li class='second_elements'><ul><li>";
|
||||
echo __('Group Recursion');
|
||||
html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()');
|
||||
html_print_checkbox('recursion', 1, $recursion, false, false, '');
|
||||
echo '</li><li>';
|
||||
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
echo '</li></ul></li></ul>';
|
||||
|
|
|
@ -140,7 +140,7 @@ if (isset($_GET['server'])) {
|
|||
ui_print_error_message(__('There was a problem deleting the server'));
|
||||
}
|
||||
} else if (isset($_GET['update'])) {
|
||||
$address = trim(get_parameter_post('address'), ' ');
|
||||
$address = trim(io_safe_output(get_parameter_post('address')), ' ');
|
||||
$description = trim(get_parameter_post('description'), ' ');
|
||||
$id_server = get_parameter_post('server');
|
||||
$exec_proxy = get_parameter_post('exec_proxy');
|
||||
|
|
|
@ -2871,17 +2871,8 @@ function alerts_get_agent_modules(
|
|||
);
|
||||
$agent_modules = db_get_all_rows_sql($sql);
|
||||
} else {
|
||||
$groups = groups_get_children($id_grupo, true);
|
||||
if (empty($groups) === false) {
|
||||
$groups = array_reduce(
|
||||
$groups,
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item['id_grupo'];
|
||||
return $carry;
|
||||
},
|
||||
[$id_grupo]
|
||||
);
|
||||
|
||||
$groups = groups_get_children_ids($id_grupo, true);
|
||||
if (count($groups) > 1) {
|
||||
$sql = sprintf(
|
||||
'SELECT distinct(atm.id_agent_module)
|
||||
FROM talert_template_modules atm
|
||||
|
|
|
@ -3682,6 +3682,38 @@ function events_get_response_target(
|
|||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
$target = io_safe_output($event_response['target']);
|
||||
|
||||
if (strpos($target, '_agent_alias_') !== false) {
|
||||
if ($meta) {
|
||||
$agente_table_name = 'tmetaconsole_agent';
|
||||
$filter = [
|
||||
'id_tagente' => $event['id_agente'],
|
||||
'id_tmetaconsole_setup' => $server_id,
|
||||
];
|
||||
} else {
|
||||
$agente_table_name = 'tagente';
|
||||
$filter = ['id_agente' => $event['id_agente']];
|
||||
}
|
||||
|
||||
$alias = db_get_value_filter('alias', $agente_table_name, $filter);
|
||||
$target = str_replace('_agent_alias_', io_safe_output($alias), $target);
|
||||
}
|
||||
|
||||
if (strpos($target, '_agent_name_') !== false) {
|
||||
if ($meta) {
|
||||
$agente_table_name = 'tmetaconsole_agent';
|
||||
$filter = [
|
||||
'id_tagente' => $event['id_agente'],
|
||||
'id_tmetaconsole_setup' => $server_id,
|
||||
];
|
||||
} else {
|
||||
$agente_table_name = 'tagente';
|
||||
$filter = ['id_agente' => $event['id_agente']];
|
||||
}
|
||||
|
||||
$name = db_get_value_filter('nombre', $agente_table_name, $filter);
|
||||
$target = str_replace('_agent_name_', io_safe_output($name), $target);
|
||||
}
|
||||
|
||||
// Substitute each macro.
|
||||
if (strpos($target, '_agent_address_') !== false) {
|
||||
if ($meta) {
|
||||
|
|
|
@ -2972,7 +2972,11 @@ function reporting_group_report($report, $content)
|
|||
|
||||
$return['data']['count_events'] = count($events);
|
||||
|
||||
$return['data']['group_stats'] = reporting_get_group_stats($content['id_group']);
|
||||
$return['data']['group_stats'] = reporting_get_group_stats(
|
||||
$content['id_group'],
|
||||
'AR',
|
||||
(bool) $content['recursion']
|
||||
);
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
metaconsole_restore_db();
|
||||
|
@ -9066,7 +9070,7 @@ function reporting_get_agents_detailed_event(
|
|||
*
|
||||
* @return array Group statistics
|
||||
*/
|
||||
function reporting_get_group_stats($id_group=0, $access='AR')
|
||||
function reporting_get_group_stats($id_group=0, $access='AR', $recursion=true)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -9168,16 +9172,19 @@ function reporting_get_group_stats($id_group=0, $access='AR')
|
|||
// Store the groups where we are quering
|
||||
$covered_groups = [];
|
||||
$group_array = [];
|
||||
foreach ($id_group as $group) {
|
||||
$children = groups_get_children($group);
|
||||
|
||||
// Show empty groups only if they have children with agents
|
||||
// $group_array = array();
|
||||
foreach ($children as $sub) {
|
||||
// If the group is quering previously, we ingore it
|
||||
if (!in_array($sub['id_grupo'], $covered_groups)) {
|
||||
array_push($covered_groups, $sub['id_grupo']);
|
||||
array_push($group_array, $sub['id_grupo']);
|
||||
foreach ($id_group as $group) {
|
||||
if ($recursion === true) {
|
||||
$children = groups_get_children($group);
|
||||
|
||||
// Show empty groups only if they have children with agents
|
||||
// $group_array = array();
|
||||
foreach ($children as $sub) {
|
||||
// If the group is quering previously, we ingore it
|
||||
if (!in_array($sub['id_grupo'], $covered_groups)) {
|
||||
array_push($covered_groups, $sub['id_grupo']);
|
||||
array_push($group_array, $sub['id_grupo']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,425 +1,424 @@
|
|||
(function ($) {
|
||||
var options = {
|
||||
export: {
|
||||
export_data: false, // or true
|
||||
labels_long: null,
|
||||
homeurl: "",
|
||||
},
|
||||
};
|
||||
(function($) {
|
||||
var options = {
|
||||
export: {
|
||||
export_data: false, // or true
|
||||
labels_long: null,
|
||||
homeurl: ""
|
||||
}
|
||||
};
|
||||
|
||||
function init(plot) {
|
||||
plot.exportDataCSV = function (args) {
|
||||
//amount = plot.getOptions().export.type,
|
||||
//options = options || {};
|
||||
function init(plot) {
|
||||
plot.exportDataCSV = function(args) {
|
||||
//amount = plot.getOptions().export.type,
|
||||
//options = options || {};
|
||||
|
||||
// Options
|
||||
var type = "csv";
|
||||
type = type.toLowerCase().trim();
|
||||
// Options
|
||||
var type = "csv";
|
||||
type = type.toLowerCase().trim();
|
||||
|
||||
var graphData,
|
||||
dataObject,
|
||||
dataObjects = plot.getData(),
|
||||
result = [];
|
||||
var graphData,
|
||||
dataObject,
|
||||
dataObjects = plot.getData(),
|
||||
result = [];
|
||||
|
||||
// Throw errors
|
||||
var retrieveDataOject = function (dataObjects) {
|
||||
var result;
|
||||
// Throw errors
|
||||
var retrieveDataOject = function(dataObjects) {
|
||||
var result;
|
||||
|
||||
if (typeof dataObjects === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
if (typeof dataObjects === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
|
||||
// Try to retrieve the avg set (not 100% reliable, I know)
|
||||
if (dataObjects.length == 1) {
|
||||
result = dataObjects.shift();
|
||||
}
|
||||
if (dataObjects.length > 1) {
|
||||
dataObjects.forEach(function (element) {
|
||||
if (/^Avg.:/i.test(element.label)) result = element;
|
||||
});
|
||||
// Try to retrieve the avg set (not 100% reliable, I know)
|
||||
if (dataObjects.length == 1) {
|
||||
result = dataObjects.shift();
|
||||
}
|
||||
if (dataObjects.length > 1) {
|
||||
dataObjects.forEach(function(element) {
|
||||
if (/^Avg.:/i.test(element.label)) result = element;
|
||||
});
|
||||
|
||||
// If the avg set is missing, retrieve the first set
|
||||
if (typeof result === "undefined") result = dataObjects.shift();
|
||||
}
|
||||
// If the avg set is missing, retrieve the first set
|
||||
if (typeof result === "undefined") result = dataObjects.shift();
|
||||
}
|
||||
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
|
||||
return result;
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
// Throw errors
|
||||
var processDataObject = function (dataObject) {
|
||||
var result;
|
||||
// Throw errors
|
||||
var processDataObject = function(dataObject) {
|
||||
var result;
|
||||
|
||||
if (typeof dataObject === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
if (typeof dataObject === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
|
||||
if (
|
||||
typeof dataObject.data === "undefined" ||
|
||||
!(dataObject.data instanceof Array)
|
||||
)
|
||||
throw new Error("Object malformed");
|
||||
if (
|
||||
typeof dataObject.data === "undefined" ||
|
||||
!(dataObject.data instanceof Array)
|
||||
)
|
||||
throw new Error("Object malformed");
|
||||
|
||||
/* {
|
||||
* head: [<column>,<column>,...,<column>],
|
||||
* data: [
|
||||
* [<data>,<data>,...,<data>],
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ...,
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
if (type === "csv") {
|
||||
result = {
|
||||
head: ["timestap", "date", "value", "label"],
|
||||
data: [],
|
||||
};
|
||||
/* {
|
||||
* head: [<column>,<column>,...,<column>],
|
||||
* data: [
|
||||
* [<data>,<data>,...,<data>],
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ...,
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
if (type === "csv") {
|
||||
result = {
|
||||
head: ["timestamp", "date", "value", "label"],
|
||||
data: []
|
||||
};
|
||||
|
||||
dataObject.data.forEach(function (item, index) {
|
||||
var timestap = item[0];
|
||||
dataObject.data.forEach(function(item, index) {
|
||||
var timestamp = item[0];
|
||||
|
||||
var d = new Date(item[0]);
|
||||
var monthNames = [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec",
|
||||
];
|
||||
var d = new Date(item[0]);
|
||||
var monthNames = [
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Apr",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec"
|
||||
];
|
||||
|
||||
date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
monthNames[d.getMonth()] +
|
||||
" " +
|
||||
d.getFullYear() +
|
||||
" " +
|
||||
(d.getHours() < 10 ? "0" : "") +
|
||||
d.getHours() +
|
||||
":" +
|
||||
(d.getMinutes() < 10 ? "0" : "") +
|
||||
d.getMinutes() +
|
||||
":" +
|
||||
(d.getSeconds() < 10 ? "0" : "") +
|
||||
d.getSeconds();
|
||||
date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
monthNames[d.getMonth()] +
|
||||
" " +
|
||||
d.getFullYear() +
|
||||
" " +
|
||||
(d.getHours() < 10 ? "0" : "") +
|
||||
d.getHours() +
|
||||
":" +
|
||||
(d.getMinutes() < 10 ? "0" : "") +
|
||||
d.getMinutes() +
|
||||
":" +
|
||||
(d.getSeconds() < 10 ? "0" : "") +
|
||||
d.getSeconds();
|
||||
|
||||
var date = date_format;
|
||||
var date = date_format;
|
||||
|
||||
var value = item[1];
|
||||
var value = item[1];
|
||||
|
||||
var clean_label = plot.getOptions().export.labels_long[
|
||||
dataObject.label
|
||||
];
|
||||
clean_label = clean_label.replace(new RegExp(" ", "g"), " ");
|
||||
result.data.push([timestap, date, value, clean_label]);
|
||||
});
|
||||
} else if (type === "json") {
|
||||
/* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* ...,
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ]
|
||||
*/
|
||||
result = [];
|
||||
var clean_label = plot.getOptions().export.labels_long[
|
||||
dataObject.label
|
||||
];
|
||||
clean_label = clean_label.replace(new RegExp(" ", "g"), " ");
|
||||
result.data.push([timestamp, date, value, clean_label]);
|
||||
});
|
||||
} else if (type === "json") {
|
||||
/* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* ...,
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ]
|
||||
*/
|
||||
result = [];
|
||||
|
||||
dataObject.data.forEach(function (item, index) {
|
||||
var date = "",
|
||||
value = item[1];
|
||||
dataObject.data.forEach(function(item, index) {
|
||||
var date = "",
|
||||
value = item[1];
|
||||
|
||||
// Long labels are preferred
|
||||
if (typeof labels_long[index] !== "undefined")
|
||||
date = labels_long[index];
|
||||
else if (typeof labels[index] !== "undefined") date = labels[index];
|
||||
// Long labels are preferred
|
||||
if (typeof labels_long[index] !== "undefined")
|
||||
date = labels_long[index];
|
||||
else if (typeof labels[index] !== "undefined") date = labels[index];
|
||||
|
||||
result.push({
|
||||
date: date,
|
||||
value: value,
|
||||
label: dataObject.label,
|
||||
});
|
||||
});
|
||||
}
|
||||
result.push({
|
||||
date: date,
|
||||
value: value,
|
||||
label: dataObject.label
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
|
||||
return result;
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
try {
|
||||
var elements = [];
|
||||
dataObject = retrieveDataOject(dataObjects);
|
||||
if (dataObject) {
|
||||
elements.push(processDataObject(dataObject));
|
||||
}
|
||||
dataObjects.forEach(function (element) {
|
||||
elements.push(processDataObject(element));
|
||||
});
|
||||
graphData = elements;
|
||||
try {
|
||||
var elements = [];
|
||||
dataObject = retrieveDataOject(dataObjects);
|
||||
if (dataObject) {
|
||||
elements.push(processDataObject(dataObject));
|
||||
}
|
||||
dataObjects.forEach(function(element) {
|
||||
elements.push(processDataObject(element));
|
||||
});
|
||||
graphData = elements;
|
||||
|
||||
// Transform the object data into a string
|
||||
// cause PHP has limitations in the number
|
||||
// of POST params received.
|
||||
var graphDataStr = JSON.stringify(graphData);
|
||||
|
||||
// Transform the object data into a string
|
||||
// cause PHP has limitations in the number
|
||||
// of POST params received.
|
||||
var graphDataStr = JSON.stringify(graphData);
|
||||
// Build form
|
||||
var $form = $("<form></form>"),
|
||||
$dataInput = $("<input>"),
|
||||
$typeInput = $("<input>"),
|
||||
$separatorInput = $("<input>"),
|
||||
$excelInput = $("<input>");
|
||||
|
||||
// Build form
|
||||
var $form = $("<form></form>"),
|
||||
$dataInput = $("<input>"),
|
||||
$typeInput = $("<input>"),
|
||||
$separatorInput = $("<input>"),
|
||||
$excelInput = $("<input>");
|
||||
$dataInput
|
||||
.prop("name", "data")
|
||||
.prop("type", "text")
|
||||
.prop("value", graphDataStr);
|
||||
|
||||
$dataInput
|
||||
.prop("name", "data")
|
||||
.prop("type", "text")
|
||||
.prop("value", graphDataStr);
|
||||
$typeInput
|
||||
.prop("name", "type")
|
||||
.prop("type", "text")
|
||||
.prop("value", type);
|
||||
|
||||
$typeInput
|
||||
.prop("name", "type")
|
||||
.prop("type", "text")
|
||||
.prop("value", type);
|
||||
$separatorInput
|
||||
.prop("name", "separator")
|
||||
.prop("type", "text")
|
||||
.prop("value", ";");
|
||||
|
||||
$separatorInput
|
||||
.prop("name", "separator")
|
||||
.prop("type", "text")
|
||||
.prop("value", ";");
|
||||
$excelInput
|
||||
.prop("name", "excel_encoding")
|
||||
.prop("type", "text")
|
||||
.prop("value", 0);
|
||||
|
||||
$excelInput
|
||||
.prop("name", "excel_encoding")
|
||||
.prop("type", "text")
|
||||
.prop("value", 0);
|
||||
$form
|
||||
.prop("method", "POST")
|
||||
.prop(
|
||||
"action",
|
||||
plot.getOptions().export.homeurl + "include/graphs/export_data.php"
|
||||
)
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
.appendTo("body")
|
||||
.submit();
|
||||
} catch (e) {
|
||||
alert("There was an error exporting the data");
|
||||
}
|
||||
};
|
||||
|
||||
$form
|
||||
.prop("method", "POST")
|
||||
.prop(
|
||||
"action",
|
||||
plot.getOptions().export.homeurl + "include/graphs/export_data.php"
|
||||
)
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
.appendTo("body")
|
||||
.submit();
|
||||
} catch (e) {
|
||||
alert("There was an error exporting the data");
|
||||
}
|
||||
};
|
||||
plot.exportDataJSON = function(args) {
|
||||
//amount = plot.getOptions().export.type,
|
||||
//options = options || {};
|
||||
|
||||
plot.exportDataJSON = function (args) {
|
||||
//amount = plot.getOptions().export.type,
|
||||
//options = options || {};
|
||||
// Options
|
||||
var type = "json";
|
||||
type = type.toLowerCase().trim();
|
||||
|
||||
// Options
|
||||
var type = "json";
|
||||
type = type.toLowerCase().trim();
|
||||
var graphData,
|
||||
dataObject,
|
||||
dataObjects = plot.getData(),
|
||||
result = [];
|
||||
|
||||
var graphData,
|
||||
dataObject,
|
||||
dataObjects = plot.getData(),
|
||||
result = [];
|
||||
// Throw errors
|
||||
var retrieveDataOject = function(dataObjects) {
|
||||
var result;
|
||||
|
||||
// Throw errors
|
||||
var retrieveDataOject = function (dataObjects) {
|
||||
var result;
|
||||
if (typeof dataObjects === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
|
||||
if (typeof dataObjects === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
// Try to retrieve the avg set (not 100% reliable, I know)
|
||||
if (dataObjects.length == 1) {
|
||||
result = dataObjects.shift();
|
||||
}
|
||||
if (dataObjects.length > 1) {
|
||||
dataObjects.forEach(function(element) {
|
||||
if (/^Avg.:/i.test(element.label)) result = element;
|
||||
});
|
||||
|
||||
// Try to retrieve the avg set (not 100% reliable, I know)
|
||||
if (dataObjects.length == 1) {
|
||||
result = dataObjects.shift();
|
||||
}
|
||||
if (dataObjects.length > 1) {
|
||||
dataObjects.forEach(function (element) {
|
||||
if (/^Avg.:/i.test(element.label)) result = element;
|
||||
});
|
||||
// If the avg set is missing, retrieve the first set
|
||||
if (typeof result === "undefined") result = dataObjects.shift();
|
||||
}
|
||||
|
||||
// If the avg set is missing, retrieve the first set
|
||||
if (typeof result === "undefined") result = dataObjects.shift();
|
||||
}
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
return result;
|
||||
};
|
||||
|
||||
return result;
|
||||
};
|
||||
// Throw errors
|
||||
var processDataObject = function(dataObject) {
|
||||
var result;
|
||||
|
||||
// Throw errors
|
||||
var processDataObject = function (dataObject) {
|
||||
var result;
|
||||
if (typeof dataObject === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
|
||||
if (typeof dataObject === "undefined")
|
||||
throw new Error("Empty parameter");
|
||||
if (
|
||||
typeof dataObject.data === "undefined" ||
|
||||
!(dataObject.data instanceof Array)
|
||||
)
|
||||
throw new Error("Object malformed");
|
||||
|
||||
if (
|
||||
typeof dataObject.data === "undefined" ||
|
||||
!(dataObject.data instanceof Array)
|
||||
)
|
||||
throw new Error("Object malformed");
|
||||
/* {
|
||||
* head: [<column>,<column>,...,<column>],
|
||||
* data: [
|
||||
* [<data>,<data>,...,<data>],
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ...,
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
if (type === "csv") {
|
||||
result = {
|
||||
head: ["date", "value", "label"],
|
||||
data: []
|
||||
};
|
||||
|
||||
/* {
|
||||
* head: [<column>,<column>,...,<column>],
|
||||
* data: [
|
||||
* [<data>,<data>,...,<data>],
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ...,
|
||||
* [<data>,<data>,...,<data>],
|
||||
* ]
|
||||
* }
|
||||
*/
|
||||
if (type === "csv") {
|
||||
result = {
|
||||
head: ["date", "value", "label"],
|
||||
data: [],
|
||||
};
|
||||
dataObject.data.forEach(function(item, index) {
|
||||
var date = "",
|
||||
value = item[1];
|
||||
|
||||
dataObject.data.forEach(function (item, index) {
|
||||
var date = "",
|
||||
value = item[1];
|
||||
// Long labels are preferred
|
||||
if (
|
||||
typeof plot.getOptions().export.labels_long[index] !== "undefined"
|
||||
)
|
||||
date = plot.getOptions().export.labels_long[index];
|
||||
else if (typeof labels[index] !== "undefined") date = labels[index];
|
||||
|
||||
// Long labels are preferred
|
||||
if (
|
||||
typeof plot.getOptions().export.labels_long[index] !== "undefined"
|
||||
)
|
||||
date = plot.getOptions().export.labels_long[index];
|
||||
else if (typeof labels[index] !== "undefined") date = labels[index];
|
||||
result.data.push([date, value, dataObject.label]);
|
||||
});
|
||||
} else if (type === "json") {
|
||||
/* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* ...,
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ]
|
||||
*/
|
||||
result = [];
|
||||
|
||||
result.data.push([date, value, dataObject.label]);
|
||||
});
|
||||
} else if (type === "json") {
|
||||
/* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ],
|
||||
* ...,
|
||||
* [
|
||||
* {
|
||||
* 'date': <date>,
|
||||
* 'value': <value>
|
||||
* }
|
||||
* ]
|
||||
*/
|
||||
result = [];
|
||||
dataObject.data.forEach(function(item, index) {
|
||||
var date = "",
|
||||
value = item[1];
|
||||
|
||||
dataObject.data.forEach(function (item, index) {
|
||||
var date = "",
|
||||
value = item[1];
|
||||
// Long labels are preferred
|
||||
if (typeof labels_long[index] !== "undefined")
|
||||
date = labels_long[index];
|
||||
else if (typeof labels[index] !== "undefined") date = labels[index];
|
||||
|
||||
// Long labels are preferred
|
||||
if (typeof labels_long[index] !== "undefined")
|
||||
date = labels_long[index];
|
||||
else if (typeof labels[index] !== "undefined") date = labels[index];
|
||||
result.push({
|
||||
date: date,
|
||||
value: value,
|
||||
label: dataObject.label
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
result.push({
|
||||
date: date,
|
||||
value: value,
|
||||
label: dataObject.label,
|
||||
});
|
||||
});
|
||||
}
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
|
||||
if (typeof result === "undefined") throw new Error("Empty result");
|
||||
return result;
|
||||
};
|
||||
|
||||
return result;
|
||||
};
|
||||
try {
|
||||
var elements = [];
|
||||
var custom_graph = $("input:hidden[name=custom_graph]").value;
|
||||
|
||||
try {
|
||||
var elements = [];
|
||||
var custom_graph = $("input:hidden[name=custom_graph]").value;
|
||||
if (custom_graph) {
|
||||
dataObject = retrieveDataOject(dataObjects);
|
||||
dataObjects.forEach(function(element) {
|
||||
elements.push(processDataObject(element));
|
||||
});
|
||||
graphData = elements;
|
||||
} else {
|
||||
dataObject = retrieveDataOject(dataObjects);
|
||||
elements.push(processDataObject(dataObject));
|
||||
graphData = elements;
|
||||
}
|
||||
|
||||
if (custom_graph) {
|
||||
dataObject = retrieveDataOject(dataObjects);
|
||||
dataObjects.forEach(function (element) {
|
||||
elements.push(processDataObject(element));
|
||||
});
|
||||
graphData = elements;
|
||||
} else {
|
||||
dataObject = retrieveDataOject(dataObjects);
|
||||
elements.push(processDataObject(dataObject));
|
||||
graphData = elements;
|
||||
}
|
||||
// Transform the object data into a string
|
||||
// cause PHP has limitations in the number
|
||||
// of POST params received.
|
||||
var graphDataStr = JSON.stringify(graphData);
|
||||
|
||||
// Transform the object data into a string
|
||||
// cause PHP has limitations in the number
|
||||
// of POST params received.
|
||||
var graphDataStr = JSON.stringify(graphData);
|
||||
// Build form
|
||||
var $form = $("<form></form>"),
|
||||
$dataInput = $("<input>"),
|
||||
$typeInput = $("<input>"),
|
||||
$separatorInput = $("<input>"),
|
||||
$excelInput = $("<input>");
|
||||
|
||||
// Build form
|
||||
var $form = $("<form></form>"),
|
||||
$dataInput = $("<input>"),
|
||||
$typeInput = $("<input>"),
|
||||
$separatorInput = $("<input>"),
|
||||
$excelInput = $("<input>");
|
||||
$dataInput
|
||||
.prop("name", "data")
|
||||
.prop("type", "text")
|
||||
.prop("value", graphDataStr);
|
||||
|
||||
$dataInput
|
||||
.prop("name", "data")
|
||||
.prop("type", "text")
|
||||
.prop("value", graphDataStr);
|
||||
$typeInput
|
||||
.prop("name", "type")
|
||||
.prop("type", "text")
|
||||
.prop("value", type);
|
||||
|
||||
$typeInput
|
||||
.prop("name", "type")
|
||||
.prop("type", "text")
|
||||
.prop("value", type);
|
||||
$separatorInput
|
||||
.prop("name", "separator")
|
||||
.prop("type", "text")
|
||||
.prop("value", ";");
|
||||
|
||||
$separatorInput
|
||||
.prop("name", "separator")
|
||||
.prop("type", "text")
|
||||
.prop("value", ";");
|
||||
$excelInput
|
||||
.prop("name", "excel_encoding")
|
||||
.prop("type", "text")
|
||||
.prop("value", 0);
|
||||
|
||||
$excelInput
|
||||
.prop("name", "excel_encoding")
|
||||
.prop("type", "text")
|
||||
.prop("value", 0);
|
||||
$form
|
||||
.prop("method", "POST")
|
||||
.prop(
|
||||
"action",
|
||||
plot.getOptions().export.homeurl + "include/graphs/export_data.php"
|
||||
)
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
.appendTo("body")
|
||||
.submit();
|
||||
} catch (e) {
|
||||
alert("There was an error exporting the data");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$form
|
||||
.prop("method", "POST")
|
||||
.prop(
|
||||
"action",
|
||||
plot.getOptions().export.homeurl + "include/graphs/export_data.php"
|
||||
)
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
.appendTo("body")
|
||||
.submit();
|
||||
} catch (e) {
|
||||
alert("There was an error exporting the data");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "exportdata",
|
||||
version: "0.1",
|
||||
});
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "exportdata",
|
||||
version: "0.1"
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
|
@ -786,13 +786,12 @@ function post_process_select_events_unit(name, selected) {
|
|||
function post_process_select_events(name) {
|
||||
$("." + name + "_toggler").click(function() {
|
||||
var value = $("#text-" + name + "_text").val();
|
||||
|
||||
var count = $("#" + name + "_select option").filter(function(i, item) {
|
||||
if (Number($(item).val()) == Number(value)) return true;
|
||||
else return false;
|
||||
}).length;
|
||||
|
||||
if (count != 1) {
|
||||
if (count < 1) {
|
||||
$("#" + name + "_select").append(
|
||||
$("<option>")
|
||||
.val(value)
|
||||
|
|
|
@ -902,7 +902,6 @@ if (!empty($table->data)) {
|
|||
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'AM')) {
|
||||
echo '<div style="text-align: right; float: right;">';
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
html_print_input_hidden('new_agent', 1);
|
||||
html_print_submit_button(__('Create agent'), 'crt', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
@ -913,7 +912,6 @@ if (!empty($table->data)) {
|
|||
ui_print_info_message([ 'no_close' => true, 'message' => __('There are no defined agents') ]);
|
||||
echo '<div style="text-align: right; float: right;">';
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
html_print_input_hidden('new_agent', 1);
|
||||
html_print_submit_button(__('Create agent'), 'crt', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
|
|
@ -1950,16 +1950,21 @@ function process_datatables_item(item) {
|
|||
|
||||
/* Status */
|
||||
img = '<?php echo html_print_image('images/star.png', true, ['title' => __('Unknown'), 'class' => 'forced-title']); ?>';
|
||||
state = '0';
|
||||
switch (item.estado) {
|
||||
case "<?php echo EVENT_STATUS_NEW; ?>":
|
||||
img = '<?php echo html_print_image('images/star.png', true, ['title' => __('New event'), 'class' => 'forced-title']); ?>';
|
||||
break;
|
||||
|
||||
case "<?php echo EVENT_STATUS_VALIDATED; ?>":
|
||||
|
||||
state = '1';
|
||||
img = '<?php echo html_print_image('images/tick.png', true, [ 'title' => __('Event validated'), 'class' => 'forced-title']); ?>';
|
||||
break;
|
||||
|
||||
case "<?php echo EVENT_STATUS_INPROCESS; ?>":
|
||||
state = '2';
|
||||
|
||||
img = '<?php echo html_print_image('images/hourglass.png', true, [ 'title' => __('Event in process'), 'class' => 'forced-title']); ?>';
|
||||
break;
|
||||
}
|
||||
|
@ -1991,6 +1996,9 @@ function process_datatables_item(item) {
|
|||
}
|
||||
|
||||
item.estado = '<div>';
|
||||
item.estado += '<span style="display: none">';
|
||||
item.estado += state;
|
||||
item.estado += '</span>';
|
||||
item.estado += img;
|
||||
item.estado += '</div>';
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', 750),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.00097656250000":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||
('custom_docs_logo', 'default_docs.png'),
|
||||
('custom_support_logo', 'default_support.png'),
|
||||
('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'),
|
||||
|
@ -2747,4 +2747,4 @@ SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
|
|||
|
||||
INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"Size\",\"extra_field_2\":\"FreeSpace\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_wmi_module -host "_address_" -namespace "_namespace_wmi_" -user "_user_wmi_" -pass "_pass_wmi_" -wmiClass "_class_wmi_" -fieldsList "_field_wmi_1_,_field_wmi_2_" -queryFilter "DeviceID = '_DeviceID_'" -operation "((_f1_ - _f2_) * 100) / _f1_" -wmicPath /usr/bin/wmic\",\"value_operation\":\"((_Size_ - _FreeSpace_) * 100) / _Size_\",\"server_plugin\":\"',@plugin_id,'\",\"_field2__wmi_field\":\"_namespace_wmi_\",\"_field1__wmi_field\":\"_address_\",\"_field4__wmi_field\":\"_pass_wmi_\",\"_field3__wmi_field\":\"_user_wmi_\",\"_field6__wmi_field\":\"_field_wmi_1_,_field_wmi_2_\",\"_field5__wmi_field\":\"_class_wmi_\",\"_field8__wmi_field\":\"((_f1_ - _f2_) * 100) / _f1_\",\"_field7__wmi_field\":\"DeviceID = '_DeviceID_'\",\"field0_wmi_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',2,2,'','',1,'','Win32_LogicalDisk','DeviceID','','{\"scan\":\"DriveType = 3\",\"execution\":\"\",\"field\":\"\",\"key_string\":\"\"}',1);
|
||||
|
||||
INSERT IGNORE INTO `tpen` VALUES (171,'dlink','D-Link Systems, Inc.'),(14988,'mikrotik','MikroTik'),(6486,'alcatel','Alcatel-Lucent Enterprise'),(41112,'ubiquiti','Ubiquiti Networks, Inc.'),(207,'telesis','Allied Telesis, Inc.'),(10002,'frogfoot','Frogfoot Networks'),(2,'ibm','IBM'),(4,'unix','Unix'),(63,'apple','Apple Computer, Inc.'),(674,'dell','Dell Inc.'),(111,'oracle','Oracle'),(116,'hitachi','Hitachi, Ltd.'),(173,'netlink','Netlink'),(188,'ascom','Ascom'),(6574,'synology','Synology Inc.'),(3861,'fujitsu','Fujitsu Network Communications, Inc.'),(53526,'dell','Dell ATC'),(52627,'apple','Apple Inc'),(19464,'hitachi','Hitachi Communication Technologies, Ltd.'),(13062,'ascom','Ascom');
|
||||
INSERT IGNORE INTO `tpen` VALUES (171,'dlink','D-Link Systems, Inc.'),(14988,'mikrotik','MikroTik'),(6486,'alcatel','Alcatel-Lucent Enterprise'),(41112,'ubiquiti','Ubiquiti Networks, Inc.'),(207,'telesis','Allied Telesis, Inc.'),(10002,'frogfoot','Frogfoot Networks'),(2,'ibm','IBM'),(4,'unix','Unix'),(63,'apple','Apple Computer, Inc.'),(674,'dell','Dell Inc.'),(111,'oracle','Oracle'),(116,'hitachi','Hitachi, Ltd.'),(173,'netlink','Netlink'),(188,'ascom','Ascom'),(6574,'synology','Synology Inc.'),(3861,'fujitsu','Fujitsu Network Communications, Inc.'),(53526,'dell','Dell ATC'),(52627,'apple','Apple Inc'),(19464,'hitachi','Hitachi Communication Technologies, Ltd.'),(13062,'ascom','Ascom');
|
||||
|
|
Loading…
Reference in New Issue