Merge branch '3170-Cambios_custom_fields_view' into 'develop'
new fields form custom field view See merge request artica/pandorafms!2030
This commit is contained in:
commit
1e9be8d161
|
@ -0,0 +1,9 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
|
||||
|
||||
COMMIT;
|
|
@ -1180,13 +1180,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 22);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 23);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '729');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '730');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
|
@ -1826,3 +1826,9 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
|
|||
`module_search` varchar(600) default '',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';
|
||||
|
|
|
@ -32,6 +32,7 @@ $append_tab_filter = (bool)get_parameter('append_tab_filter', 0);
|
|||
$create_filter_cf = (bool)get_parameter('create_filter_cf', 0);
|
||||
$update_filter_cf = (bool)get_parameter('update_filter_cf', 0);
|
||||
$delete_filter_cf = (bool)get_parameter('delete_filter_cf', 0);
|
||||
$change_name_filter = (bool)get_parameter('change_name_filter', 0);
|
||||
|
||||
if ($get_custom_fields_data){
|
||||
$name_custom_fields = get_parameter("name_custom_fields", 0);
|
||||
|
@ -40,7 +41,6 @@ if ($get_custom_fields_data){
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if($build_table_custom_fields){
|
||||
$order = get_parameter("order", '');
|
||||
$length = get_parameter("length", 20);
|
||||
|
@ -237,6 +237,7 @@ if($build_table_child_custom_fields){
|
|||
$id_agent = get_parameter("id_agent", 0);
|
||||
$id_server = get_parameter("id_server", 0);
|
||||
$module_search = str_replace('amp;', '',get_parameter("module_search", ''));
|
||||
$module_status = get_parameter("module_status", 0);
|
||||
|
||||
if(!$id_server || !$id_agent){
|
||||
return false;
|
||||
|
@ -246,6 +247,46 @@ if($build_table_child_custom_fields){
|
|||
$name_where = " AND tam.nombre LIKE '%" . $module_search . "%'";
|
||||
}
|
||||
|
||||
//filter by status module
|
||||
$and_module_status = "";
|
||||
if(is_array($module_status)){
|
||||
if(!in_array(-1, $module_status)){
|
||||
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $module_status)){
|
||||
if(count($module_status) > 0){
|
||||
$and_module_status = " AND ( ";
|
||||
foreach ($module_status as $key => $value) {
|
||||
$and_module_status .= ($key != 0)
|
||||
? " OR ("
|
||||
: " (";
|
||||
switch ($value) {
|
||||
default:
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$and_module_status .= " tae.estado = 0 OR tae.estado = 300 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
$and_module_status .= " tae.estado = 1 OR tae.estado = 100 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_WARNING:
|
||||
$and_module_status .= " tae.estado = 2 OR tae.estado = 200 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
$and_module_status .= " tae.estado = 3 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
$and_module_status .= " tae.estado = 4 OR tae.estado = 5 ) ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$and_module_status .= " ) ";
|
||||
}
|
||||
}
|
||||
else{
|
||||
//not normal
|
||||
$and_module_status = "AND tae.estado <> 0 AND tae.estado <> 300 ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$server = metaconsole_get_connection_by_id ($id_server);
|
||||
metaconsole_connect($server);
|
||||
|
@ -262,9 +303,10 @@ if($build_table_child_custom_fields){
|
|||
INNER JOIN tagente_estado tae
|
||||
ON tam.id_agente_modulo = tae.id_agente_modulo
|
||||
WHERE tam.id_agente = %d
|
||||
%s",
|
||||
%s %s",
|
||||
$id_agent,
|
||||
$name_where
|
||||
$name_where,
|
||||
$and_module_status
|
||||
);
|
||||
|
||||
$modules = db_get_all_rows_sql ($query);
|
||||
|
@ -282,7 +324,7 @@ if($build_table_child_custom_fields){
|
|||
$table_modules->head[5] = __('Status');
|
||||
|
||||
$table_modules->data = array();
|
||||
$status_agent = -1;
|
||||
|
||||
if(isset($modules) && is_array($modules)){
|
||||
foreach ($modules as $key => $value) {
|
||||
$table_modules->data[$key][0] = $value['nombre'];
|
||||
|
@ -311,9 +353,6 @@ if($build_table_child_custom_fields){
|
|||
switch ($value['estado']) {
|
||||
case 0:
|
||||
case 300:
|
||||
if($status_agent != 1 && $status_agent != 2 && $status_agent != 3){
|
||||
$status_agent = 0;
|
||||
}
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_normal.png',
|
||||
true,
|
||||
|
@ -324,7 +363,6 @@ if($build_table_child_custom_fields){
|
|||
break;
|
||||
case 1:
|
||||
case 100:
|
||||
$status_agent = 1;
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_critical.png',
|
||||
true,
|
||||
|
@ -335,10 +373,6 @@ if($build_table_child_custom_fields){
|
|||
break;
|
||||
case 2:
|
||||
case 200:
|
||||
if($status_agent != 1){
|
||||
$status_agent = 2;
|
||||
}
|
||||
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_warning.png',
|
||||
true,
|
||||
|
@ -348,10 +382,6 @@ if($build_table_child_custom_fields){
|
|||
);
|
||||
break;
|
||||
case 3:
|
||||
if($status_agent != 1 && $status_agent != 2){
|
||||
$status_agent = 3;
|
||||
}
|
||||
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_maintenance.png',
|
||||
true,
|
||||
|
@ -362,9 +392,6 @@ if($build_table_child_custom_fields){
|
|||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
if($status_agent == -1 || $status_agent == 4){
|
||||
$status_agent = 5;
|
||||
}
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_informational.png',
|
||||
true,
|
||||
|
@ -374,10 +401,6 @@ if($build_table_child_custom_fields){
|
|||
);
|
||||
break;
|
||||
default:
|
||||
if($status_agent != 1 && $status_agent != 2 && $status_agent != 3){
|
||||
$status_agent = 0;
|
||||
}
|
||||
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_normal.png',
|
||||
true,
|
||||
|
@ -390,6 +413,8 @@ if($build_table_child_custom_fields){
|
|||
}
|
||||
}
|
||||
|
||||
$status_agent = agents_get_status($id_agent, true);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
@ -435,12 +460,14 @@ if($build_table_save_filter){
|
|||
$table->class = 'databox';
|
||||
|
||||
$array_filters = get_filters_custom_fields_view(0, true);
|
||||
|
||||
$table->data[0][0] = __('Filter name');
|
||||
$table->data[0][1] = html_print_select(
|
||||
$array_filters, 'id_name',
|
||||
'', '', '', '',
|
||||
true, false, true, '', false
|
||||
);
|
||||
|
||||
$table->data[0][3] = html_print_submit_button (__('Load filter'), 'load_filter', false, 'class="sub upd"', true);
|
||||
|
||||
echo "<form action='' method='post'>";
|
||||
|
@ -462,7 +489,16 @@ if($append_tab_filter){
|
|||
echo "<div id='msg_error_create'></div>";
|
||||
$table->data[0][0] = __('Filter name');
|
||||
$table->data[0][1] = html_print_input_text('id_name', '', '', 15, 255, true);
|
||||
$table->data[0][2] = html_print_submit_button (__('Create filter'), 'create_filter', false, 'class="sub upd"', true);
|
||||
|
||||
$table->data[0][2] = __('Group');
|
||||
$table->data[0][3] = html_print_select_groups(
|
||||
$config['id_user'], 'AR', true, 'group_search_cr',
|
||||
0, '', '', '0', true, false,
|
||||
false, '', false, '', false, false,
|
||||
'id_grupo', false
|
||||
);
|
||||
|
||||
$table->data[0][4] = html_print_submit_button (__('Create filter'), 'create_filter', false, 'class="sub upd"', true);
|
||||
}
|
||||
else{
|
||||
echo "<div id='msg_error_update'></div>";
|
||||
|
@ -470,12 +506,22 @@ if($append_tab_filter){
|
|||
$array_filters = get_filters_custom_fields_view(0, true);
|
||||
$table->data[0][0] = __('Filter name');
|
||||
$table->data[0][1] = html_print_select(
|
||||
$array_filters, 'id_name',
|
||||
'', '', __('None'), -1,
|
||||
true, false, true, '', false
|
||||
$array_filters, 'id_name', '',
|
||||
'filter_name_change_group(this.value)',
|
||||
__('None'), -1, true, false, true,
|
||||
'', false
|
||||
);
|
||||
|
||||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = html_print_select_groups(
|
||||
$config['id_user'], 'AR', true, 'group_search_up',
|
||||
$group, '', '', '0', true, false,
|
||||
false, '', false, '', false, false,
|
||||
'id_grupo', false
|
||||
);
|
||||
|
||||
$table->data[0][2] = html_print_submit_button (__('Delete filter'), 'delete_filter', false, 'class="sub upd"', true);
|
||||
$table->data[0][3] = html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd"', true);
|
||||
$table->data[1][2] = html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd"', true);
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
|
@ -491,6 +537,7 @@ if($create_filter_cf){
|
|||
//initialize vars
|
||||
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
|
||||
$name_filter = get_parameter("name_filter", '');
|
||||
$group_search = get_parameter("group_search", 0);
|
||||
|
||||
//check that the name is not empty
|
||||
if($name_filter == ''){
|
||||
|
@ -529,11 +576,14 @@ if($create_filter_cf){
|
|||
//insert
|
||||
$values = array();
|
||||
$values['name'] = $name_filter;
|
||||
$values['group_search'] = $group_search;
|
||||
$values['id_group'] = $filters['group'];
|
||||
$values['id_custom_field'] = $filters['id_custom_fields'];
|
||||
$values['id_custom_fields_data'] = json_encode($filters['id_custom_fields_data']);
|
||||
$values['id_status'] = json_encode($filters['id_status']);
|
||||
$values['module_search'] = $filters['module_search'];
|
||||
$values['module_status'] = json_encode($filters['module_status']);
|
||||
$values['recursion'] = $filters['recursion'];
|
||||
|
||||
$insert = db_process_sql_insert('tagent_custom_fields_filter', $values);
|
||||
|
||||
|
@ -565,6 +615,7 @@ if($update_filter_cf){
|
|||
//initialize vars
|
||||
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
|
||||
$id_filter = get_parameter("id_filter", '');
|
||||
$group_search = get_parameter("group_search", 0);
|
||||
|
||||
//check selected filter
|
||||
if($id_filter == -1){
|
||||
|
@ -595,10 +646,13 @@ if($update_filter_cf){
|
|||
//array values update
|
||||
$values = array();
|
||||
$values['id_group'] = $filters['group'];
|
||||
$values['group_search'] = $group_search;
|
||||
$values['id_custom_field'] = $filters['id_custom_fields'];
|
||||
$values['id_custom_fields_data'] = json_encode($filters['id_custom_fields_data']);
|
||||
$values['id_status'] = json_encode($filters['id_status']);
|
||||
$values['module_search'] = $filters['module_search'];
|
||||
$values['module_status'] = json_encode($filters['module_status']);
|
||||
$values['recursion'] = $filters['recursion'];
|
||||
|
||||
//update
|
||||
$update = db_process_sql_update('tagent_custom_fields_filter', $values, $condition);
|
||||
|
@ -669,6 +723,16 @@ if($delete_filter_cf){
|
|||
return;
|
||||
}
|
||||
|
||||
if($change_name_filter){
|
||||
$id_filter = get_parameter("id_filter", 0);
|
||||
if(isset($id_filter)){
|
||||
$res = get_group_filter_custom_field_view($id_filter);
|
||||
echo json_encode($res);
|
||||
return;
|
||||
}
|
||||
|
||||
return json_encode(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ function get_custom_fields_data ($custom_field_name) {
|
|||
}
|
||||
|
||||
function agent_counters_custom_fields($filters){
|
||||
//filter by status
|
||||
//filter by status agent
|
||||
$and_status = "";
|
||||
if(is_array($filters['id_status'])){
|
||||
if(!in_array(-1, $filters['id_status'])){
|
||||
|
@ -241,17 +241,100 @@ function agent_counters_custom_fields($filters){
|
|||
}
|
||||
}
|
||||
|
||||
//filter by status module
|
||||
$and_module_status = "";
|
||||
if(is_array($filters['module_status'])){
|
||||
if(!in_array(-1, $filters['module_status'])){
|
||||
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['module_status'])){
|
||||
if(count($filters['module_status']) > 0){
|
||||
$and_module_status = " AND ( ";
|
||||
foreach ($filters['module_status'] as $key => $value) {
|
||||
$and_module_status .= ($key != 0)
|
||||
? " OR ("
|
||||
: " (";
|
||||
switch ($value) {
|
||||
default:
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$and_module_status .= " tae.estado = 0 OR tae.estado = 300 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
$and_module_status .= " tae.estado = 1 OR tae.estado = 100 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_WARNING:
|
||||
$and_module_status .= " tae.estado = 2 OR tae.estado = 200 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
$and_module_status .= " tae.estado = 3 ) ";
|
||||
break;
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
$and_module_status .= " tae.estado = 4 OR tae.estado = 5 ) ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
$and_module_status .= " ) ";
|
||||
}
|
||||
}
|
||||
else{
|
||||
//not normal
|
||||
$and_module_status = "AND tae.estado <> 0 AND tae.estado <> 300 ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//filters module
|
||||
if($filters['module_search']){
|
||||
$and_module_search = 'AND nombre LIKE "%' . $filters['module_search'] . '%"';
|
||||
}
|
||||
|
||||
$module_filter = "";
|
||||
if($and_module_search != '' || $and_module_status != ''){
|
||||
$module_filter = ' AND (
|
||||
SELECT count(*) AS n
|
||||
FROM tagente_modulo tam
|
||||
INNER JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
WHERE tam.id_agente=ta.id_agente
|
||||
'. $and_module_search . ' ' . $and_module_status .'
|
||||
) > 0 ';
|
||||
}
|
||||
|
||||
//filter group and check ACL groups
|
||||
$groups_and = "";
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
if(!$filters['group']){
|
||||
$id_groups = explode(", ", array_keys(users_get_groups()));
|
||||
if($filters['group']){
|
||||
$user_groups = array_keys(users_get_groups());
|
||||
$id_groups = implode(", ", $user_groups);
|
||||
$groups_and = " AND (ta.id_grupo IN ($id_groups) OR tasg.id_group IN($id_groups))";
|
||||
}
|
||||
}
|
||||
|
||||
if($filters['group']){
|
||||
$groups_and = " AND (ta.id_grupo =". $filters['group']." OR tasg.id_group =". $filters['group'].")";
|
||||
//recursion check acl
|
||||
if($filters['recursion']){
|
||||
$recursion_groups = groups_get_id_recursive($filters['group'], true);
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
if(isset($user_groups) && is_array($user_groups)){
|
||||
$groups_intersect = array_intersect($user_groups, $recursion_groups);
|
||||
if(isset($groups_intersect) && is_array($groups_intersect)){
|
||||
$groups_intersect = implode(", ", $groups_intersect);
|
||||
$groups_and = " AND (ta.id_grupo IN ($groups_intersect) OR tasg.id_group IN($groups_intersect))";
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$recursion_groups = implode(", ", $recursion_groups);
|
||||
$groups_and = " AND (ta.id_grupo IN ($recursion_groups) OR tasg.id_group IN($recursion_groups))";
|
||||
}
|
||||
}
|
||||
else{
|
||||
$groups_and = " AND (ta.id_grupo =". $filters['group']." OR tasg.id_group =". $filters['group'].")";
|
||||
}
|
||||
}
|
||||
|
||||
//filter custom data
|
||||
|
@ -264,17 +347,6 @@ function agent_counters_custom_fields($filters){
|
|||
//filter custom name
|
||||
$custom_field_name = $filters['id_custom_fields'];
|
||||
|
||||
//filters module
|
||||
$module_filter = "";
|
||||
if($filters['module_search']){
|
||||
$module_filter = ' AND (
|
||||
SELECT count(*) AS n
|
||||
FROM tagente_modulo
|
||||
WHERE nombre LIKE "%' . $filters['module_search'] . '%"
|
||||
AND id_agente=ta.id_agente
|
||||
) > 0 ';
|
||||
}
|
||||
|
||||
if(is_metaconsole()){
|
||||
$metaconsole_connections = metaconsole_get_connection_names();
|
||||
// For all nodes
|
||||
|
@ -385,36 +457,38 @@ function agent_counters_custom_fields($filters){
|
|||
);
|
||||
|
||||
foreach ($result_meta as $k => $nodo) {
|
||||
foreach ($nodo as $key => $value) {
|
||||
//Sum counters total
|
||||
$final_result['counters_total']['t_m_normal'] += $value['m_normal'];
|
||||
$final_result['counters_total']['t_m_critical'] += $value['m_critical'];
|
||||
$final_result['counters_total']['t_m_warning'] += $value['m_warning'];
|
||||
$final_result['counters_total']['t_m_unknown'] += $value['m_unknown'];
|
||||
$final_result['counters_total']['t_m_not_init'] += $value['m_not_init'];
|
||||
$final_result['counters_total']['t_m_alerts'] += $value['m_alerts'];
|
||||
$final_result['counters_total']['t_m_total'] += $value['m_total'];
|
||||
$final_result['counters_total']['t_a_critical'] += $value['a_critical'];
|
||||
$final_result['counters_total']['t_a_warning'] += $value['a_warning'];
|
||||
$final_result['counters_total']['t_a_unknown'] += $value['a_unknown'];
|
||||
$final_result['counters_total']['t_a_normal'] += $value['a_normal'];
|
||||
$final_result['counters_total']['t_a_not_init'] += $value['a_not_init'];
|
||||
$final_result['counters_total']['t_a_agents'] += $value['a_agents'];
|
||||
if(isset($nodo) && is_array($nodo)){
|
||||
foreach ($nodo as $key => $value) {
|
||||
//Sum counters total
|
||||
$final_result['counters_total']['t_m_normal'] += $value['m_normal'];
|
||||
$final_result['counters_total']['t_m_critical'] += $value['m_critical'];
|
||||
$final_result['counters_total']['t_m_warning'] += $value['m_warning'];
|
||||
$final_result['counters_total']['t_m_unknown'] += $value['m_unknown'];
|
||||
$final_result['counters_total']['t_m_not_init'] += $value['m_not_init'];
|
||||
$final_result['counters_total']['t_m_alerts'] += $value['m_alerts'];
|
||||
$final_result['counters_total']['t_m_total'] += $value['m_total'];
|
||||
$final_result['counters_total']['t_a_critical'] += $value['a_critical'];
|
||||
$final_result['counters_total']['t_a_warning'] += $value['a_warning'];
|
||||
$final_result['counters_total']['t_a_unknown'] += $value['a_unknown'];
|
||||
$final_result['counters_total']['t_a_normal'] += $value['a_normal'];
|
||||
$final_result['counters_total']['t_a_not_init'] += $value['a_not_init'];
|
||||
$final_result['counters_total']['t_a_agents'] += $value['a_agents'];
|
||||
|
||||
//Sum counters for data
|
||||
$array_data[$value['name_data']]['m_normal'] += $value['m_normal'];
|
||||
$array_data[$value['name_data']]['m_critical'] += $value['m_critical'];
|
||||
$array_data[$value['name_data']]['m_warning'] += $value['m_warning'];
|
||||
$array_data[$value['name_data']]['m_unknown'] += $value['m_unknown'];
|
||||
$array_data[$value['name_data']]['m_not_init'] += $value['m_not_init'];
|
||||
$array_data[$value['name_data']]['m_alerts'] += $value['m_alerts'];
|
||||
$array_data[$value['name_data']]['m_total'] += $value['m_total'];
|
||||
$array_data[$value['name_data']]['a_critical'] += $value['a_critical'];
|
||||
$array_data[$value['name_data']]['a_warning'] += $value['a_warning'];
|
||||
$array_data[$value['name_data']]['a_unknown'] += $value['a_unknown'];
|
||||
$array_data[$value['name_data']]['a_normal'] += $value['a_normal'];
|
||||
$array_data[$value['name_data']]['a_not_init'] += $value['a_not_init'];
|
||||
$array_data[$value['name_data']]['a_agents'] += $value['a_agents'];
|
||||
//Sum counters for data
|
||||
$array_data[$value['name_data']]['m_normal'] += $value['m_normal'];
|
||||
$array_data[$value['name_data']]['m_critical'] += $value['m_critical'];
|
||||
$array_data[$value['name_data']]['m_warning'] += $value['m_warning'];
|
||||
$array_data[$value['name_data']]['m_unknown'] += $value['m_unknown'];
|
||||
$array_data[$value['name_data']]['m_not_init'] += $value['m_not_init'];
|
||||
$array_data[$value['name_data']]['m_alerts'] += $value['m_alerts'];
|
||||
$array_data[$value['name_data']]['m_total'] += $value['m_total'];
|
||||
$array_data[$value['name_data']]['a_critical'] += $value['a_critical'];
|
||||
$array_data[$value['name_data']]['a_warning'] += $value['a_warning'];
|
||||
$array_data[$value['name_data']]['a_unknown'] += $value['a_unknown'];
|
||||
$array_data[$value['name_data']]['a_normal'] += $value['a_normal'];
|
||||
$array_data[$value['name_data']]['a_not_init'] += $value['a_not_init'];
|
||||
$array_data[$value['name_data']]['a_agents'] += $value['a_agents'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,8 +506,16 @@ function agent_counters_custom_fields($filters){
|
|||
}
|
||||
|
||||
function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""){
|
||||
//filter group and check ACL groups
|
||||
$groups_and = "";
|
||||
if (!users_can_manage_group_all()) {
|
||||
$user_groups = array_keys(users_get_groups(false, "AR", false));
|
||||
$id_groups = implode(", ", $user_groups);
|
||||
$groups_and = " AND (group_search IN ($id_groups)) ";
|
||||
}
|
||||
|
||||
if($for_select){
|
||||
$query = "SELECT id, `name` FROM tagent_custom_fields_filter";
|
||||
$query = "SELECT id, `name` FROM tagent_custom_fields_filter WHERE 1=1" . $groups_and;
|
||||
$rs = db_get_all_rows_sql($query);
|
||||
if(isset($rs) && is_array($rs)){
|
||||
foreach ($rs as $key => $value) {
|
||||
|
@ -445,7 +527,7 @@ function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""
|
|||
}
|
||||
}
|
||||
else{
|
||||
$query = "SELECT * FROM tagent_custom_fields_filter WHERE 1=1";
|
||||
$query = "SELECT * FROM tagent_custom_fields_filter WHERE 1=1" . $groups_and;
|
||||
|
||||
if($id){
|
||||
$query .= " AND id = " . $id;
|
||||
|
@ -459,4 +541,13 @@ function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""
|
|||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_group_filter_custom_field_view ($id){
|
||||
if(isset($id)){
|
||||
$res = db_get_row_filter('tagent_custom_fields_filter',array('id' => $id));
|
||||
return $res;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
|
@ -3371,5 +3371,8 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
|
|||
`id_custom_fields_data` varchar(600) default '',
|
||||
`id_status` varchar(600) default '',
|
||||
`module_search` varchar(600) default '',
|
||||
`module_status` varchar(600) default '',
|
||||
`recursion` int(1) unsigned default '0',
|
||||
`group_search` int(10) unsigned default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
|
@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 22),
|
||||
('MR', 23),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '729'),
|
||||
('current_package_enterprise', '730'),
|
||||
('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"}'),
|
||||
('custom_docs_logo', 'default_docs.png'),
|
||||
('custom_support_logo', 'default_support.png'),
|
||||
|
|
Loading…
Reference in New Issue