-- Insert new DB2 APP SET @current_app_type = 11; SET @short_name = 'pandorafms.db2'; SET @name = 'DB2'; SET @section = 'app'; SET @description = 'Monitor DB2 databases'; SET @version = '1.0'; INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version); SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name; -- Insert into tdiscovery_apps_scripts INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_db2'); -- Insert into tdiscovery_apps_executions INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' --conf '_tempfileConf_' --target_databases '_tempfileTargetDatabases_' --target_agents '_tempfileTargetAgents_' --custom_queries '_tempfileCustomQueries_''); -- Migrate current DB2 tasks configurations INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_dbstrings_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbstrings')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_dbuser_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbuser')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_dbpass_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.dbpass')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_threads_', 'custom', 1, 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_engineAgent_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.engine_agent')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_prefixModuleName_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.prefix_module_name')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_checkDbSummary_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_db_summary')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_checkTransactionalLogUtilization_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_transactional_log_utilization')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_checkConnections_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_connections')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_checkDbSize_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_db_size')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_checkCache_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.check_cache')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_executeCustomQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.execute_custom_queries')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_customQueries_', 'custom', JSON_UNQUOTE(JSON_EXTRACT(CONVERT(FROM_BASE64(`field1`) USING UTF8MB4), '$.custom_queries')), 0 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_tempfileConf_', 'custom', 'agents_group_id = __taskGroupID__ interval = __taskInterval__ user = _dbuser_ password = _dbpass_ threads = _threads_ modules_prefix = _prefixModuleName_ execute_custom_queries = _executeCustomQueries_ analyze_connections = _checkConnections_ cache_stats = _checkCache_ database_summary = _checkDbSummary_ transactional_log = _checkTransactionalLogUtilization_ db_size = _checkDbSize_', 1 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_tempfileTargetDatabases_', 'custom', '_dbstrings_', 1 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_tempfileTargetAgents_', 'custom', '_engineAgent_', 1 FROM `trecon_task` WHERE `type` = @current_app_type ; INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT `id_rt`, '_tempfileCustomQueries_', 'custom', '_customQueries_', 1 FROM `trecon_task` WHERE `type` = @current_app_type ; -- Migrate current DB2 tasks UPDATE `trecon_task` SET `id_app` = @id_app, `setup_complete` = 1, `type` = 15 WHERE `type` = @current_app_type ;