Custom fields view add new filters

This commit is contained in:
daniel 2018-12-03 11:36:34 +01:00
parent c128f750e1
commit 01a9621eb5
6 changed files with 56 additions and 35 deletions

View File

@ -0,0 +1,9 @@
START TRANSACTION;
--ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
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;

View File

@ -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,7 @@ 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';

View File

@ -40,7 +40,6 @@ if ($get_custom_fields_data){
return;
}
if($build_table_custom_fields){
$order = get_parameter("order", '');
$length = get_parameter("length", 20);
@ -237,6 +236,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 = str_replace('amp;', '',get_parameter("module_status", ''));
if(!$id_server || !$id_agent){
return false;
@ -534,6 +534,8 @@ if($create_filter_cf){
$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);
@ -599,6 +601,8 @@ if($update_filter_cf){
$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);

View File

@ -292,7 +292,7 @@ function agent_counters_custom_fields($filters){
SELECT count(*) AS n
FROM tagente_modulo tam
INNER JOIN tagente_estado tae
ON tae.id_agente_modulo = tam.id_agente
ON tae.id_agente_modulo = tam.id_agente_modulo
WHERE tam.id_agente=ta.id_agente
'. $and_module_search . ' ' . $and_module_status .'
) > 0 ';
@ -457,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'];
}
}
}

View File

@ -3371,5 +3371,7 @@ 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',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -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'),