mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch 'ent-7063-Informes-de-servicio-en-Meta' into 'develop'
report SLA services to metaconsole pandora_enterprise#7063 See merge request artica/pandorafms!4678
This commit is contained in:
commit
38b71b3de7
@ -27,6 +27,8 @@
|
|||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
|
||||||
@ -3839,7 +3841,12 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||||||
[$item['id_agent_module']]
|
[$item['id_agent_module']]
|
||||||
);
|
);
|
||||||
echo '<td class="sla_list_service_col">';
|
echo '<td class="sla_list_service_col">';
|
||||||
echo printSmallFont($nameService);
|
if ($meta && $server_name != '') {
|
||||||
|
echo $server_name.' » '.$nameService;
|
||||||
|
} else {
|
||||||
|
echo $nameService;
|
||||||
|
}
|
||||||
|
|
||||||
echo '</th>';
|
echo '</th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3986,8 +3993,8 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterprise_installed()
|
if (enterprise_installed() === true
|
||||||
&& $report_item_type == 'SLA_services'
|
&& $report_item_type === 'SLA_services'
|
||||||
) {
|
) {
|
||||||
enterprise_include_once(
|
enterprise_include_once(
|
||||||
'include/functions_services.php'
|
'include/functions_services.php'
|
||||||
@ -4006,8 +4013,9 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
if (!empty($services_tmp)
|
|
||||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
if (empty($services_tmp) === false
|
||||||
|
&& $services_tmp !== ENTERPRISE_NOT_HOOK
|
||||||
) {
|
) {
|
||||||
foreach ($services_tmp as $service) {
|
foreach ($services_tmp as $service) {
|
||||||
$check_module_sla = modules_check_agentmodule_exists(
|
$check_module_sla = modules_check_agentmodule_exists(
|
||||||
@ -4016,14 +4024,89 @@ function print_SLA_list($width, $action, $idItem=null)
|
|||||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||||
$service['sla_value_id_module']
|
$service['sla_value_id_module']
|
||||||
);
|
);
|
||||||
if ($check_module_sla
|
|
||||||
&& $check_module_sla_value
|
if ($check_module_sla === true
|
||||||
|
&& $check_module_sla_value === true
|
||||||
) {
|
) {
|
||||||
$services[$service['id']] = $service['name'];
|
$services[$service['id']] = $service['name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$sc = new Synchronizer();
|
||||||
|
$node_services = $sc->apply(
|
||||||
|
function ($node) {
|
||||||
|
try {
|
||||||
|
$node->connect();
|
||||||
|
|
||||||
|
$services_tmp = enterprise_hook(
|
||||||
|
'services_get_services',
|
||||||
|
[
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
'sla_id_module',
|
||||||
|
'sla_value_id_module',
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$all_services = [];
|
||||||
|
if (empty($services_tmp) === false
|
||||||
|
&& $services_tmp !== ENTERPRISE_NOT_HOOK
|
||||||
|
) {
|
||||||
|
foreach ($services_tmp as $service) {
|
||||||
|
$check_module_sla = modules_check_agentmodule_exists(
|
||||||
|
$service['sla_id_module']
|
||||||
|
);
|
||||||
|
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||||
|
$service['sla_value_id_module']
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($check_module_sla === true
|
||||||
|
&& $check_module_sla_value === true
|
||||||
|
) {
|
||||||
|
$all_services[$service['id']] = $service;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$node->disconnect();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$all_services = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($all_services !== false) {
|
||||||
|
return array_reduce(
|
||||||
|
$all_services,
|
||||||
|
function ($carry, $item) use ($node) {
|
||||||
|
$carry[] = [
|
||||||
|
'id' => $node->id().'|'.$item['id'],
|
||||||
|
'name' => io_safe_output(
|
||||||
|
$node->server_name().' » '.$item['name']
|
||||||
|
),
|
||||||
|
];
|
||||||
|
return $carry;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($node_services as $ns) {
|
||||||
|
foreach ($ns as $k => $ser) {
|
||||||
|
$services[$ser['id']] = $ser['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo '<td class="sla_list_service_col">';
|
echo '<td class="sla_list_service_col">';
|
||||||
echo html_print_select(
|
echo html_print_select(
|
||||||
$services,
|
$services,
|
||||||
@ -5334,6 +5417,11 @@ function addSLARow() {
|
|||||||
var slaMax = $("input[name=sla_max]").val();
|
var slaMax = $("input[name=sla_max]").val();
|
||||||
var slaLimit = $("input[name=sla_limit]").val();
|
var slaLimit = $("input[name=sla_limit]").val();
|
||||||
var serviceId = $("select#id_service>option:selected").val();
|
var serviceId = $("select#id_service>option:selected").val();
|
||||||
|
if(serviceId != '' && serviceId.split('|').length > 1 ) {
|
||||||
|
var ids = serviceId.split('|');
|
||||||
|
serverId = ids[0];
|
||||||
|
serviceId = ids[1];
|
||||||
|
}
|
||||||
var serviceName = $("select#id_service>option:selected").text();
|
var serviceName = $("select#id_service>option:selected").text();
|
||||||
|
|
||||||
if ((((idAgent != '') && (idAgent > 0))
|
if ((((idAgent != '') && (idAgent > 0))
|
||||||
|
@ -653,7 +653,8 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||||||
'optgroup' => __('Graphs'),
|
'optgroup' => __('Graphs'),
|
||||||
'name' => __('Custom graph'),
|
'name' => __('Custom graph'),
|
||||||
];
|
];
|
||||||
// Only pandora managers have access to the whole database
|
|
||||||
|
// Only pandora managers have access to the whole database.
|
||||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
$types['sql_graph_vbar'] = [
|
$types['sql_graph_vbar'] = [
|
||||||
'optgroup' => __('Graphs'),
|
'optgroup' => __('Graphs'),
|
||||||
@ -711,7 +712,7 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||||||
'name' => __('Hourly S.L.A.'),
|
'name' => __('Hourly S.L.A.'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!$config['metaconsole'] && !$template) {
|
if ($template === false) {
|
||||||
$types['SLA_services'] = [
|
$types['SLA_services'] = [
|
||||||
'optgroup' => __('SLA'),
|
'optgroup' => __('SLA'),
|
||||||
'name' => __('Services S.L.A.'),
|
'name' => __('Services S.L.A.'),
|
||||||
|
@ -1040,6 +1040,7 @@ function adjustTextUnits(name) {
|
|||||||
"selected",
|
"selected",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
$("#" + name + "_units").trigger("change");
|
||||||
$("#text-" + name + "_text").val(restPrev);
|
$("#text-" + name + "_text").val(restPrev);
|
||||||
unitsSelected = true;
|
unitsSelected = true;
|
||||||
}
|
}
|
||||||
@ -1048,7 +1049,9 @@ function adjustTextUnits(name) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (unitsSelected == false) {
|
if (unitsSelected == false) {
|
||||||
|
//$("#" + name + "_units option:last").prop("selected", true);
|
||||||
$("#" + name + "_units option:last").prop("selected", true);
|
$("#" + name + "_units option:last").prop("selected", true);
|
||||||
|
$("#" + name + "_units").trigger("change");
|
||||||
$("#text-" + name + "_text").val(restPrev);
|
$("#text-" + name + "_text").val(restPrev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user