2023-12-19 18:37:49 +01:00
|
|
|
-- Active: 1696349857571@@172.16.0.2@3306
|
2023-11-15 14:24:42 +01:00
|
|
|
START TRANSACTION;
|
|
|
|
|
2023-10-26 19:05:07 +02:00
|
|
|
CREATE TABLE IF NOT EXISTS `tdemo_data` (
|
|
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
|
|
`item_id` INT UNSIGNED NULL DEFAULT NULL,
|
|
|
|
`table_name` VARCHAR(64) NULL DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`id`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
|
|
|
|
2023-11-28 16:46:42 +01:00
|
|
|
SET @class_name = 'AgentHive';
|
|
|
|
SET @unique_name = 'AgentHive';
|
|
|
|
SET @description = 'Agents hive';
|
|
|
|
SET @page = 'AgentHive.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'AvgSumMaxMinModule';
|
|
|
|
SET @unique_name = 'AvgSumMaxMinModule';
|
|
|
|
SET @description = 'Avg|Sum|Max|Min Module Data';
|
|
|
|
SET @page = 'AvgSumMaxMinModule.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'BasicChart';
|
|
|
|
SET @unique_name = 'BasicChart';
|
|
|
|
SET @description = 'Basic chart';
|
|
|
|
SET @page = 'BasicChart.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'BlockHistogram';
|
|
|
|
SET @unique_name = 'BlockHistogram';
|
|
|
|
SET @description = 'Block histogram';
|
|
|
|
SET @page = 'BlockHistogram.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ColorModuleTabs';
|
|
|
|
SET @unique_name = 'ColorModuleTabs';
|
|
|
|
SET @description = 'Color tabs modules';
|
|
|
|
SET @page = 'ColorModuleTabs.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'DataMatrix';
|
|
|
|
SET @unique_name = 'DataMatrix';
|
|
|
|
SET @description = 'Data Matrix';
|
|
|
|
SET @page = 'DataMatrix.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'EventCardboard';
|
|
|
|
SET @unique_name = 'EventCardboard';
|
|
|
|
SET @description = 'Event cardboard';
|
|
|
|
SET @page = 'EventCardboard.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'GroupedMeterGraphs';
|
|
|
|
SET @unique_name = 'GroupedMeterGraphs';
|
|
|
|
SET @description = 'Grouped meter graphs';
|
|
|
|
SET @page = 'GroupedMeterGraphs.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ModulesByStatus';
|
|
|
|
SET @unique_name = 'ModulesByStatus';
|
|
|
|
SET @description = 'Modules by status';
|
|
|
|
SET @page = 'ModulesByStatus.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'AgentModuleWidget';
|
|
|
|
SET @unique_name = 'agent_module';
|
|
|
|
SET @description = 'Agent/Module View';
|
|
|
|
SET @page = 'agent_module.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'AlertsFiredWidget';
|
|
|
|
SET @unique_name = 'alerts_fired';
|
|
|
|
SET @description = 'Triggered alerts report';
|
|
|
|
SET @page = 'alerts_fired.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ClockWidget';
|
|
|
|
SET @unique_name = 'clock';
|
|
|
|
SET @description = 'Clock';
|
|
|
|
SET @page = 'clock.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'CustomGraphWidget';
|
|
|
|
SET @unique_name = 'custom_graph';
|
|
|
|
SET @description = 'Defined custom graph';
|
|
|
|
SET @page = 'custom_graph.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'EventsListWidget';
|
|
|
|
SET @unique_name = 'events_list';
|
|
|
|
SET @description = 'List of latest events';
|
|
|
|
SET @page = 'events_list.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'WelcomeWidget';
|
|
|
|
SET @unique_name = 'example';
|
|
|
|
SET @description = 'Welcome message to Pandora FMS';
|
|
|
|
SET @page = 'example.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'GraphModuleHistogramWidget';
|
|
|
|
SET @unique_name = 'graph_module_histogram';
|
|
|
|
SET @description = 'Module histogram';
|
|
|
|
SET @page = 'graph_module_histogram.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'GroupsStatusWidget';
|
|
|
|
SET @unique_name = 'groups_status';
|
|
|
|
SET @description = 'General group status';
|
|
|
|
SET @page = 'groups_status.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'GroupsStatusMapWidget';
|
|
|
|
SET @unique_name = 'groups_status_map';
|
|
|
|
SET @description = 'Group status map';
|
|
|
|
SET @page = 'groups_status_map.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'HeatmapWidget';
|
|
|
|
SET @unique_name = 'heatmap';
|
|
|
|
SET @description = 'Heatmap';
|
|
|
|
SET @page = 'heatmap.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'InventoryWidget';
|
|
|
|
SET @unique_name = 'inventory';
|
|
|
|
SET @description = 'Inventory';
|
|
|
|
SET @page = 'inventory.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'MapsMadeByUser';
|
|
|
|
SET @unique_name = 'maps_made_by_user';
|
|
|
|
SET @description = 'Visual Console';
|
|
|
|
SET @page = 'maps_made_by_user.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'MapsStatusWidget';
|
|
|
|
SET @unique_name = 'maps_status';
|
|
|
|
SET @description = 'General visual maps report';
|
|
|
|
SET @page = 'maps_status.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ModuleIconWidget';
|
|
|
|
SET @unique_name = 'module_icon';
|
|
|
|
SET @description = 'Icon and module value';
|
|
|
|
SET @page = 'module_icon.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ModuleStatusWidget';
|
|
|
|
SET @unique_name = 'module_status';
|
|
|
|
SET @description = 'Module status';
|
|
|
|
SET @page = 'module_status.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ModuleTableValueWidget';
|
|
|
|
SET @unique_name = 'module_table_value';
|
|
|
|
SET @description = 'Module in a table';
|
|
|
|
SET @page = 'module_table_value.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ModuleValueWidget';
|
|
|
|
SET @unique_name = 'module_value';
|
|
|
|
SET @description = 'Module value';
|
|
|
|
SET @page = 'module_value.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'MonitorHealthWidget';
|
|
|
|
SET @unique_name = 'monitor_health';
|
|
|
|
SET @description = 'Global health info';
|
|
|
|
SET @page = 'monitor_health.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'Netflow';
|
|
|
|
SET @unique_name = 'netflow';
|
|
|
|
SET @description = 'Netflow';
|
|
|
|
SET @page = 'netflow.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'NetworkMapWidget';
|
|
|
|
SET @unique_name = 'network_map';
|
|
|
|
SET @description = 'Network map';
|
|
|
|
SET @page = 'network_map.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'OsQuickReportWidget';
|
|
|
|
SET @unique_name = 'os_quick_report';
|
|
|
|
SET @description = 'OS quick report';
|
|
|
|
SET @page = 'os_quick_report.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'PostWidget';
|
|
|
|
SET @unique_name = 'post';
|
|
|
|
SET @description = 'Panel with a message';
|
|
|
|
SET @page = 'post.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ReportsWidget';
|
|
|
|
SET @unique_name = 'reports';
|
|
|
|
SET @description = 'Custom report';
|
|
|
|
SET @page = 'reports.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ServiceMapWidget';
|
|
|
|
SET @unique_name = 'service_map';
|
|
|
|
SET @description = 'Service map';
|
|
|
|
SET @page = 'service_map.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'ServiceViewWidget';
|
|
|
|
SET @unique_name = 'service_view';
|
|
|
|
SET @description = 'Services view';
|
|
|
|
SET @page = 'service_view.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'SingleGraphWidget';
|
|
|
|
SET @unique_name = 'single_graph';
|
|
|
|
SET @description = 'Agent module graph';
|
|
|
|
SET @page = 'single_graph.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'SLAPercentWidget';
|
|
|
|
SET @unique_name = 'sla_percent';
|
|
|
|
SET @description = 'SLA percentage';
|
|
|
|
SET @page = 'sla_percent.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'SystemGroupStatusWidget';
|
|
|
|
SET @unique_name = 'system_group_status';
|
|
|
|
SET @description = 'Groups status';
|
|
|
|
SET @page = 'system_group_status.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'TacticalWidget';
|
|
|
|
SET @unique_name = 'tactical';
|
|
|
|
SET @description = 'Tactical view';
|
|
|
|
SET @page = 'tactical.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'TopNWidget';
|
|
|
|
SET @unique_name = 'top_n';
|
|
|
|
SET @description = 'Top N of agent modules';
|
|
|
|
SET @page = 'top_n.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'TopNEventByGroupWidget';
|
|
|
|
SET @unique_name = 'top_n_events_by_group';
|
|
|
|
SET @description = 'Top N events by agent';
|
|
|
|
SET @page = 'top_n_events_by_group.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'TopNEventByModuleWidget';
|
|
|
|
SET @unique_name = 'top_n_events_by_module';
|
|
|
|
SET @description = 'Top N events by module';
|
|
|
|
SET @page = 'top_n_events_by_module.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'TreeViewWidget';
|
|
|
|
SET @unique_name = 'tree_view';
|
|
|
|
SET @description = 'Tree view';
|
|
|
|
SET @page = 'tree_view.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'UrlWidget';
|
|
|
|
SET @unique_name = 'url';
|
|
|
|
SET @description = 'URL content';
|
|
|
|
SET @page = 'url.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'WuxWidget';
|
|
|
|
SET @unique_name = 'wux_transaction';
|
|
|
|
SET @description = 'Agent WUX transaction';
|
|
|
|
SET @page = 'wux_transaction.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'WuxStatsWidget';
|
|
|
|
SET @unique_name = 'wux_transaction_stats';
|
|
|
|
SET @description = 'WUX transaction stats';
|
|
|
|
SET @page = 'wux_transaction_stats.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
|
|
|
SET @class_name = 'SecurityHardening';
|
|
|
|
SET @unique_name = 'security_hardening';
|
|
|
|
SET @description = 'Security Hardening';
|
|
|
|
SET @page = 'security_hardening.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
2023-12-20 13:21:43 +01:00
|
|
|
SET @class_name = 'ServiceLevelWidget';
|
|
|
|
SET @unique_name = 'service_level';
|
|
|
|
SET @description = 'Service Level';
|
|
|
|
SET @page = 'service_level.php';
|
|
|
|
SET @widget_id = NULL;
|
|
|
|
SELECT @widget_id := `id` FROM `twidget` WHERE `unique_name` = @unique_name;
|
|
|
|
INSERT IGNORE INTO `twidget` (`id`,`class_name`,`unique_name`,`description`,`options`,`page`) VALUES (@widget_id,@class_name,@unique_name,@description,'',@page);
|
|
|
|
|
2023-11-28 08:13:00 +01:00
|
|
|
DELETE FROM `tconfig` WHERE `token` LIKE 'translate_string_extension_installed';
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `textension_translate_string` (
|
|
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
|
|
`lang` VARCHAR(10) NOT NULL ,
|
|
|
|
`string` TEXT ,
|
|
|
|
`translation` TEXT ,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `lang_index` (`lang`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
|
|
|
|
|
|
|
DELETE FROM `tconfig` WHERE `token` LIKE 'files_repo_installed';
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `tfiles_repo` (
|
|
|
|
`id` int(5) unsigned NOT NULL auto_increment,
|
|
|
|
`name` varchar(255) NOT NULL,
|
|
|
|
`description` varchar(500) NULL default '',
|
|
|
|
`hash` varchar(8) NULL default '',
|
|
|
|
PRIMARY KEY (`id`)
|
2023-11-28 11:06:39 +01:00
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
2023-11-28 08:13:00 +01:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `tfiles_repo_group` (
|
|
|
|
`id` int(10) unsigned NOT NULL auto_increment,
|
|
|
|
`id_file` int(5) unsigned NOT NULL,
|
|
|
|
`id_group` int(4) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
FOREIGN KEY (`id_file`) REFERENCES tfiles_repo(`id`) ON DELETE CASCADE
|
2023-11-28 11:06:39 +01:00
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
2023-11-28 08:13:00 +01:00
|
|
|
|
2023-10-26 12:49:30 +02:00
|
|
|
ALTER TABLE `tncm_queue`
|
2023-10-30 10:52:13 +01:00
|
|
|
ADD COLUMN `id_agent_data` bigint unsigned AFTER `id_script`;
|
2023-10-26 12:49:30 +02:00
|
|
|
|
2023-11-22 16:12:37 +01:00
|
|
|
ALTER TABLE `tncm_queue`
|
2023-11-22 16:47:13 +01:00
|
|
|
ADD COLUMN `snippet` TEXT NULL AFTER `scheduled`;
|
2023-11-22 16:12:37 +01:00
|
|
|
|
2023-10-31 16:55:35 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `tncm_agent_data_template` (
|
2023-10-31 13:45:26 +01:00
|
|
|
`id` SERIAL,
|
|
|
|
`name` TEXT,
|
|
|
|
`vendors` TEXT,
|
|
|
|
`models` TEXT,
|
|
|
|
PRIMARY KEY (`id`)
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
|
|
|
|
|
|
|
ALTER TABLE `tncm_agent`
|
2023-10-31 16:55:35 +01:00
|
|
|
ADD COLUMN `id_agent_data_template` BIGINT UNSIGNED NULL DEFAULT NULL AFTER `id_template`;
|
2023-10-31 13:45:26 +01:00
|
|
|
|
2023-10-31 16:55:35 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `tncm_agent_data_template_scripts` (
|
2023-10-31 13:45:26 +01:00
|
|
|
`id` SERIAL,
|
2023-10-31 16:55:35 +01:00
|
|
|
`id_agent_data_template` BIGINT UNSIGNED NOT NULL,
|
2023-10-31 13:45:26 +01:00
|
|
|
`id_script` BIGINT UNSIGNED NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
2023-10-31 16:55:35 +01:00
|
|
|
FOREIGN KEY (`id_agent_data_template`) REFERENCES `tncm_agent_data_template`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
2023-10-31 13:45:26 +01:00
|
|
|
FOREIGN KEY (`id_script`) REFERENCES `tncm_script`(`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
|
|
|
|
|
|
|
|
ALTER TABLE `tncm_agent`
|
2023-10-31 16:55:35 +01:00
|
|
|
ADD COLUMN `agent_data_cron_interval` VARCHAR(100) NULL DEFAULT '' AFTER `cron_interval`;
|
2023-10-31 13:45:26 +01:00
|
|
|
|
|
|
|
ALTER TABLE `tncm_agent`
|
2023-10-31 16:55:35 +01:00
|
|
|
ADD COLUMN `agent_data_event_on_change` INT UNSIGNED NULL DEFAULT NULL AFTER `event_on_change`;
|
2023-10-31 13:45:26 +01:00
|
|
|
|
2023-11-08 14:40:47 +01:00
|
|
|
ALTER TABLE `treport_content`
|
|
|
|
ADD COLUMN `ncm_agents` MEDIUMTEXT NULL AFTER `status_of_check`;
|
|
|
|
|
2023-11-17 12:24:07 +01:00
|
|
|
-- Add needed snippet script to queue tasks.
|
|
|
|
SET @type_snippet = 6;
|
|
|
|
SELECT @id_snippet := `id` FROM `tncm_script` WHERE `type` = @type_snippet;
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_snippet, @type_snippet, 'snippet');
|
|
|
|
|
2023-11-06 15:06:16 +01:00
|
|
|
-- Add new vendor and model
|
|
|
|
SET @vendor_name = 'Cisco';
|
|
|
|
SET @model_name = 'Cisco-Generic';
|
|
|
|
SET @template_name = 'Cisco-Generic';
|
|
|
|
SET @agent_data_template_name = 'Cisco-Generic';
|
|
|
|
SET @script_test = 'enable\n
expect:Password:\s*
_enablepass_\n
exit\n';
|
|
|
|
SET @script_get_config = 'enable\n
expect:Password:\s*
_enablepass_\n
term length 0\n
capture:show running-config\n
exit\n';
|
|
|
|
SET @script_set_config = 'enable\n
expect:Password:\s*
_enablepass_\n
term length 0\n
config terminal\n
_applyconfigbackup_\n
exit\n';
|
|
|
|
SET @script_get_firmware = 'enable\n
expect:Password:\s*
_enablepass_\n
term length 0\n
capture:show version | i IOS Software\n
exit\n';
|
2023-12-12 12:12:24 +01:00
|
|
|
SET @script_set_firmware = 'copy tftp flash\n
expect:\]\?
_TFTP_SERVER_IP_\n
expect:\]\?
_SOURCE_FILE_NAME_\n
expect:\]\?
firmware.bin\n
show flash\n
reload\n
expect:confirm
y\n
config terminal\n
boot system firmware.bin\n';
|
2023-11-06 15:06:16 +01:00
|
|
|
SET @script_custom = '';
|
|
|
|
SET @script_os_version = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Try to insert vendor
|
|
|
|
INSERT IGNORE INTO `tncm_vendor` (`id`, `name`, `icon`) VALUES ('', @vendor_name, '');
|
|
|
|
-- Get vendor ID
|
|
|
|
SELECT @id_vendor := `id` FROM `tncm_vendor` WHERE `name` = @vendor_name;
|
|
|
|
|
|
|
|
-- Try to insert model
|
|
|
|
INSERT IGNORE INTO `tncm_model` (`id`, `id_vendor`, `name`) VALUES ('', @id_vendor, @model_name);
|
|
|
|
-- Get model ID
|
|
|
|
SELECT @id_model := `id` FROM `tncm_model` WHERE `id_vendor` = @id_vendor AND `name` = @model_name;
|
|
|
|
|
|
|
|
-- Get template ID if exists
|
|
|
|
SET @id_template = NULL;
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
-- Try to insert template
|
|
|
|
INSERT IGNORE INTO `tncm_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_template, @template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get template ID again if inserted
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
|
|
|
|
-- Get agent data template ID if exists
|
|
|
|
SET @id_agent_data_template = NULL;
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
-- Try to insert agent data template
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_agent_data_template, @agent_data_template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get agent data template ID again if inserted
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
|
|
|
|
-- Get test script ID if exists
|
|
|
|
SET @id_script_test = NULL;
|
|
|
|
SET @script_type = 0;
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
-- Try to insert test script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_test, @script_type, @script_test);
|
|
|
|
-- Get test script ID again if inserted
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
|
|
|
|
-- Get get_config script ID if exists
|
|
|
|
SET @id_script_get_config = NULL;
|
|
|
|
SET @script_type = 1;
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
-- Try to insert get_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_config, @script_type, @script_get_config);
|
|
|
|
-- Get get_config script ID again if inserted
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
|
|
|
|
-- Get set_config script ID if exists
|
|
|
|
SET @id_script_set_config = NULL;
|
|
|
|
SET @script_type = 2;
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
-- Try to insert set_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_config, @script_type, @script_set_config);
|
|
|
|
-- Get set_config script ID again if inserted
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
|
|
|
|
-- Get get_firmware script ID if exists
|
|
|
|
SET @id_script_get_firmware = NULL;
|
|
|
|
SET @script_type = 3;
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
-- Try to insert get_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_firmware, @script_type, @script_get_firmware);
|
|
|
|
-- Get get_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Get set_firmware script ID if exists
|
|
|
|
SET @id_script_set_firmware = NULL;
|
|
|
|
SET @script_type = 4;
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
-- Try to insert set_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_firmware, @script_type, @script_set_firmware);
|
|
|
|
-- Get set_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
|
|
|
|
-- Get custom script ID if exists
|
|
|
|
SET @id_script_custom = NULL;
|
|
|
|
SET @script_type = 5;
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
-- Try to insert custom script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_custom, @script_type, @script_custom);
|
|
|
|
-- Get custom script ID again if inserted
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
|
|
|
|
-- Get os_version script ID if exists
|
|
|
|
SET @id_script_os_version = NULL;
|
|
|
|
SET @script_type = 7;
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
-- Try to insert os_version script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_os_version, @script_type, @script_os_version);
|
|
|
|
-- Get os_version script ID again if inserted
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_test = NULL;
|
|
|
|
SELECT @id_ts_test := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_test;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_test, @id_template, @id_script_test);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_config = NULL;
|
|
|
|
SELECT @id_ts_get_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_config, @id_template, @id_script_get_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_config = NULL;
|
|
|
|
SELECT @id_ts_set_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_config, @id_template, @id_script_set_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_firmware = NULL;
|
|
|
|
SELECT @id_ts_get_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_firmware, @id_template, @id_script_get_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_firmware = NULL;
|
|
|
|
SELECT @id_ts_set_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_firmware, @id_template, @id_script_set_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_custom = NULL;
|
|
|
|
SELECT @id_ts_custom := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_custom;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_custom, @id_template, @id_script_custom);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_os_version = NULL;
|
|
|
|
SELECT @id_ts_os_version := `id` FROM `tncm_agent_data_template_scripts` WHERE `id_agent_data_template` = @id_template AND `id_script` = @id_script_os_version;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template_scripts` (`id`, `id_agent_data_template`, `id_script`) VALUES (@id_ts_os_version, @id_agent_data_template, @id_script_os_version);
|
|
|
|
|
|
|
|
-- Add new vendor and model
|
|
|
|
SET @vendor_name = 'Juniper';
|
|
|
|
SET @model_name = 'Juniper-Generic';
|
|
|
|
SET @template_name = 'Juniper-Generic';
|
|
|
|
SET @agent_data_template_name = 'Juniper-Generic';
|
|
|
|
SET @script_test = 'expect:root@%
cli\n
exit\n';
|
2023-11-17 10:22:52 +01:00
|
|
|
SET @script_get_config = 'expect:root@%
cli\n
expect:root>
capture:show configuration | no-more\n
capture:\n
quit\n
expect:root@%
exit\n';
|
2023-11-06 15:06:16 +01:00
|
|
|
SET @script_set_config = 'expect:root@%
cli\n
expect:root>
configure\n
load override terminal\n
_applyconfigbackup_\n
commit\n
exit\n';
|
|
|
|
SET @script_get_firmware = 'expect:root@%
cli\n
expect:root>
capture:show version|match Junos:\n
capture: \n
quit\n
expect:root@%
exit\n';
|
|
|
|
SET @script_set_firmware = 'expect:root@%
cli\n
expect:root>
save software from tftp _TFTP_SERVER_IP_ _FIRMWARE_NAME_ to flash\n
reset\n
exit\n';
|
|
|
|
SET @script_custom = '';
|
|
|
|
SET @script_os_version = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Try to insert vendor
|
|
|
|
INSERT IGNORE INTO `tncm_vendor` (`id`, `name`, `icon`) VALUES ('', @vendor_name, '');
|
|
|
|
-- Get vendor ID
|
|
|
|
SELECT @id_vendor := `id` FROM `tncm_vendor` WHERE `name` = @vendor_name;
|
|
|
|
|
|
|
|
-- Try to insert model
|
|
|
|
INSERT IGNORE INTO `tncm_model` (`id`, `id_vendor`, `name`) VALUES ('', @id_vendor, @model_name);
|
|
|
|
-- Get model ID
|
|
|
|
SELECT @id_model := `id` FROM `tncm_model` WHERE `id_vendor` = @id_vendor AND `name` = @model_name;
|
|
|
|
|
|
|
|
-- Get template ID if exists
|
|
|
|
SET @id_template = NULL;
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
-- Try to insert template
|
|
|
|
INSERT IGNORE INTO `tncm_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_template, @template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get template ID again if inserted
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
|
|
|
|
-- Get agent data template ID if exists
|
|
|
|
SET @id_agent_data_template = NULL;
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
-- Try to insert agent data template
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_agent_data_template, @agent_data_template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get agent data template ID again if inserted
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
|
|
|
|
-- Get test script ID if exists
|
|
|
|
SET @id_script_test = NULL;
|
|
|
|
SET @script_type = 0;
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
-- Try to insert test script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_test, @script_type, @script_test);
|
|
|
|
-- Get test script ID again if inserted
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
|
|
|
|
-- Get get_config script ID if exists
|
|
|
|
SET @id_script_get_config = NULL;
|
|
|
|
SET @script_type = 1;
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
-- Try to insert get_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_config, @script_type, @script_get_config);
|
|
|
|
-- Get get_config script ID again if inserted
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
|
|
|
|
-- Get set_config script ID if exists
|
|
|
|
SET @id_script_set_config = NULL;
|
|
|
|
SET @script_type = 2;
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
-- Try to insert set_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_config, @script_type, @script_set_config);
|
|
|
|
-- Get set_config script ID again if inserted
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
|
|
|
|
-- Get get_firmware script ID if exists
|
|
|
|
SET @id_script_get_firmware = NULL;
|
|
|
|
SET @script_type = 3;
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
-- Try to insert get_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_firmware, @script_type, @script_get_firmware);
|
|
|
|
-- Get get_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Get set_firmware script ID if exists
|
|
|
|
SET @id_script_set_firmware = NULL;
|
|
|
|
SET @script_type = 4;
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
-- Try to insert set_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_firmware, @script_type, @script_set_firmware);
|
|
|
|
-- Get set_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
|
|
|
|
-- Get custom script ID if exists
|
|
|
|
SET @id_script_custom = NULL;
|
|
|
|
SET @script_type = 5;
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
-- Try to insert custom script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_custom, @script_type, @script_custom);
|
|
|
|
-- Get custom script ID again if inserted
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
|
|
|
|
-- Get os_version script ID if exists
|
|
|
|
SET @id_script_os_version = NULL;
|
|
|
|
SET @script_type = 7;
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
-- Try to insert os_version script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_os_version, @script_type, @script_os_version);
|
|
|
|
-- Get os_version script ID again if inserted
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_test = NULL;
|
|
|
|
SELECT @id_ts_test := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_test;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_test, @id_template, @id_script_test);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_config = NULL;
|
|
|
|
SELECT @id_ts_get_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_config, @id_template, @id_script_get_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_config = NULL;
|
|
|
|
SELECT @id_ts_set_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_config, @id_template, @id_script_set_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_firmware = NULL;
|
|
|
|
SELECT @id_ts_get_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_firmware, @id_template, @id_script_get_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_firmware = NULL;
|
|
|
|
SELECT @id_ts_set_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_firmware, @id_template, @id_script_set_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_custom = NULL;
|
|
|
|
SELECT @id_ts_custom := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_custom;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_custom, @id_template, @id_script_custom);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_os_version = NULL;
|
|
|
|
SELECT @id_ts_os_version := `id` FROM `tncm_agent_data_template_scripts` WHERE `id_agent_data_template` = @id_template AND `id_script` = @id_script_os_version;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template_scripts` (`id`, `id_agent_data_template`, `id_script`) VALUES (@id_ts_os_version, @id_agent_data_template, @id_script_os_version);
|
|
|
|
|
|
|
|
-- Add new vendor and model
|
|
|
|
SET @vendor_name = 'Palo Alto';
|
|
|
|
SET @model_name = 'Palo Alto-Generic';
|
|
|
|
SET @template_name = 'Palo Alto-Generic';
|
|
|
|
SET @agent_data_template_name = 'Palo Alto-Generic';
|
|
|
|
SET @script_test = 'sleep:1
exit\n';
|
|
|
|
SET @script_get_config = 'set cli pager off \n
capture:show config running\n
exit\n';
|
|
|
|
SET @script_set_config = 'set cli terminal width 500\n
set cli scripting-mode on\n
configure\n
_applyconfigbackup_\n
commit\n';
|
|
|
|
SET @script_get_firmware = 'set cli pager off \n
capture:show system info | match app-version:\n
sleep:1 
expect:app-version:\s*
exit \n';
|
|
|
|
SET @script_set_firmware = 'tftp import software from _TFTP_SERVER_IP_ file _FIRMWARE_NAME_\n
request system software install version\n
reboot\n
exit\n';
|
|
|
|
SET @script_custom = '';
|
|
|
|
SET @script_os_version = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Try to insert vendor
|
|
|
|
INSERT IGNORE INTO `tncm_vendor` (`id`, `name`, `icon`) VALUES ('', @vendor_name, '');
|
|
|
|
-- Get vendor ID
|
|
|
|
SELECT @id_vendor := `id` FROM `tncm_vendor` WHERE `name` = @vendor_name;
|
|
|
|
|
|
|
|
-- Try to insert model
|
|
|
|
INSERT IGNORE INTO `tncm_model` (`id`, `id_vendor`, `name`) VALUES ('', @id_vendor, @model_name);
|
|
|
|
-- Get model ID
|
|
|
|
SELECT @id_model := `id` FROM `tncm_model` WHERE `id_vendor` = @id_vendor AND `name` = @model_name;
|
|
|
|
|
|
|
|
-- Get template ID if exists
|
|
|
|
SET @id_template = NULL;
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
-- Try to insert template
|
|
|
|
INSERT IGNORE INTO `tncm_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_template, @template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get template ID again if inserted
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
|
|
|
|
-- Get agent data template ID if exists
|
|
|
|
SET @id_agent_data_template = NULL;
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
-- Try to insert agent data template
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_agent_data_template, @agent_data_template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get agent data template ID again if inserted
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
|
|
|
|
-- Get test script ID if exists
|
|
|
|
SET @id_script_test = NULL;
|
|
|
|
SET @script_type = 0;
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
-- Try to insert test script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_test, @script_type, @script_test);
|
|
|
|
-- Get test script ID again if inserted
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
|
|
|
|
-- Get get_config script ID if exists
|
|
|
|
SET @id_script_get_config = NULL;
|
|
|
|
SET @script_type = 1;
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
-- Try to insert get_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_config, @script_type, @script_get_config);
|
|
|
|
-- Get get_config script ID again if inserted
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
|
|
|
|
-- Get set_config script ID if exists
|
|
|
|
SET @id_script_set_config = NULL;
|
|
|
|
SET @script_type = 2;
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
-- Try to insert set_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_config, @script_type, @script_set_config);
|
|
|
|
-- Get set_config script ID again if inserted
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
|
|
|
|
-- Get get_firmware script ID if exists
|
|
|
|
SET @id_script_get_firmware = NULL;
|
|
|
|
SET @script_type = 3;
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
-- Try to insert get_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_firmware, @script_type, @script_get_firmware);
|
|
|
|
-- Get get_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Get set_firmware script ID if exists
|
|
|
|
SET @id_script_set_firmware = NULL;
|
|
|
|
SET @script_type = 4;
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
-- Try to insert set_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_firmware, @script_type, @script_set_firmware);
|
|
|
|
-- Get set_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
|
|
|
|
-- Get custom script ID if exists
|
|
|
|
SET @id_script_custom = NULL;
|
|
|
|
SET @script_type = 5;
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
-- Try to insert custom script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_custom, @script_type, @script_custom);
|
|
|
|
-- Get custom script ID again if inserted
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
|
|
|
|
-- Get os_version script ID if exists
|
|
|
|
SET @id_script_os_version = NULL;
|
|
|
|
SET @script_type = 7;
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
-- Try to insert os_version script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_os_version, @script_type, @script_os_version);
|
|
|
|
-- Get os_version script ID again if inserted
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_test = NULL;
|
|
|
|
SELECT @id_ts_test := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_test;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_test, @id_template, @id_script_test);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_config = NULL;
|
|
|
|
SELECT @id_ts_get_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_config, @id_template, @id_script_get_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_config = NULL;
|
|
|
|
SELECT @id_ts_set_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_config, @id_template, @id_script_set_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_firmware = NULL;
|
|
|
|
SELECT @id_ts_get_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_firmware, @id_template, @id_script_get_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_firmware = NULL;
|
|
|
|
SELECT @id_ts_set_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_firmware, @id_template, @id_script_set_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_custom = NULL;
|
|
|
|
SELECT @id_ts_custom := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_custom;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_custom, @id_template, @id_script_custom);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_os_version = NULL;
|
|
|
|
SELECT @id_ts_os_version := `id` FROM `tncm_agent_data_template_scripts` WHERE `id_agent_data_template` = @id_template AND `id_script` = @id_script_os_version;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template_scripts` (`id`, `id_agent_data_template`, `id_script`) VALUES (@id_ts_os_version, @id_agent_data_template, @id_script_os_version);
|
|
|
|
|
|
|
|
-- Add new vendor and model
|
|
|
|
SET @vendor_name = 'A10';
|
|
|
|
SET @model_name = 'A10-Generic';
|
|
|
|
SET @template_name = 'A10-Generic';
|
|
|
|
SET @agent_data_template_name = 'A10-Generic';
|
|
|
|
SET @script_test = 'sleep:1
enable\n
expect:Password:\s*
_enablepass_\n';
|
|
|
|
SET @script_get_config = 'sleep:1
enable\n
expect:Password:\s*
_enablepass_\n
capture:show running-config\n
exit\n';
|
|
|
|
SET @script_set_config = 'sleep:1
enable\n
expect:Password:\s*
_enablepass_\n
configure\n
_applyconfigbackup_\n
exit\n';
|
|
|
|
SET @script_get_firmware = 'sleep:1
enable\n
expect:Password:\s*
_enablepass_\n
capture:show version\n
exit\n';
|
|
|
|
SET @script_set_firmware = 'sleep:1
enable\n
expect:Password:\s*
_enablepass_\n
configure\n
expect:(config)
restore _TFTP_SERVER_IP_/_FIRMWARE_NAME_\n
expect:Password:\s*
_enablepass_\n
expect:skip port map
yes\n
expect: see the diff
yes\n
sleep:1
expect:Proceed with reboot
yes\n
expect:eof';
|
|
|
|
SET @script_custom = '';
|
|
|
|
SET @script_os_version = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Try to insert vendor
|
|
|
|
INSERT IGNORE INTO `tncm_vendor` (`id`, `name`, `icon`) VALUES ('', @vendor_name, '');
|
|
|
|
-- Get vendor ID
|
|
|
|
SELECT @id_vendor := `id` FROM `tncm_vendor` WHERE `name` = @vendor_name;
|
|
|
|
|
|
|
|
-- Try to insert model
|
|
|
|
INSERT IGNORE INTO `tncm_model` (`id`, `id_vendor`, `name`) VALUES ('', @id_vendor, @model_name);
|
|
|
|
-- Get model ID
|
|
|
|
SELECT @id_model := `id` FROM `tncm_model` WHERE `id_vendor` = @id_vendor AND `name` = @model_name;
|
|
|
|
|
|
|
|
-- Get template ID if exists
|
|
|
|
SET @id_template = NULL;
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
-- Try to insert template
|
|
|
|
INSERT IGNORE INTO `tncm_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_template, @template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get template ID again if inserted
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
|
|
|
|
-- Get agent data template ID if exists
|
|
|
|
SET @id_agent_data_template = NULL;
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
-- Try to insert agent data template
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_agent_data_template, @agent_data_template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get agent data template ID again if inserted
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
|
|
|
|
-- Get test script ID if exists
|
|
|
|
SET @id_script_test = NULL;
|
|
|
|
SET @script_type = 0;
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
-- Try to insert test script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_test, @script_type, @script_test);
|
|
|
|
-- Get test script ID again if inserted
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
|
|
|
|
-- Get get_config script ID if exists
|
|
|
|
SET @id_script_get_config = NULL;
|
|
|
|
SET @script_type = 1;
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
-- Try to insert get_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_config, @script_type, @script_get_config);
|
|
|
|
-- Get get_config script ID again if inserted
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
|
|
|
|
-- Get set_config script ID if exists
|
|
|
|
SET @id_script_set_config = NULL;
|
|
|
|
SET @script_type = 2;
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
-- Try to insert set_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_config, @script_type, @script_set_config);
|
|
|
|
-- Get set_config script ID again if inserted
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
|
|
|
|
-- Get get_firmware script ID if exists
|
|
|
|
SET @id_script_get_firmware = NULL;
|
|
|
|
SET @script_type = 3;
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
-- Try to insert get_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_firmware, @script_type, @script_get_firmware);
|
|
|
|
-- Get get_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Get set_firmware script ID if exists
|
|
|
|
SET @id_script_set_firmware = NULL;
|
|
|
|
SET @script_type = 4;
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
-- Try to insert set_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_firmware, @script_type, @script_set_firmware);
|
|
|
|
-- Get set_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
|
|
|
|
-- Get custom script ID if exists
|
|
|
|
SET @id_script_custom = NULL;
|
|
|
|
SET @script_type = 5;
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
-- Try to insert custom script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_custom, @script_type, @script_custom);
|
|
|
|
-- Get custom script ID again if inserted
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
|
|
|
|
-- Get os_version script ID if exists
|
|
|
|
SET @id_script_os_version = NULL;
|
|
|
|
SET @script_type = 7;
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
-- Try to insert os_version script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_os_version, @script_type, @script_os_version);
|
|
|
|
-- Get os_version script ID again if inserted
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_test = NULL;
|
|
|
|
SELECT @id_ts_test := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_test;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_test, @id_template, @id_script_test);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_config = NULL;
|
|
|
|
SELECT @id_ts_get_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_config, @id_template, @id_script_get_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_config = NULL;
|
|
|
|
SELECT @id_ts_set_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_config, @id_template, @id_script_set_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_firmware = NULL;
|
|
|
|
SELECT @id_ts_get_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_firmware, @id_template, @id_script_get_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_firmware = NULL;
|
|
|
|
SELECT @id_ts_set_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_firmware, @id_template, @id_script_set_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_custom = NULL;
|
|
|
|
SELECT @id_ts_custom := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_custom;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_custom, @id_template, @id_script_custom);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_os_version = NULL;
|
|
|
|
SELECT @id_ts_os_version := `id` FROM `tncm_agent_data_template_scripts` WHERE `id_agent_data_template` = @id_template AND `id_script` = @id_script_os_version;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template_scripts` (`id`, `id_agent_data_template`, `id_script`) VALUES (@id_ts_os_version, @id_agent_data_template, @id_script_os_version);
|
|
|
|
|
|
|
|
-- Add new vendor and model
|
|
|
|
SET @vendor_name = 'Alcatel-Lucent Enterprise';
|
|
|
|
SET @model_name = 'Alcatel-Generic';
|
|
|
|
SET @template_name = 'Alcatel-Generic';
|
|
|
|
SET @agent_data_template_name = 'Alcatel-Generic';
|
|
|
|
SET @script_test = 'enable\n
expect:Password:\s*
_enablepass_\n
exit\n';
|
|
|
|
SET @script_get_config = 'enable\n
expect:Password:\s*
_enablepass_\n
capture:admin display-config\n
logout\n';
|
|
|
|
SET @script_set_config = '';
|
|
|
|
SET @script_get_firmware = 'enable\n
expect:Password:\s*
_enablepass_\n
capture:show version\n
logout\n';
|
|
|
|
SET @script_set_firmware = '';
|
|
|
|
SET @script_custom = '';
|
|
|
|
SET @script_os_version = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Try to insert vendor
|
|
|
|
INSERT IGNORE INTO `tncm_vendor` (`id`, `name`, `icon`) VALUES ('', @vendor_name, '');
|
|
|
|
-- Get vendor ID
|
|
|
|
SELECT @id_vendor := `id` FROM `tncm_vendor` WHERE `name` = @vendor_name;
|
|
|
|
|
|
|
|
-- Try to insert model
|
|
|
|
INSERT IGNORE INTO `tncm_model` (`id`, `id_vendor`, `name`) VALUES ('', @id_vendor, @model_name);
|
|
|
|
-- Get model ID
|
|
|
|
SELECT @id_model := `id` FROM `tncm_model` WHERE `id_vendor` = @id_vendor AND `name` = @model_name;
|
|
|
|
|
|
|
|
-- Get template ID if exists
|
|
|
|
SET @id_template = NULL;
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
-- Try to insert template
|
|
|
|
INSERT IGNORE INTO `tncm_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_template, @template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get template ID again if inserted
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
|
|
|
|
-- Get agent data template ID if exists
|
|
|
|
SET @id_agent_data_template = NULL;
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
-- Try to insert agent data template
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_agent_data_template, @agent_data_template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get agent data template ID again if inserted
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
|
|
|
|
-- Get test script ID if exists
|
|
|
|
SET @id_script_test = NULL;
|
|
|
|
SET @script_type = 0;
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
-- Try to insert test script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_test, @script_type, @script_test);
|
|
|
|
-- Get test script ID again if inserted
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
|
|
|
|
-- Get get_config script ID if exists
|
|
|
|
SET @id_script_get_config = NULL;
|
|
|
|
SET @script_type = 1;
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
-- Try to insert get_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_config, @script_type, @script_get_config);
|
|
|
|
-- Get get_config script ID again if inserted
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
|
|
|
|
-- Get set_config script ID if exists
|
|
|
|
SET @id_script_set_config = NULL;
|
|
|
|
SET @script_type = 2;
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
-- Try to insert set_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_config, @script_type, @script_set_config);
|
|
|
|
-- Get set_config script ID again if inserted
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
|
|
|
|
-- Get get_firmware script ID if exists
|
|
|
|
SET @id_script_get_firmware = NULL;
|
|
|
|
SET @script_type = 3;
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
-- Try to insert get_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_firmware, @script_type, @script_get_firmware);
|
|
|
|
-- Get get_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Get set_firmware script ID if exists
|
|
|
|
SET @id_script_set_firmware = NULL;
|
|
|
|
SET @script_type = 4;
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
-- Try to insert set_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_firmware, @script_type, @script_set_firmware);
|
|
|
|
-- Get set_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
|
|
|
|
-- Get custom script ID if exists
|
|
|
|
SET @id_script_custom = NULL;
|
|
|
|
SET @script_type = 5;
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
-- Try to insert custom script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_custom, @script_type, @script_custom);
|
|
|
|
-- Get custom script ID again if inserted
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
|
|
|
|
-- Get os_version script ID if exists
|
|
|
|
SET @id_script_os_version = NULL;
|
|
|
|
SET @script_type = 7;
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
-- Try to insert os_version script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_os_version, @script_type, @script_os_version);
|
|
|
|
-- Get os_version script ID again if inserted
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_test = NULL;
|
|
|
|
SELECT @id_ts_test := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_test;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_test, @id_template, @id_script_test);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_config = NULL;
|
|
|
|
SELECT @id_ts_get_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_config, @id_template, @id_script_get_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_config = NULL;
|
|
|
|
SELECT @id_ts_set_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_config, @id_template, @id_script_set_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_firmware = NULL;
|
|
|
|
SELECT @id_ts_get_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_firmware, @id_template, @id_script_get_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_firmware = NULL;
|
|
|
|
SELECT @id_ts_set_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_firmware, @id_template, @id_script_set_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_custom = NULL;
|
|
|
|
SELECT @id_ts_custom := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_custom;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_custom, @id_template, @id_script_custom);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_os_version = NULL;
|
|
|
|
SELECT @id_ts_os_version := `id` FROM `tncm_agent_data_template_scripts` WHERE `id_agent_data_template` = @id_template AND `id_script` = @id_script_os_version;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template_scripts` (`id`, `id_agent_data_template`, `id_script`) VALUES (@id_ts_os_version, @id_agent_data_template, @id_script_os_version);
|
|
|
|
|
|
|
|
-- Add new vendor and model
|
|
|
|
SET @vendor_name = 'Aruba';
|
|
|
|
SET @model_name = 'Aruba-Generic';
|
|
|
|
SET @template_name = 'Aruba-Generic';
|
|
|
|
SET @agent_data_template_name = 'Aruba-Generic';
|
|
|
|
SET @script_test = 'enable\n
expect:Password:\s*
_enablepass_\n
exit\n';
|
|
|
|
SET @script_get_config = 'enable\n
expect:Password:\s*
_enablepass_\n
capture:show running-config\n
exit\n';
|
|
|
|
SET @script_set_config = 'configure terminal\n
load replace /var/tmp/file.conf\n
end\n
write memory\n
exit\n';
|
|
|
|
SET @script_get_firmware = 'enable\n
expect:Password:\s*
_enablepass_\n
capture:show version\n
exit\n';
|
2023-12-12 12:12:24 +01:00
|
|
|
SET @script_set_firmware = 'copy tftp flash _TFTP_SERVER_IP_ firmware.bin.swi secondary\n
boot system flash secondary\n
copy tftp flash  _TFTP_SERVER_IP_ firmware.bin primary\n
boot system flash primary\n';
|
2023-11-06 15:06:16 +01:00
|
|
|
SET @script_custom = '';
|
|
|
|
SET @script_os_version = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Try to insert vendor
|
|
|
|
INSERT IGNORE INTO `tncm_vendor` (`id`, `name`, `icon`) VALUES ('', @vendor_name, '');
|
|
|
|
-- Get vendor ID
|
|
|
|
SELECT @id_vendor := `id` FROM `tncm_vendor` WHERE `name` = @vendor_name;
|
|
|
|
|
|
|
|
-- Try to insert model
|
|
|
|
INSERT IGNORE INTO `tncm_model` (`id`, `id_vendor`, `name`) VALUES ('', @id_vendor, @model_name);
|
|
|
|
-- Get model ID
|
|
|
|
SELECT @id_model := `id` FROM `tncm_model` WHERE `id_vendor` = @id_vendor AND `name` = @model_name;
|
|
|
|
|
|
|
|
-- Get template ID if exists
|
|
|
|
SET @id_template = NULL;
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
-- Try to insert template
|
|
|
|
INSERT IGNORE INTO `tncm_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_template, @template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get template ID again if inserted
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
|
|
|
|
-- Get agent data template ID if exists
|
|
|
|
SET @id_agent_data_template = NULL;
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
-- Try to insert agent data template
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_agent_data_template, @agent_data_template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get agent data template ID again if inserted
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
|
|
|
|
-- Get test script ID if exists
|
|
|
|
SET @id_script_test = NULL;
|
|
|
|
SET @script_type = 0;
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
-- Try to insert test script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_test, @script_type, @script_test);
|
|
|
|
-- Get test script ID again if inserted
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
|
|
|
|
-- Get get_config script ID if exists
|
|
|
|
SET @id_script_get_config = NULL;
|
|
|
|
SET @script_type = 1;
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
-- Try to insert get_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_config, @script_type, @script_get_config);
|
|
|
|
-- Get get_config script ID again if inserted
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
|
|
|
|
-- Get set_config script ID if exists
|
|
|
|
SET @id_script_set_config = NULL;
|
|
|
|
SET @script_type = 2;
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
-- Try to insert set_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_config, @script_type, @script_set_config);
|
|
|
|
-- Get set_config script ID again if inserted
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
|
|
|
|
-- Get get_firmware script ID if exists
|
|
|
|
SET @id_script_get_firmware = NULL;
|
|
|
|
SET @script_type = 3;
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
-- Try to insert get_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_firmware, @script_type, @script_get_firmware);
|
|
|
|
-- Get get_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Get set_firmware script ID if exists
|
|
|
|
SET @id_script_set_firmware = NULL;
|
|
|
|
SET @script_type = 4;
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
-- Try to insert set_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_firmware, @script_type, @script_set_firmware);
|
|
|
|
-- Get set_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
|
|
|
|
-- Get custom script ID if exists
|
|
|
|
SET @id_script_custom = NULL;
|
|
|
|
SET @script_type = 5;
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
-- Try to insert custom script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_custom, @script_type, @script_custom);
|
|
|
|
-- Get custom script ID again if inserted
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
|
|
|
|
-- Get os_version script ID if exists
|
|
|
|
SET @id_script_os_version = NULL;
|
|
|
|
SET @script_type = 7;
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
-- Try to insert os_version script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_os_version, @script_type, @script_os_version);
|
|
|
|
-- Get os_version script ID again if inserted
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_test = NULL;
|
|
|
|
SELECT @id_ts_test := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_test;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_test, @id_template, @id_script_test);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_config = NULL;
|
|
|
|
SELECT @id_ts_get_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_config, @id_template, @id_script_get_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_config = NULL;
|
|
|
|
SELECT @id_ts_set_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_config, @id_template, @id_script_set_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_firmware = NULL;
|
|
|
|
SELECT @id_ts_get_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_firmware, @id_template, @id_script_get_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_firmware = NULL;
|
|
|
|
SELECT @id_ts_set_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_firmware, @id_template, @id_script_set_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_custom = NULL;
|
|
|
|
SELECT @id_ts_custom := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_custom;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_custom, @id_template, @id_script_custom);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_os_version = NULL;
|
|
|
|
SELECT @id_ts_os_version := `id` FROM `tncm_agent_data_template_scripts` WHERE `id_agent_data_template` = @id_template AND `id_script` = @id_script_os_version;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template_scripts` (`id`, `id_agent_data_template`, `id_script`) VALUES (@id_ts_os_version, @id_agent_data_template, @id_script_os_version);
|
|
|
|
|
|
|
|
-- Add new vendor and model
|
|
|
|
SET @vendor_name = 'Mikrotik';
|
|
|
|
SET @model_name = 'Mikrotik-Generic';
|
|
|
|
SET @template_name = 'Mikrotik-Generic';
|
|
|
|
SET @agent_data_template_name = 'Mikrotik-Generic';
|
|
|
|
SET @script_test = 'sleep:1
exit\n\r';
|
|
|
|
SET @script_get_config = 'sleep:1
capture:system resource print\n\r 
exit\n\r';
|
|
|
|
SET @script_set_config = 'sleep:1
system backup load name=_nameBackup_ password=_passwordBackup_\n\r
expect:Restore
yes\n\r
exit\n\r';
|
|
|
|
SET @script_get_firmware = 'sleep:1
capture:/system package print\n\r 
exit\n\r';
|
|
|
|
SET @script_set_firmware = 'sleep:1
/system routerboard upgrade\n\r
expect:Do
yes\n\r
exit\n\r';
|
|
|
|
SET @script_custom = '';
|
|
|
|
SET @script_os_version = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Try to insert vendor
|
|
|
|
INSERT IGNORE INTO `tncm_vendor` (`id`, `name`, `icon`) VALUES ('', @vendor_name, '');
|
|
|
|
-- Get vendor ID
|
|
|
|
SELECT @id_vendor := `id` FROM `tncm_vendor` WHERE `name` = @vendor_name;
|
|
|
|
|
|
|
|
-- Try to insert model
|
|
|
|
INSERT IGNORE INTO `tncm_model` (`id`, `id_vendor`, `name`) VALUES ('', @id_vendor, @model_name);
|
|
|
|
-- Get model ID
|
|
|
|
SELECT @id_model := `id` FROM `tncm_model` WHERE `id_vendor` = @id_vendor AND `name` = @model_name;
|
|
|
|
|
|
|
|
-- Get template ID if exists
|
|
|
|
SET @id_template = NULL;
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
-- Try to insert template
|
|
|
|
INSERT IGNORE INTO `tncm_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_template, @template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get template ID again if inserted
|
|
|
|
SELECT @id_template := `id` FROM `tncm_template` WHERE `name` = @template_name;
|
|
|
|
|
|
|
|
-- Get agent data template ID if exists
|
|
|
|
SET @id_agent_data_template = NULL;
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
-- Try to insert agent data template
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template` (`id`, `name`, `vendors`, `models`) VALUES (@id_agent_data_template, @agent_data_template_name, CONCAT('[',@id_vendor,']'), CONCAT('[',@id_model,']'));
|
|
|
|
-- Get agent data template ID again if inserted
|
|
|
|
SELECT @id_agent_data_template := `id` FROM `tncm_agent_data_template` WHERE `name` = @agent_data_template_name;
|
|
|
|
|
|
|
|
-- Get test script ID if exists
|
|
|
|
SET @id_script_test = NULL;
|
|
|
|
SET @script_type = 0;
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
-- Try to insert test script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_test, @script_type, @script_test);
|
|
|
|
-- Get test script ID again if inserted
|
|
|
|
SELECT @id_script_test := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_test;
|
|
|
|
|
|
|
|
-- Get get_config script ID if exists
|
|
|
|
SET @id_script_get_config = NULL;
|
|
|
|
SET @script_type = 1;
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
-- Try to insert get_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_config, @script_type, @script_get_config);
|
|
|
|
-- Get get_config script ID again if inserted
|
|
|
|
SELECT @id_script_get_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_config;
|
|
|
|
|
|
|
|
-- Get set_config script ID if exists
|
|
|
|
SET @id_script_set_config = NULL;
|
|
|
|
SET @script_type = 2;
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
-- Try to insert set_config script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_config, @script_type, @script_set_config);
|
|
|
|
-- Get set_config script ID again if inserted
|
|
|
|
SELECT @id_script_set_config := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_config;
|
|
|
|
|
|
|
|
-- Get get_firmware script ID if exists
|
|
|
|
SET @id_script_get_firmware = NULL;
|
|
|
|
SET @script_type = 3;
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
-- Try to insert get_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_get_firmware, @script_type, @script_get_firmware);
|
|
|
|
-- Get get_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_get_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_get_firmware;
|
|
|
|
|
|
|
|
-- Get set_firmware script ID if exists
|
|
|
|
SET @id_script_set_firmware = NULL;
|
|
|
|
SET @script_type = 4;
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
-- Try to insert set_firmware script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_set_firmware, @script_type, @script_set_firmware);
|
|
|
|
-- Get set_firmware script ID again if inserted
|
|
|
|
SELECT @id_script_set_firmware := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_set_firmware;
|
|
|
|
|
|
|
|
-- Get custom script ID if exists
|
|
|
|
SET @id_script_custom = NULL;
|
|
|
|
SET @script_type = 5;
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
-- Try to insert custom script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_custom, @script_type, @script_custom);
|
|
|
|
-- Get custom script ID again if inserted
|
|
|
|
SELECT @id_script_custom := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_custom;
|
|
|
|
|
|
|
|
-- Get os_version script ID if exists
|
|
|
|
SET @id_script_os_version = NULL;
|
|
|
|
SET @script_type = 7;
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
-- Try to insert os_version script
|
|
|
|
INSERT IGNORE INTO `tncm_script` (`id`, `type`, `content`) VALUES (@id_script_os_version, @script_type, @script_os_version);
|
|
|
|
-- Get os_version script ID again if inserted
|
|
|
|
SELECT @id_script_os_version := `id` FROM `tncm_script` WHERE `type` = @script_type AND `content` = @script_os_version;
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_test = NULL;
|
|
|
|
SELECT @id_ts_test := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_test;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_test, @id_template, @id_script_test);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_config = NULL;
|
|
|
|
SELECT @id_ts_get_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_config, @id_template, @id_script_get_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_config = NULL;
|
|
|
|
SELECT @id_ts_set_config := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_config;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_config, @id_template, @id_script_set_config);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_get_firmware = NULL;
|
|
|
|
SELECT @id_ts_get_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_get_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_get_firmware, @id_template, @id_script_get_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_set_firmware = NULL;
|
|
|
|
SELECT @id_ts_set_firmware := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_set_firmware;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_set_firmware, @id_template, @id_script_set_firmware);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_custom = NULL;
|
|
|
|
SELECT @id_ts_custom := `id` FROM `tncm_template_scripts` WHERE `id_template` = @id_template AND `id_script` = @id_script_custom;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_template_scripts` (`id`, `id_template`, `id_script`) VALUES (@id_ts_custom, @id_template, @id_script_custom);
|
|
|
|
|
|
|
|
-- Get template scripts ID if exists
|
|
|
|
SET @id_ts_os_version = NULL;
|
|
|
|
SELECT @id_ts_os_version := `id` FROM `tncm_agent_data_template_scripts` WHERE `id_agent_data_template` = @id_template AND `id_script` = @id_script_os_version;
|
|
|
|
-- Try to insert
|
|
|
|
INSERT IGNORE INTO `tncm_agent_data_template_scripts` (`id`, `id_agent_data_template`, `id_script`) VALUES (@id_ts_os_version, @id_agent_data_template, @id_script_os_version);
|
2023-10-31 13:45:26 +01:00
|
|
|
|
2023-09-22 12:24:15 +02:00
|
|
|
ALTER TABLE `tevento`
|
2023-09-25 10:32:23 +02:00
|
|
|
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
|
2023-11-28 15:10:02 +01:00
|
|
|
-- Telegram and vonage default alerts
|
2023-11-14 15:34:14 +01:00
|
|
|
UPDATE talert_actions
|
|
|
|
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
|
|
|
WHERE id=9;
|
|
|
|
UPDATE talert_actions
|
|
|
|
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
|
|
|
WHERE id=11;
|
2023-09-22 12:24:15 +02:00
|
|
|
|
2023-11-08 11:56:32 +01:00
|
|
|
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmetaconsole_agent' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
|
|
|
|
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmetaconsole_agent` DROP COLUMN `transactional_agent`', 'SELECT ""');
|
|
|
|
prepare stmt from @sqlstmt;
|
|
|
|
execute stmt;
|
|
|
|
|
|
|
|
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tagente' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
|
|
|
|
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tagente` DROP COLUMN `transactional_agent`', 'SELECT ""');
|
|
|
|
prepare stmt from @sqlstmt;
|
|
|
|
execute stmt;
|
|
|
|
|
2023-12-14 11:03:45 +01:00
|
|
|
ALTER TABLE `tlayout_template_data` ADD COLUMN `title` TEXT default '';
|
|
|
|
ALTER TABLE `tlayout_data` ADD COLUMN `period_chart_options` TEXT default '';
|
|
|
|
ALTER TABLE `tlayout_template_data` ADD COLUMN `period_chart_options` TEXT default '';
|
|
|
|
|
2023-12-07 11:44:59 +01:00
|
|
|
ALTER TABLE `tdashboard`
|
|
|
|
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
|
|
|
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
|
|
|
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
|
|
|
|
|
2023-11-27 08:19:33 +01:00
|
|
|
-- Delete table tagent_access
|
2023-12-07 10:21:57 +01:00
|
|
|
DROP TABLE IF EXISTS tagent_access;
|
2023-11-27 08:19:33 +01:00
|
|
|
|
2023-11-07 15:56:23 +01:00
|
|
|
ALTER TABLE `tevent_rule` DROP COLUMN `user_comment`;
|
|
|
|
ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
|
2023-11-27 08:19:33 +01:00
|
|
|
|
2023-09-20 08:49:56 +02:00
|
|
|
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
|
|
|
|
2023-12-07 11:44:59 +01:00
|
|
|
ALTER TABLE `tevent_filter` ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
|
2023-11-28 10:59:04 +01:00
|
|
|
-- Update macros for plugin oracle
|
|
|
|
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
|
|
|
|
|
2023-12-19 18:37:49 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS `tpolicy_modules_synth` (
|
|
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
|
|
`id_agent_module_source` INT UNSIGNED NOT NULL DEFAULT 0,
|
|
|
|
`id_agent_module_target` INT UNSIGNED NOT NULL DEFAULT 0,
|
|
|
|
`fixed_value` DOUBLE NOT NULL DEFAULT 0,
|
|
|
|
`operation` enum ('ADD', 'SUB', 'DIV', 'MUL', 'AVG', 'NOP') NOT NULL DEFAULT 'NOP',
|
|
|
|
`order` INT NOT NULL DEFAULT 0,
|
|
|
|
FOREIGN KEY (`id_agent_module_target`) REFERENCES tpolicy_modules(`id`)
|
|
|
|
ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
|
PRIMARY KEY (id)
|
|
|
|
);
|
|
|
|
|
2023-11-28 10:59:04 +01:00
|
|
|
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
|
|
|
|
|
|
|
|
UPDATE `tdiscovery_apps_tasks_macros` SET `value` = 'agents_group_id=__taskGroupID__ interval=__taskInterval__ user=_dbuser_ password=_dbpass_ thick_mode=_thickMode_ client_path=_clientPath_ threads=_threads_ modules_prefix=_prefixModuleName_ execute_custom_queries=_executeCustomQueries_ analyze_connections=_checkConnections_ engine_uptime=_checkUptime_ query_stats=_queryStats_ cache_stats=_checkCache_ fragmentation_ratio=_checkFragmentation_ check_tablescpaces=_checkTablespaces_' WHERE `macro` = '_tempfileConf_' AND `id_task` IN (SELECT `id_rt` FROM `trecon_task` WHERE `id_app` = @id_app);
|
|
|
|
|
|
|
|
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_thickMode_', 'custom', 0, 0 FROM `trecon_task` WHERE `id_app` = @id_app;
|
|
|
|
INSERT IGNORE INTO `tdiscovery_apps_tasks_macros` (`id_task`, `macro`, `type`, `value`, `temp_conf`) SELECT id_rt, '_clientPath_', 'custom', '', 0 FROM `trecon_task` WHERE `id_app` = @id_app;
|
|
|
|
UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
|
|
|
|
|
2023-11-29 13:40:38 +01:00
|
|
|
-- Update lts updates
|
|
|
|
UPDATE tconfig SET value='1' WHERE token='lts_updates';
|
2023-11-28 10:59:04 +01:00
|
|
|
|
2023-11-13 13:20:55 +01:00
|
|
|
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
|
|
|
|
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
|
|
|
|
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
|
|
|
|
SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc";
|
|
|
|
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
|
|
|
|
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
|
|
|
|
|
2023-12-07 11:44:59 +01:00
|
|
|
-- Telegram and vonage default alerts
|
|
|
|
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=9;
|
|
|
|
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=11;
|
|
|
|
|
2023-11-15 14:24:42 +01:00
|
|
|
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.vmware';
|
|
|
|
|
2023-12-12 15:30:10 +01:00
|
|
|
ALTER TABLE `tagente_modulo` ADD COLUMN `ignore_unknown` TINYINT NOT NULL DEFAULT 0;
|
|
|
|
ALTER TABLE `tpolicy_modules` ADD COLUMN `ignore_unknown` TINYINT NOT NULL DEFAULT 0;
|
|
|
|
|
|
|
|
ALTER TABLE `tagente` ADD COLUMN `ignore_unknown` TINYINT NOT NULL DEFAULT 0;
|
|
|
|
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `ignore_unknown` TINYINT NOT NULL DEFAULT 0;
|
|
|
|
|
2023-11-15 14:24:42 +01:00
|
|
|
COMMIT;
|