diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 2ac59fc8d8..76e18b4618 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.746-200623 +Version: 7.0NG.746-200701 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 50bca46312..712eeeeb15 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.746-200623" +pandora_version="7.0NG.746-200701" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 7488696c43..8006147a63 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.746'; -use constant AGENT_BUILD => '200623'; +use constant AGENT_BUILD => '200701'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index b08bc3d1fb..e10e1a46b0 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.746 -%define release 200623 +%define release 200701 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 1659722628..d5969b5871 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.746 -%define release 200623 +%define release 200701 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 41c8150c9b..7841549cdf 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.746" -PI_BUILD="200623" +PI_BUILD="200701" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index b7ba3ced8d..eddb083d13 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{200623} +{200701} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 99bda65375..de3c0d3dc6 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.746(Build 200623)") +#define PANDORA_VERSION ("7.0NG.746(Build 200701)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 2e2b2cfbf8..651ee3bf7a 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.746(Build 200623))" + VALUE "ProductVersion", "(7.0NG.746(Build 200701))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/.gitignore b/pandora_console/.gitignore index 14c3e02e3d..a56f376f61 100644 --- a/pandora_console/.gitignore +++ b/pandora_console/.gitignore @@ -6,7 +6,10 @@ attachment/collection attachment/files_repo include/config.php pandora_console.log +log/console.log +log/cron.log enterprise *.bak audit.log +log/audit.log install_old.php diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 9653ced84e..359ca8b30b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.746-200623 +Version: 7.0NG.746-200701 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 2f571587ef..dd43b13ae6 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.746-200623" +pandora_version="7.0NG.746-200701" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php index bbdac372cd..038997f156 100644 --- a/pandora_console/extensions/pandora_logs.php +++ b/pandora_console/extensions/pandora_logs.php @@ -69,7 +69,11 @@ function pandoralogs_extension_main() $logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora'; - view_logfile($config['homedir'].'/pandora_console.log'); + // Do not attempt to show console log if disabled. + if ($config['console_log_enabled']) { + view_logfile($config['homedir'].'/log/console.log'); + } + view_logfile($logs_directory.'/pandora_server.log'); view_logfile($logs_directory.'/pandora_server.error'); } diff --git a/pandora_console/extensions/realtime_graphs.php b/pandora_console/extensions/realtime_graphs.php index e487d49ee5..8940b36c2d 100644 --- a/pandora_console/extensions/realtime_graphs.php +++ b/pandora_console/extensions/realtime_graphs.php @@ -199,8 +199,8 @@ function pandora_realtime_graphs() html_print_input_hidden('custom_action', urlencode(base64_encode(' ')), false); html_print_input_hidden('incremental_base', '0'); - echo ''; echo ''; + echo ''; echo ''; // Store servers timezone offset to be retrieved from js diff --git a/pandora_console/extras/mr/39.sql b/pandora_console/extras/mr/39.sql index d37235e2ff..a8d8d2e3dd 100644 --- a/pandora_console/extras/mr/39.sql +++ b/pandora_console/extras/mr/39.sql @@ -1,5 +1,1050 @@ START TRANSACTION; +ALTER TABLE `tnetwork_component` ADD COLUMN `manufacturer_id` varchar(200) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `protocol` tinytext NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `module_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1; +ALTER TABLE `tnetwork_component` ADD COLUMN `execution_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1; +ALTER TABLE `tnetwork_component` ADD COLUMN `scan_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1; +ALTER TABLE `tnetwork_component` ADD COLUMN `value` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `value_operations` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `module_enabled` tinyint(1) UNSIGNED DEFAULT 0; +ALTER TABLE `tnetwork_component` ADD COLUMN `name_oid` varchar(255) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `query_class` varchar(200) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `query_key_field` varchar(200) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `scan_filters` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `query_filters` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `enabled` tinyint(1) UNSIGNED DEFAULT 1; + +INSERT INTO tmodule VALUES (9, 'Wizard module'); + +SET @plugin_name = 'Wizard SNMP module'; +SET @plugin_description = 'Get the result of an arithmetic operation using several OIDs values.'; +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; +INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_snmp_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Version\",\"help\":\"1, 2c, 3\",\"value\":\"1\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"public\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Security level (v3)\",\"help\":\"noAuthNoPriv, authNoPriv, authPriv\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Username (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Authentication method (v3)\",\"help\":\"MD5, SHA\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Authentication password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"Privacy method (v3)\",\"help\":\"DES, AES\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"Privacy password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"OID list\",\"help\":\"Comma separated OIDs used\",\"value\":\"\",\"hide\":\"\"},\"12\":{\"macro\":\"_field12_\",\"desc\":\"Operation\",\"help\":\"Aritmetic operation to get data. Macros _oN_ will be changed by OIDs in list. Example: (_o1_ * 100) / _o2_\",\"value\":\"\",\"hide\":\"\"}}','-host '_field1_' -port '_field2_' -version '_field3_' -community '_field4_' -secLevel '_field5_' -user '_field6_' -authMethod '_field7_' -authPass '_field8_' -privMethod '_field9_' -privPass '_field10_' -oidList '_field11_' -operation '_field12_''); + +SET @plugin_name = 'Wizard SNMP process'; +SET @plugin_description = 'Check if a process is running (1) or not (0) in OID .1.3.6.1.2.1.25.4.2.1.2 SNMP tree.'; +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; +INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_snmp_process',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Version\",\"help\":\"1, 2c, 3\",\"value\":\"1\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"public\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Security level (v3)\",\"help\":\"noAuthNoPriv, authNoPriv, authPriv\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Username (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Authentication method (v3)\",\"help\":\"MD5, SHA\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Authentication password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"Privacy method (v3)\",\"help\":\"DES, AES\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"Privacy password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"Process\",\"help\":\"Process name to check if is running (case sensitive)\",\"value\":\"\",\"hide\":\"\"}}','-host '_field1_' -port '_field2_' -version '_field3_' -community '_field4_' -secLevel '_field5_' -user '_field6_' -authMethod '_field7_' -authPass '_field8_' -privMethod '_field9_' -privPass '_field10_' -process '_field11_''); + +SET @plugin_name = 'Wizard WMI module'; +SET @plugin_description = 'Get the result of an arithmetic operation using distinct fields in a WMI query (Query must return only 1 row).'; +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; +INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_wmi_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Namespace (Optional)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"User\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"WMI Class\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Fields list\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Query filter (Optional)\",\"help\":\"Use single quotes for query conditions\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Operation\",\"help\":\"Aritmetic operation to get data. Macros _fN_ will be changed by fields in list. Example: ((_f1_ - _f2_) * 100) / _f1_\",\"value\":\"\",\"hide\":\"\"}}','-host '_field1_' -namespace '_field2_' -user '_field3_' -pass '_field4_' -wmiClass '_field5_' -fieldsList '_field6_' -queryFilter "_field7_" -operation '_field8_' -wmicPath /usr/bin/wmic'); + +SET @main_component_group_name = 'Wizard'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@main_component_group_name,0); + +SELECT @component_group_parent := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name; + +SET @component_group_name = 'CPU'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Memory'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Disk devices'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Storage'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Temperature sensors'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Processes'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Other'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Power supply'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Fans'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Temperature'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Sessions'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'VPN'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Intrussions'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Antivirus'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Services'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Disks'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'CPU'; + +SET @component_name = 'CPU User (%)'; +SET @component_description = 'The percentage of CPU time spent processing user-level code, calculated over the last minute'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.9.0','',1,'','','','','',1); + +SET @component_name = 'CPU System (%)'; +SET @component_description = 'The percentage of CPU time spent processing system-level code, calculated over the last minute'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.10.0','',1,'','','','','',1); + +SET @component_name = 'CPU Idle (%)'; +SET @component_description = 'The percentage of CPU time spent idle, calculated over the last minute'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.11.0','',0,'','','','','',1); + +SET @component_name = 'Load average - _nameOID_'; +SET @component_description = 'The 1, 5 or 15 minutes load average'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.10.1.3','',0,'1.3.6.1.4.1.2021.10.1.2','','','','',1); + +SET @component_name = 'Cisco CPU _nameOID_ usage (%)'; +SET @component_description = 'The overall CPU busy percentage in the last 5 minute period'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.109.1.1.1.1.8','',1,'1.3.6.1.4.1.9.9.109.1.1.1.1.2','','','','',1); + +SET @component_name = 'F5 CPU _nameOID_ usage (%)'; +SET @component_description = 'This is average usage ratio of CPU for the associated host in the last five minutes'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.7.5.2.1.35','',1,'1.3.6.1.4.1.3375.2.1.7.5.2.1.3','','','','',1); + +SET @component_name = 'Juniper _nameOID_ CPU usage (%)'; +SET @component_description = 'The average usage ratio of CPU in the last five minutes'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.1.13.1.21','',1,'1.3.6.1.4.1.2636.3.1.13.1.5','','','','',1); + +SET @component_name = 'HP CPU usage (%)'; +SET @component_description = 'The CPU utilization in percent(%)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','hp',1,1,'1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet system CPU usage (%)'; +SET @component_description = 'CPU usage of the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.1.3.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ CPU usage (%)'; +SET @component_description = 'CPU usage of the virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.3.2.1.1.5','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'WMI _DeviceID_ usage (%)'; +SET @component_description = 'Load capacity of each processor, averaged to the last second'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','{\"extra_field_1\":\"LoadPercentage\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"\",\"_field11__wmi_field\":\"_field11_\",\"_field12__wmi_field\":\"_field12_\",\"_field9__wmi_field\":\"_field9_\",\"_field10__wmi_field\":\"_field10_\",\"_field7__wmi_field\":\"_field7_\",\"_field8__wmi_field\":\"_field8_\",\"_field5__wmi_field\":\"_field5_\",\"_field6__wmi_field\":\"_field6_\",\"_field3__wmi_field\":\"_field3_\",\"_field4__wmi_field\":\"_field4_\",\"_field1__wmi_field\":\"_field1_\",\"_field2__wmi_field\":\"_field2_\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',1,'','Win32_Processor','DeviceID','','{\"scan\":\"\",\"execution\":\"DeviceID = '_DeviceID_'\",\"field\":\"1\",\"key_string\":\"\"}',1); + +SET @component_group_name = 'Memory'; + +SET @component_name = 'Total RAM used (%)'; +SET @component_description = 'Total real/physical memory used on the host'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.2021.4.6.0\",\"extra_field_2\":\"1.3.6.1.4.1.2021.4.5.0\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field2__snmp_field\":\"_port_\",\"_field1__snmp_field\":\"_address_\",\"_field4__snmp_field\":\"_community_\",\"_field3__snmp_field\":\"_version_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,1,'','',1,'','','','','',1); + +SET @component_name = 'F5 host RAM used (%)'; +SET @component_description = 'The host memory percentage currently in use'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.3375.2.1.7.1.2.0\",\"extra_field_2\":\"1.3.6.1.4.1.3375.2.1.7.1.1.0\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',2,1,'','',1,'','','','','',1); + +SET @component_name = 'F5 Host _nameOID_ RAM used (%)'; +SET @component_description = 'The host memory percentage currently in use for the specified host'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.3375.2.1.7.4.2.1.3\",\"extra_field_2\":\"1.3.6.1.4.1.3375.2.1.7.4.2.1.2\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',2,2,'','',1,'1.3.6.1.4.1.3375.2.1.7.4.2.1.1','','','','',1); + +SET @component_name = 'Fortinet system RAM usage (%)'; +SET @component_description = 'Memory usage of the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.1.4.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ RAM usage (%)'; +SET @component_description = 'Memory usage of the virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.3.2.1.1.6','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'WMI total RAM used (%)'; +SET @component_description = 'Percentage of physical memory currently used'; +SET @plugin_name = 'Wizard WMI module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"TotalVisibleMemorySize\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_wmi_module -host "_address_" -namespace "_namespace_wmi_" -user "_user_wmi_" -pass "_pass_wmi_" -wmiClass "_class_wmi_" -fieldsList "_field_wmi_0_,_field_wmi_1_" -queryFilter "" -operation "((_f2_ - _f1_) * 100) / _f2_" -wmicPath /usr/bin/wmic\",\"value_operation\":\"((_TotalVisibleMemorySize_ - _FreePhysicalMemory_) * 100) / _TotalVisibleMemorySize_\",\"server_plugin\":\"',@plugin_id,'\",\"_field2__wmi_field\":\"_namespace_wmi_\",\"_field1__wmi_field\":\"_address_\",\"_field4__wmi_field\":\"_pass_wmi_\",\"_field3__wmi_field\":\"_user_wmi_\",\"_field6__wmi_field\":\"_field_wmi_0_,_field_wmi_1_\",\"_field5__wmi_field\":\"_class_wmi_\",\"_field8__wmi_field\":\"((_f2_ - _f1_) * 100) / _f2_\",\"_field7__wmi_field\":\"\",\"field0_wmi_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',2,1,'','',1,'','Win32_OperatingSystem','FreePhysicalMemory','','{\"scan\":\"\",\"execution\":\"\",\"field\":\"\",\"key_string\":\"\"}',1); + +SET @component_name = 'Total Swap used (%)'; +SET @component_description = 'Total swap memory used on the host'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.2021.4.4.0\",\"extra_field_2\":\"1.3.6.1.4.1.2021.4.3.0\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,1,'','',1,'','','','','',1); + +SET @component_name = 'Cisco memory pool _nameOID_ usage (%)'; +SET @component_description = 'Indicates the percentage of bytes from the memory pool that are currently in use by applications on the managed device'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.9.9.48.1.1.1.5\",\"extra_field_2\":\"1.3.6.1.4.1.9.9.48.1.1.1.6\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / (_o1_ + _o2_)"\",\"value_operation\":\"(_oid_1_ * 100) / (_oid_1_ + _oid_2_)\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / (_o1_ + _o2_)\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',2,2,'','',1,'1.3.6.1.4.1.9.9.48.1.1.1.2','','','','',1); + +SET @component_name = 'Juniper _nameOID_ memory usage (%)'; +SET @component_description = 'The buffer pool utilization in percentage of this subject'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.1.13.1.11','',1,'1.3.6.1.4.1.2636.3.1.13.1.5','','','','',1); + +SET @component_name = 'HP memory slot _nameOID_ usage (%)'; +SET @component_description = 'The percentage of currently allocated bytes'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.7\",\"extra_field_2\":\"1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.5\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','hp',2,2,'','',1,'1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.1','','','','',1); + +SET @component_group_name = 'Disk devices'; + +SET @component_name = 'Disk _nameOID_ bytes read'; +SET @component_description = 'The number of bytes read from this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.3','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_name = 'Disk _nameOID_ bytes written'; +SET @component_description = 'The number of bytes written to this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.4','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_name = 'Disk _nameOID_ read accesses'; +SET @component_description = 'The number of read accesses from this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'accesses/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.5','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_name = 'Disk _nameOID_ write accesses'; +SET @component_description = 'The number of write accesses to this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'accesses/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.6','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_group_name = 'Storage'; + +SET @component_name = 'Storage _nameOID_ (%)'; +SET @component_description = 'The amount of the storage represented by this entry that is allocated'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.2.1.25.2.3.1.6\",\"extra_field_2\":\"1.3.6.1.2.1.25.2.3.1.5\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,2,'','',1,'1.3.6.1.2.1.25.2.3.1.3','','','','',1); + +SET @component_group_name = 'Temperature sensors'; + +SET @component_name = 'Temperature _nameOID_'; +SET @component_description = 'The temperature of this sensor'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.16.2.1.3','',0,'1.3.6.1.4.1.2021.13.16.2.1.2','','','','',1); + +SET @component_group_name = 'Processes'; + +SET @component_name = 'Process _nameOID_'; +SET @component_description = 'Check if the process is running'; +SET @plugin_name = 'Wizard SNMP process'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,2,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.2.1.25.4.2.1.7\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_process -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -process "_nameOID_"\",\"value_operation\":\"1\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_nameOID_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,2,'','',0,'1.3.6.1.2.1.25.4.2.1.2','','','','',1); + +SET @component_name = 'WMI Number of processes'; +SET @component_description = 'Number of process contexts currently loaded or running on the operating system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,1,'','',1,'','Win32_OperatingSystem','NumberOfProcesses','','{\"scan\":\"\",\"execution\":\"\",\"field\":\"0\",\"key_string\":\"\"}',1); + +SET @component_name = 'WMI process _Name_ running'; +SET @component_description = 'Check if process is running'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,2,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"Name\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',0,'','Win32_Process','Handle','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"_Name_\"}',1); + +SET @component_group_name = 'Other'; + +SET @component_name = 'Wizard system uptime'; +SET @component_description = 'The time (in hundredths of a second) since the network management portion of the system was last re-initialized'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'_timeticks_','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','all',1,1,'1.3.6.1.2.1.25.1.1.0','',1,'','','','','',1); + +SET @component_name = 'Wizard network uptime'; +SET @component_description = 'The time (in hundredths of a second) since the network management portion of the system was last re-initialized'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'_timeticks_','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','all',1,1,'1.3.6.1.2.1.1.3.0','',1,'','','','','',1); + +SET @component_name = 'Blocks sent'; +SET @component_description = 'Number of blocks sent to a block device'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.57.0','',0,'','','','','',1); + +SET @component_name = 'Blocks received'; +SET @component_description = 'Number of blocks received from a block device'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.58.0','',0,'','','','','',1); + +SET @component_name = 'Interrupts processed'; +SET @component_description = 'Number of interrupts processed'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.59.0','',0,'','','','','',1); + +SET @component_group_name = 'Power supply'; + +SET @component_name = 'Cisco _nameOID_ power state'; +SET @component_description = 'The current state of the power supply: normal(1), warning(2), critical(3), shutdown(4), notPresent(5), notFunctioning(6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.13.1.5.1.3','',0,'1.3.6.1.4.1.9.9.13.1.5.1.2','','','','',1); + +SET @component_name = 'F5 Power supply _nameOID_ status'; +SET @component_description = 'The status of the indexed power supply on the system: bad(0), good(1), notpresent(2)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.3.2.2.2.1.2','',1,'1.3.6.1.4.1.3375.2.1.3.2.2.2.1','','','','',1); + +SET @component_name = 'WMI _Name_ power supply state'; +SET @component_description = 'State of the power supply or supplies when last booted: Other (1), Unknown (2), Safe (3), Warning (4), Critical (5), Non-recoverable (6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"PowerSupplyState\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',0,'','Win32_ComputerSystem','Name','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"\"}',1); + +SET @component_name = 'WMI _Name_ Power state'; +SET @component_description = 'Current power state of a computer and its associated operating system: Unknown (0), Full Power (1), Low Power Mode (2), Standby (3), Unknown (4), Power Cycle (5), Power Off (6), Warning (7), Hibernate (8), Soft Off (9)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"PowerState\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,1,'','',0,'','Win32_ComputerSystem','Name','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"\"}',1); + +SET @component_group_name = 'Fans'; + +SET @component_name = 'Cisco _nameOID_ fan state'; +SET @component_description = 'The current state of the fan: normal(1), warning(2), critical(3), shutdown(4), notPresent(5), notFunctioning(6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.13.1.4.1.3','',1,'1.3.6.1.4.1.9.9.13.1.4.1.2','','','','',1); + +SET @component_name = 'F5 Fan _nameOID_ status'; +SET @component_description = 'The status of the indexed chassis fan on the system: bad(0), good(1), notpresent(2)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.3.2.1.2.1.2','',1,'1.3.6.1.4.1.3375.2.1.3.2.1.2.1.1','','','','',1); + +SET @component_name = 'HP fan tray _nameOID_ state'; +SET @component_description = 'Current state of the fan: failed(0), removed(1), off(2), underspeed(3), overspeed(4), ok(5), maxstate(6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.11.2.14.11.5.1.54.2.1.1.4','',1,'1.3.6.1.4.1.11.2.14.11.5.1.54.2.1.1.2','','','','',1); + +SET @component_group_name = 'Temperature'; + +SET @component_name = 'Cisco _nameOID_ temperature'; +SET @component_description = 'The current measurement of the testpoint being instrumented'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.13.1.3.1.3','',1,'1.3.6.1.4.1.9.9.13.1.3.1.2','','','','',1); + +SET @component_name = 'F5 Temperature sensor _nameOID_'; +SET @component_description = 'The chassis temperature of the indexed sensor on the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.3.2.3.2.1.2','',1,'1.3.6.1.4.1.3375.2.1.3.2.3.2.1.1','','','','',1); + +SET @component_name = 'Juniper _nameOID_ temperature'; +SET @component_description = 'The temperature of this subject'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.1.13.1.7','',1,'1.3.6.1.4.1.2636.3.1.13.1.5','','','','',1); + +SET @component_name = 'HP _nameOID_ temperature'; +SET @component_description = 'The current temperature given by the indexed chassis'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','hp',1,2,'1.3.6.1.4.1.11.2.14.11.1.2.8.1.1.3','',0,'1.3.6.1.4.1.11.2.14.11.1.2.8.1.1.2','','','','',1); + +SET @component_group_name = 'Sessions'; + +SET @component_name = 'F5 Current auth sessions'; +SET @component_description = 'The current number of concurrent auth sessions'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.3.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total auth success results'; +SET @component_description = 'The total number of auth success results'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.5.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total auth failure results'; +SET @component_description = 'The total number of auth failure results'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.6.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total auth error results'; +SET @component_description = 'The total number of auth error results'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.8.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet ephemeral sessions count'; +SET @component_description = 'The current number of ephemeral sessions on the device'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.1.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet direct requests count'; +SET @component_description = 'The number of direct requests to Fortigate local stack from external, reflecting DOS attack towards the Fortigate'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.7.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet clash sessions count'; +SET @component_description = 'The number of new sessions which have collision with existing sessions. This generally highlights a shortage of ports or IP in ip-pool during source natting (PNAT)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.3.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet expectation sessions count'; +SET @component_description = 'The number of current expectation sessions'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.4.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet sync queue sessions count'; +SET @component_description = 'The sync queue full counter, reflecting bursts on the sync queue'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.5.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet accept queue sessions count'; +SET @component_description = 'The accept queue full counter, reflecting bursts on the accept queue'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.6.0','',1,'','','','','',1); + +SET @component_group_name = 'VPN'; + +SET @component_name = 'F5 Current SSL/VPN connections'; +SET @component_description = 'The total current SSL/VPN connections in the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.6.1.5.3.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total SSL/VPN bytes received'; +SET @component_description = 'The total raw bytes received by SSL/VPN connections in the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.6.1.5.5.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total SSL/VPN bytes transmitted'; +SET @component_description = 'The total raw bytes transmitted by SSL/VPN connections in the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.6.1.5.6.0','',1,'','','','','',1); + +SET @component_name = 'Juniper _nameOID_ active sites'; +SET @component_description = 'The number of active sites in the VPN'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.26.1.2.1.9','',1,'1.3.6.1.4.1.2636.3.26.1.2.1.2','','','','',1); + +SET @component_name = 'Juniper _nameOID_ age'; +SET @component_description = 'The age (i.e., time from creation till now) of this VPN in hundredths of a second'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'_timeticks_','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.26.1.2.1.12','',1,'1.3.6.1.4.1.2636.3.26.1.2.1.2','','','','',1); + +SET @component_name = 'Juniper _nameOID_ interface status'; +SET @component_description = 'Status of this interface: unknown(0), noLocalInterface(1), disabled(2), encapsulationMismatch(3), down(4), up(5)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.26.1.3.1.10','',1,'1.3.6.1.4.1.2636.3.26.1.3.1.2','','','','',1); + +SET @component_group_name = 'Intrussions'; + +SET @component_name = 'Fortinet virtual domain _nameOID_ intrussions detected'; +SET @component_description = 'Number of intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.1','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ intrussions blocked'; +SET @component_description = 'Number of intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.1','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ critical severity intrussions'; +SET @component_description = 'Number of critical severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.3','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ high severity intrussions'; +SET @component_description = 'Number of high severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.4','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ medium severity intrussions'; +SET @component_description = 'Number of medium severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.5','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ low severity intrussions'; +SET @component_description = 'Number of low severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.6','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ informational severity intrussions'; +SET @component_description = 'Number of informational severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.7','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ signature detections'; +SET @component_description = 'Number of intrusions detected by signature since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.8','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ anomaly detections'; +SET @component_description = 'Number of intrusions DECed as anomalies since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.9','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_group_name = 'Antivirus'; + +SET @component_name = 'Fortinet virtual domain _nameOID_ virus detected'; +SET @component_description = 'Number of virus transmissions detected in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.1','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ virus blocked'; +SET @component_description = 'Number of virus transmissions blocked in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.2','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ oversized detected'; +SET @component_description = 'Number of over-sized file transmissions detected in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.17','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ oversized blocked'; +SET @component_description = 'Number of over-sized file transmissions blocked in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.18','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_group_name = 'Services'; + +SET @component_name = 'WMI Service _Name_ running'; +SET @component_description = '_Caption_'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,2,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"State\",\"extra_field_2\":\"Caption\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',0,'','Win32_Service','Name','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"Running\"}',1); + +SET @component_group_name = 'Disks'; + +SET @component_name = 'WMI disk _DeviceID_ used (%)'; +SET @component_description = 'Space percentage used on the logical disk'; +SET @plugin_name = 'Wizard WMI module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"Size\",\"extra_field_2\":\"FreeSpace\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_wmi_module -host "_address_" -namespace "_namespace_wmi_" -user "_user_wmi_" -pass "_pass_wmi_" -wmiClass "_class_wmi_" -fieldsList "_field_wmi_1_,_field_wmi_2_" -queryFilter "DeviceID = '_DeviceID_'" -operation "((_f1_ - _f2_) * 100) / _f1_" -wmicPath /usr/bin/wmic\",\"value_operation\":\"((_Size_ - _FreeSpace_) * 100) / _Size_\",\"server_plugin\":\"',@plugin_id,'\",\"_field2__wmi_field\":\"_namespace_wmi_\",\"_field1__wmi_field\":\"_address_\",\"_field4__wmi_field\":\"_pass_wmi_\",\"_field3__wmi_field\":\"_user_wmi_\",\"_field6__wmi_field\":\"_field_wmi_1_,_field_wmi_2_\",\"_field5__wmi_field\":\"_class_wmi_\",\"_field8__wmi_field\":\"((_f1_ - _f2_) * 100) / _f1_\",\"_field7__wmi_field\":\"DeviceID = '_DeviceID_'\",\"field0_wmi_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',2,2,'','',1,'','Win32_LogicalDisk','DeviceID','','{\"scan\":\"DriveType = 3\",\"execution\":\"\",\"field\":\"\",\"key_string\":\"\"}',1); + +INSERT IGNORE INTO `tpen` VALUES (171,'dlink','D-Link Systems, Inc.'),(14988,'mikrotik','MikroTik'),(6486,'alcatel','Alcatel-Lucent Enterprise'),(41112,'ubiquiti','Ubiquiti Networks, Inc.'),(207,'telesis','Allied Telesis, Inc.'),(10002,'frogfoot','Frogfoot Networks'),(2,'ibm','IBM'),(4,'unix','Unix'),(63,'apple','Apple Computer, Inc.'),(674,'dell','Dell Inc.'),(111,'oracle','Oracle'),(116,'hitachi','Hitachi, Ltd.'),(173,'netlink','Netlink'),(188,'ascom','Ascom'),(6574,'synology','Synology Inc.'),(3861,'fujitsu','Fujitsu Network Communications, Inc.'),(53526,'dell','Dell ATC'),(52627,'apple','Apple Inc'),(19464,'hitachi','Hitachi Communication Technologies, Ltd.'),(13062,'ascom','Ascom'); + ALTER TABLE `tmensajes` ADD COLUMN `hidden_sent` TINYINT(1) UNSIGNED DEFAULT 0; COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index d05785f4ed..d0466b769c 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1342,13 +1342,13 @@ ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT ''; INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); -INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 38); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 39); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; -INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '746'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '747'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp'); UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields'; DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password'; @@ -1476,6 +1476,20 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL def ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0'; ALTER TABLE `tnetwork_component` ADD COLUMN `ff_type` tinyint(1) unsigned default '0'; ALTER TABLE `tnetwork_component` MODIFY COLUMN `ff_type` tinyint(1) unsigned NULL DEFAULT '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `manufacturer_id` varchar(200) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `protocol` tinytext NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `module_type` tinyint UNSIGNED NOT NULL DEFAULT 1; +ALTER TABLE `tnetwork_component` ADD COLUMN `execution_type` tinyint UNSIGNED NOT NULL DEFAULT 1; +ALTER TABLE `tnetwork_component` ADD COLUMN `scan_type` tinyint UNSIGNED NOT NULL DEFAULT 1; +ALTER TABLE `tnetwork_component` ADD COLUMN `value` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `value_operations` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `module_enabled` tinyint(1) UNSIGNED DEFAULT '0'; +ALTER TABLE `tnetwork_component` ADD COLUMN `name_oid` varchar(255) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `query_class` varchar(200) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `query_key_field` varchar(200) NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `scan_filters` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `query_filters` text NOT NULL; +ALTER TABLE `tnetwork_component` ADD COLUMN `enabled` tinyint(1) UNSIGNED DEFAULT 1; -- ---------------------------------------------------------------------- -- Table `tpen` @@ -1856,6 +1870,7 @@ ALTER TABLE tevent_response ADD COLUMN command_timeout int(5) unsigned NOT NULL -- --------------------------------------------------------------------- INSERT INTO tmodule VALUES (8, 'Wux module'); +INSERT INTO tmodule VALUES (9, 'Wizard module'); -- --------------------------------------------------------------------- -- Table `ttipo_modulo` @@ -2735,4 +2750,1034 @@ CREATE TABLE `tnode_relations` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- ------------------------------------------------------------------------ +-- New wizards components and plugins +-- ------------------------------------------------------------------------ +SET @plugin_name = 'Wizard SNMP module'; +SET @plugin_description = 'Get the result of an arithmetic operation using several OIDs values.'; +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; +INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_snmp_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Version\",\"help\":\"1, 2c, 3\",\"value\":\"1\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"public\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Security level (v3)\",\"help\":\"noAuthNoPriv, authNoPriv, authPriv\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Username (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Authentication method (v3)\",\"help\":\"MD5, SHA\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Authentication password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"Privacy method (v3)\",\"help\":\"DES, AES\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"Privacy password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"OID list\",\"help\":\"Comma separated OIDs used\",\"value\":\"\",\"hide\":\"\"},\"12\":{\"macro\":\"_field12_\",\"desc\":\"Operation\",\"help\":\"Aritmetic operation to get data. Macros _oN_ will be changed by OIDs in list. Example: (_o1_ * 100) / _o2_\",\"value\":\"\",\"hide\":\"\"}}','-host '_field1_' -port '_field2_' -version '_field3_' -community '_field4_' -secLevel '_field5_' -user '_field6_' -authMethod '_field7_' -authPass '_field8_' -privMethod '_field9_' -privPass '_field10_' -oidList '_field11_' -operation '_field12_''); + +SET @plugin_name = 'Wizard SNMP process'; +SET @plugin_description = 'Check if a process is running (1) or not (0) in OID .1.3.6.1.2.1.25.4.2.1.2 SNMP tree.'; +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; +INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_snmp_process',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Version\",\"help\":\"1, 2c, 3\",\"value\":\"1\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"public\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Security level (v3)\",\"help\":\"noAuthNoPriv, authNoPriv, authPriv\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Username (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Authentication method (v3)\",\"help\":\"MD5, SHA\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Authentication password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"Privacy method (v3)\",\"help\":\"DES, AES\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"Privacy password (v3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"Process\",\"help\":\"Process name to check if is running (case sensitive)\",\"value\":\"\",\"hide\":\"\"}}','-host '_field1_' -port '_field2_' -version '_field3_' -community '_field4_' -secLevel '_field5_' -user '_field6_' -authMethod '_field7_' -authPass '_field8_' -privMethod '_field9_' -privPass '_field10_' -process '_field11_''); + +SET @plugin_name = 'Wizard WMI module'; +SET @plugin_description = 'Get the result of an arithmetic operation using distinct fields in a WMI query (Query must return only 1 row).'; +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; +INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_wmi_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Namespace (Optional)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"User\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"WMI Class\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Fields list\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Query filter (Optional)\",\"help\":\"Use single quotes for query conditions\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Operation\",\"help\":\"Aritmetic operation to get data. Macros _fN_ will be changed by fields in list. Example: ((_f1_ - _f2_) * 100) / _f1_\",\"value\":\"\",\"hide\":\"\"}}','-host '_field1_' -namespace '_field2_' -user '_field3_' -pass '_field4_' -wmiClass '_field5_' -fieldsList '_field6_' -queryFilter "_field7_" -operation '_field8_' -wmicPath /usr/bin/wmic'); + +SET @main_component_group_name = 'Wizard'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@main_component_group_name,0); + +SELECT @component_group_parent := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name; + +SET @component_group_name = 'CPU'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Memory'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Disk devices'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Storage'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Temperature sensors'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Processes'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Other'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Power supply'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Fans'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Temperature'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Sessions'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'VPN'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Intrussions'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Antivirus'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Services'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'Disks'; +SET @component_id = ''; +SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; +INSERT IGNORE INTO `tnetwork_component_group` (`id_sg`, `name`, `parent`) VALUES (@component_id,@component_group_name,@component_group_parent); + +SET @component_group_name = 'CPU'; + +SET @component_name = 'CPU User (%)'; +SET @component_description = 'The percentage of CPU time spent processing user-level code, calculated over the last minute'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.9.0','',1,'','','','','',1); + +SET @component_name = 'CPU System (%)'; +SET @component_description = 'The percentage of CPU time spent processing system-level code, calculated over the last minute'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.10.0','',1,'','','','','',1); + +SET @component_name = 'CPU Idle (%)'; +SET @component_description = 'The percentage of CPU time spent idle, calculated over the last minute'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.11.0','',0,'','','','','',1); + +SET @component_name = 'Load average - _nameOID_'; +SET @component_description = 'The 1, 5 or 15 minutes load average'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.10.1.3','',0,'1.3.6.1.4.1.2021.10.1.2','','','','',1); + +SET @component_name = 'Cisco CPU _nameOID_ usage (%)'; +SET @component_description = 'The overall CPU busy percentage in the last 5 minute period'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.109.1.1.1.1.8','',1,'1.3.6.1.4.1.9.9.109.1.1.1.1.2','','','','',1); + +SET @component_name = 'F5 CPU _nameOID_ usage (%)'; +SET @component_description = 'This is average usage ratio of CPU for the associated host in the last five minutes'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.7.5.2.1.35','',1,'1.3.6.1.4.1.3375.2.1.7.5.2.1.3','','','','',1); + +SET @component_name = 'Juniper _nameOID_ CPU usage (%)'; +SET @component_description = 'The average usage ratio of CPU in the last five minutes'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.1.13.1.21','',1,'1.3.6.1.4.1.2636.3.1.13.1.5','','','','',1); + +SET @component_name = 'HP CPU usage (%)'; +SET @component_description = 'The CPU utilization in percent(%)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','hp',1,1,'1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet system CPU usage (%)'; +SET @component_description = 'CPU usage of the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.1.3.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ CPU usage (%)'; +SET @component_description = 'CPU usage of the virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.3.2.1.1.5','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'WMI _DeviceID_ usage (%)'; +SET @component_description = 'Load capacity of each processor, averaged to the last second'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','{\"extra_field_1\":\"LoadPercentage\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"\",\"_field11__wmi_field\":\"_field11_\",\"_field12__wmi_field\":\"_field12_\",\"_field9__wmi_field\":\"_field9_\",\"_field10__wmi_field\":\"_field10_\",\"_field7__wmi_field\":\"_field7_\",\"_field8__wmi_field\":\"_field8_\",\"_field5__wmi_field\":\"_field5_\",\"_field6__wmi_field\":\"_field6_\",\"_field3__wmi_field\":\"_field3_\",\"_field4__wmi_field\":\"_field4_\",\"_field1__wmi_field\":\"_field1_\",\"_field2__wmi_field\":\"_field2_\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',1,'','Win32_Processor','DeviceID','','{\"scan\":\"\",\"execution\":\"DeviceID = '_DeviceID_'\",\"field\":\"1\",\"key_string\":\"\"}',1); + +SET @component_group_name = 'Memory'; + +SET @component_name = 'Total RAM used (%)'; +SET @component_description = 'Total real/physical memory used on the host'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.2021.4.6.0\",\"extra_field_2\":\"1.3.6.1.4.1.2021.4.5.0\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field2__snmp_field\":\"_port_\",\"_field1__snmp_field\":\"_address_\",\"_field4__snmp_field\":\"_community_\",\"_field3__snmp_field\":\"_version_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,1,'','',1,'','','','','',1); + +SET @component_name = 'F5 host RAM used (%)'; +SET @component_description = 'The host memory percentage currently in use'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.3375.2.1.7.1.2.0\",\"extra_field_2\":\"1.3.6.1.4.1.3375.2.1.7.1.1.0\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',2,1,'','',1,'','','','','',1); + +SET @component_name = 'F5 Host _nameOID_ RAM used (%)'; +SET @component_description = 'The host memory percentage currently in use for the specified host'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.3375.2.1.7.4.2.1.3\",\"extra_field_2\":\"1.3.6.1.4.1.3375.2.1.7.4.2.1.2\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',2,2,'','',1,'1.3.6.1.4.1.3375.2.1.7.4.2.1.1','','','','',1); + +SET @component_name = 'Fortinet system RAM usage (%)'; +SET @component_description = 'Memory usage of the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.1.4.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ RAM usage (%)'; +SET @component_description = 'Memory usage of the virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.3.2.1.1.6','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'WMI total RAM used (%)'; +SET @component_description = 'Percentage of physical memory currently used'; +SET @plugin_name = 'Wizard WMI module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"TotalVisibleMemorySize\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_wmi_module -host "_address_" -namespace "_namespace_wmi_" -user "_user_wmi_" -pass "_pass_wmi_" -wmiClass "_class_wmi_" -fieldsList "_field_wmi_0_,_field_wmi_1_" -queryFilter "" -operation "((_f2_ - _f1_) * 100) / _f2_" -wmicPath /usr/bin/wmic\",\"value_operation\":\"((_TotalVisibleMemorySize_ - _FreePhysicalMemory_) * 100) / _TotalVisibleMemorySize_\",\"server_plugin\":\"',@plugin_id,'\",\"_field2__wmi_field\":\"_namespace_wmi_\",\"_field1__wmi_field\":\"_address_\",\"_field4__wmi_field\":\"_pass_wmi_\",\"_field3__wmi_field\":\"_user_wmi_\",\"_field6__wmi_field\":\"_field_wmi_0_,_field_wmi_1_\",\"_field5__wmi_field\":\"_class_wmi_\",\"_field8__wmi_field\":\"((_f2_ - _f1_) * 100) / _f2_\",\"_field7__wmi_field\":\"\",\"field0_wmi_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',2,1,'','',1,'','Win32_OperatingSystem','FreePhysicalMemory','','{\"scan\":\"\",\"execution\":\"\",\"field\":\"\",\"key_string\":\"\"}',1); + +SET @component_name = 'Total Swap used (%)'; +SET @component_description = 'Total swap memory used on the host'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.2021.4.4.0\",\"extra_field_2\":\"1.3.6.1.4.1.2021.4.3.0\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,1,'','',1,'','','','','',1); + +SET @component_name = 'Cisco memory pool _nameOID_ usage (%)'; +SET @component_description = 'Indicates the percentage of bytes from the memory pool that are currently in use by applications on the managed device'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.9.9.48.1.1.1.5\",\"extra_field_2\":\"1.3.6.1.4.1.9.9.48.1.1.1.6\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / (_o1_ + _o2_)"\",\"value_operation\":\"(_oid_1_ * 100) / (_oid_1_ + _oid_2_)\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / (_o1_ + _o2_)\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',2,2,'','',1,'1.3.6.1.4.1.9.9.48.1.1.1.2','','','','',1); + +SET @component_name = 'Juniper _nameOID_ memory usage (%)'; +SET @component_description = 'The buffer pool utilization in percentage of this subject'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.1.13.1.11','',1,'1.3.6.1.4.1.2636.3.1.13.1.5','','','','',1); + +SET @component_name = 'HP memory slot _nameOID_ usage (%)'; +SET @component_description = 'The percentage of currently allocated bytes'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.7\",\"extra_field_2\":\"1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.5\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','hp',2,2,'','',1,'1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.1','','','','',1); + +SET @component_group_name = 'Disk devices'; + +SET @component_name = 'Disk _nameOID_ bytes read'; +SET @component_description = 'The number of bytes read from this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.3','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_name = 'Disk _nameOID_ bytes written'; +SET @component_description = 'The number of bytes written to this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.4','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_name = 'Disk _nameOID_ read accesses'; +SET @component_description = 'The number of read accesses from this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'accesses/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.5','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_name = 'Disk _nameOID_ write accesses'; +SET @component_description = 'The number of write accesses to this device since boot'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,16,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'accesses/sec','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.15.1.1.6','',0,'1.3.6.1.4.1.2021.13.15.1.1.2','','','','',1); + +SET @component_group_name = 'Storage'; + +SET @component_name = 'Storage _nameOID_ (%)'; +SET @component_description = 'The amount of the storage represented by this entry that is allocated'; +SET @plugin_name = 'Wizard SNMP module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.2.1.25.2.3.1.6\",\"extra_field_2\":\"1.3.6.1.2.1.25.2.3.1.5\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_module -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -oidList "_oid_1_,_oid_2_" -operation "(_o1_ * 100) / _o2_"\",\"value_operation\":\"(_oid_1_ * 100) / _oid_2_\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_oid_1_,_oid_2_\",\"_field12__snmp_field\":\"(_o1_ * 100) / _o2_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,2,'','',1,'1.3.6.1.2.1.25.2.3.1.3','','','','',1); + +SET @component_group_name = 'Temperature sensors'; + +SET @component_name = 'Temperature _nameOID_'; +SET @component_description = 'The temperature of this sensor'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,2,'1.3.6.1.4.1.2021.13.16.2.1.3','',0,'1.3.6.1.4.1.2021.13.16.2.1.2','','','','',1); + +SET @component_group_name = 'Processes'; + +SET @component_name = 'Process _nameOID_'; +SET @component_description = 'Check if the process is running'; +SET @plugin_name = 'Wizard SNMP process'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,2,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard',CONCAT('{\"extra_field_1\":\"1.3.6.1.2.1.25.4.2.1.7\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_snmp_process -host "_address_" -port "_port_" -version "_version_" -community "_community_" -secLevel "_sec_level_" -user "_auth_user_" -authMethod "_auth_method_" -authPass "_auth_pass_" -privMethod "_priv_method_" -privPass "_priv_pass_" -process "_nameOID_"\",\"value_operation\":\"1\",\"server_plugin\":\"',@plugin_id,'\",\"_field11__snmp_field\":\"_nameOID_\",\"_field9__snmp_field\":\"_priv_method_\",\"_field10__snmp_field\":\"_priv_pass_\",\"_field7__snmp_field\":\"_auth_method_\",\"_field8__snmp_field\":\"_auth_pass_\",\"_field5__snmp_field\":\"_sec_level_\",\"_field6__snmp_field\":\"_auth_user_\",\"_field3__snmp_field\":\"_version_\",\"_field4__snmp_field\":\"_community_\",\"_field1__snmp_field\":\"_address_\",\"_field2__snmp_field\":\"_port_\",\"field0_snmp_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',2,2,'','',0,'1.3.6.1.2.1.25.4.2.1.2','','','','',1); + +SET @component_name = 'WMI Number of processes'; +SET @component_description = 'Number of process contexts currently loaded or running on the operating system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,1,'','',1,'','Win32_OperatingSystem','NumberOfProcesses','','{\"scan\":\"\",\"execution\":\"\",\"field\":\"0\",\"key_string\":\"\"}',1); + +SET @component_name = 'WMI process _Name_ running'; +SET @component_description = 'Check if process is running'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,2,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"Name\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',0,'','Win32_Process','Handle','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"_Name_\"}',1); + +SET @component_group_name = 'Other'; + +SET @component_name = 'Wizard system uptime'; +SET @component_description = 'The time (in hundredths of a second) since the network management portion of the system was last re-initialized'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'_timeticks_','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','all',1,1,'1.3.6.1.2.1.25.1.1.0','',1,'','','','','',1); + +SET @component_name = 'Wizard network uptime'; +SET @component_description = 'The time (in hundredths of a second) since the network management portion of the system was last re-initialized'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'_timeticks_','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','all',1,1,'1.3.6.1.2.1.1.3.0','',1,'','','','','',1); + +SET @component_name = 'Blocks sent'; +SET @component_description = 'Number of blocks sent to a block device'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.57.0','',0,'','','','','',1); + +SET @component_name = 'Blocks received'; +SET @component_description = 'Number of blocks received from a block device'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.58.0','',0,'','','','','',1); + +SET @component_name = 'Interrupts processed'; +SET @component_description = 'Number of interrupts processed'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','general_snmp',1,1,'1.3.6.1.4.1.2021.11.59.0','',0,'','','','','',1); + +SET @component_group_name = 'Power supply'; + +SET @component_name = 'Cisco _nameOID_ power state'; +SET @component_description = 'The current state of the power supply: normal(1), warning(2), critical(3), shutdown(4), notPresent(5), notFunctioning(6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.13.1.5.1.3','',0,'1.3.6.1.4.1.9.9.13.1.5.1.2','','','','',1); + +SET @component_name = 'F5 Power supply _nameOID_ status'; +SET @component_description = 'The status of the indexed power supply on the system: bad(0), good(1), notpresent(2)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.3.2.2.2.1.2','',1,'1.3.6.1.4.1.3375.2.1.3.2.2.2.1','','','','',1); + +SET @component_name = 'WMI _Name_ power supply state'; +SET @component_description = 'State of the power supply or supplies when last booted: Other (1), Unknown (2), Safe (3), Warning (4), Critical (5), Non-recoverable (6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"PowerSupplyState\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',0,'','Win32_ComputerSystem','Name','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"\"}',1); + +SET @component_name = 'WMI _Name_ Power state'; +SET @component_description = 'Current power state of a computer and its associated operating system: Unknown (0), Full Power (1), Low Power Mode (2), Standby (3), Unknown (4), Power Cycle (5), Power Off (6), Warning (7), Hibernate (8), Soft Off (9)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"PowerState\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,1,'','',0,'','Win32_ComputerSystem','Name','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"\"}',1); + +SET @component_group_name = 'Fans'; + +SET @component_name = 'Cisco _nameOID_ fan state'; +SET @component_description = 'The current state of the fan: normal(1), warning(2), critical(3), shutdown(4), notPresent(5), notFunctioning(6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.13.1.4.1.3','',1,'1.3.6.1.4.1.9.9.13.1.4.1.2','','','','',1); + +SET @component_name = 'F5 Fan _nameOID_ status'; +SET @component_description = 'The status of the indexed chassis fan on the system: bad(0), good(1), notpresent(2)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.3.2.1.2.1.2','',1,'1.3.6.1.4.1.3375.2.1.3.2.1.2.1.1','','','','',1); + +SET @component_name = 'HP fan tray _nameOID_ state'; +SET @component_description = 'Current state of the fan: failed(0), removed(1), off(2), underspeed(3), overspeed(4), ok(5), maxstate(6)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.11.2.14.11.5.1.54.2.1.1.4','',1,'1.3.6.1.4.1.11.2.14.11.5.1.54.2.1.1.2','','','','',1); + +SET @component_group_name = 'Temperature'; + +SET @component_name = 'Cisco _nameOID_ temperature'; +SET @component_description = 'The current measurement of the testpoint being instrumented'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','cisco',1,2,'1.3.6.1.4.1.9.9.13.1.3.1.3','',1,'1.3.6.1.4.1.9.9.13.1.3.1.2','','','','',1); + +SET @component_name = 'F5 Temperature sensor _nameOID_'; +SET @component_description = 'The chassis temperature of the indexed sensor on the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,2,'1.3.6.1.4.1.3375.2.1.3.2.3.2.1.2','',1,'1.3.6.1.4.1.3375.2.1.3.2.3.2.1.1','','','','',1); + +SET @component_name = 'Juniper _nameOID_ temperature'; +SET @component_description = 'The temperature of this subject'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.1.13.1.7','',1,'1.3.6.1.4.1.2636.3.1.13.1.5','','','','',1); + +SET @component_name = 'HP _nameOID_ temperature'; +SET @component_description = 'The current temperature given by the indexed chassis'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'ºC','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','hp',1,2,'1.3.6.1.4.1.11.2.14.11.1.2.8.1.1.3','',0,'1.3.6.1.4.1.11.2.14.11.1.2.8.1.1.2','','','','',1); + +SET @component_group_name = 'Sessions'; + +SET @component_name = 'F5 Current auth sessions'; +SET @component_description = 'The current number of concurrent auth sessions'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.3.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total auth success results'; +SET @component_description = 'The total number of auth success results'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.5.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total auth failure results'; +SET @component_description = 'The total number of auth failure results'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.6.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total auth error results'; +SET @component_description = 'The total number of auth error results'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.1.1.2.2.8.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet ephemeral sessions count'; +SET @component_description = 'The current number of ephemeral sessions on the device'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.1.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet direct requests count'; +SET @component_description = 'The number of direct requests to Fortigate local stack from external, reflecting DOS attack towards the Fortigate'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.7.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet clash sessions count'; +SET @component_description = 'The number of new sessions which have collision with existing sessions. This generally highlights a shortage of ports or IP in ip-pool during source natting (PNAT)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.3.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet expectation sessions count'; +SET @component_description = 'The number of current expectation sessions'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.4.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet sync queue sessions count'; +SET @component_description = 'The sync queue full counter, reflecting bursts on the sync queue'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.5.0','',1,'','','','','',1); + +SET @component_name = 'Fortinet accept queue sessions count'; +SET @component_description = 'The accept queue full counter, reflecting bursts on the accept queue'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,1,'1.3.6.1.4.1.12356.101.4.6.2.6.0','',1,'','','','','',1); + +SET @component_group_name = 'VPN'; + +SET @component_name = 'F5 Current SSL/VPN connections'; +SET @component_description = 'The total current SSL/VPN connections in the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.6.1.5.3.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total SSL/VPN bytes received'; +SET @component_description = 'The total raw bytes received by SSL/VPN connections in the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.6.1.5.5.0','',1,'','','','','',1); + +SET @component_name = 'F5 Total SSL/VPN bytes transmitted'; +SET @component_description = 'The total raw bytes transmitted by SSL/VPN connections in the system'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'bytes','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','f5',1,1,'1.3.6.1.4.1.3375.2.6.1.5.6.0','',1,'','','','','',1); + +SET @component_name = 'Juniper _nameOID_ active sites'; +SET @component_description = 'The number of active sites in the VPN'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.26.1.2.1.9','',1,'1.3.6.1.4.1.2636.3.26.1.2.1.2','','','','',1); + +SET @component_name = 'Juniper _nameOID_ age'; +SET @component_description = 'The age (i.e., time from creation till now) of this VPN in hundredths of a second'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'_timeticks_','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.26.1.2.1.12','',1,'1.3.6.1.4.1.2636.3.26.1.2.1.2','','','','',1); + +SET @component_name = 'Juniper _nameOID_ interface status'; +SET @component_description = 'Status of this interface: unknown(0), noLocalInterface(1), disabled(2), encapsulationMismatch(3), down(4), up(5)'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','juniper',1,2,'1.3.6.1.4.1.2636.3.26.1.3.1.10','',1,'1.3.6.1.4.1.2636.3.26.1.3.1.2','','','','',1); + +SET @component_group_name = 'Intrussions'; + +SET @component_name = 'Fortinet virtual domain _nameOID_ intrussions detected'; +SET @component_description = 'Number of intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.1','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ intrussions blocked'; +SET @component_description = 'Number of intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.1','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ critical severity intrussions'; +SET @component_description = 'Number of critical severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.3','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ high severity intrussions'; +SET @component_description = 'Number of high severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.4','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ medium severity intrussions'; +SET @component_description = 'Number of medium severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.5','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ low severity intrussions'; +SET @component_description = 'Number of low severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.6','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ informational severity intrussions'; +SET @component_description = 'Number of informational severity intrusions detected since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.7','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ signature detections'; +SET @component_description = 'Number of intrusions detected by signature since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.8','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ anomaly detections'; +SET @component_description = 'Number of intrusions DECed as anomalies since start-up in this virtual domain'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.9.2.1.1.9','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_group_name = 'Antivirus'; + +SET @component_name = 'Fortinet virtual domain _nameOID_ virus detected'; +SET @component_description = 'Number of virus transmissions detected in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.1','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ virus blocked'; +SET @component_description = 'Number of virus transmissions blocked in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.2','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ oversized detected'; +SET @component_description = 'Number of over-sized file transmissions detected in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.17','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_name = 'Fortinet virtual domain _nameOID_ oversized blocked'; +SET @component_description = 'Number of over-sized file transmissions blocked in the virtual domain since start-up'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,15,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','Array','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'snmp','fortinet',1,2,'1.3.6.1.4.1.12356.101.8.2.1.1.18','',1,'1.3.6.1.4.1.12356.101.3.2.1.1.2','','','','',1); + +SET @component_group_name = 'Services'; + +SET @component_name = 'WMI Service _Name_ running'; +SET @component_description = '_Caption_'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,2,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,0.00,0.00,'',0.00,0.00,'',0,'','','',0,0,0.000000000000000,'','nowizard','{\"extra_field_1\":\"State\",\"extra_field_2\":\"Caption\",\"satellite_execution\":\"\",\"value_operation\":\"\",\"server_plugin\":\"0\",\"field0_wmi_field\":\"\"}','','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',1,2,'','',0,'','Win32_Service','Name','','{\"scan\":\"\",\"execution\":\"Name = '_Name_'\",\"field\":\"1\",\"key_string\":\"Running\"}',1); + +SET @component_group_name = 'Disks'; + +SET @component_name = 'WMI disk _DeviceID_ used (%)'; +SET @component_description = 'Space percentage used on the logical disk'; +SET @plugin_name = 'Wizard WMI module'; + +SET @component_id = ''; +SELECT @component_id := `id_nc` FROM `tnetwork_component` WHERE `name` = @component_name; + +SET @group_id = ''; +SELECT @group_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @component_group_name; + +SET @plugin_id = ''; +SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name; + +INSERT IGNORE INTO `tnetwork_component` (`id_nc`, `name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `unit`, `wizard_level`, `macros`, `critical_instructions`, `warning_instructions`, `unknown_instructions`, `critical_inverse`, `warning_inverse`, `id_category`, `tags`, `disabled_types_event`, `module_macros`, `min_ff_event_normal`, `min_ff_event_warning`, `min_ff_event_critical`, `ff_type`, `each_ff`, `dynamic_interval`, `dynamic_max`, `dynamic_min`, `dynamic_next`, `dynamic_two_tailed`, `module_type`, `protocol`, `manufacturer_id`, `execution_type`, `scan_type`, `value`, `value_operations`, `module_enabled`, `name_oid`, `query_class`, `query_key_field`, `scan_filters`, `query_filters`, `enabled`) VALUES (@component_id,@component_name,@component_description,@group_id,1,0,0,0,0,'','','','',0,9,0,'','','',0,0,0,80.00,90.00,'',90.00,0.00,'',0,'','','',0,0,0.000000000000000,'%','nowizard',CONCAT('{\"extra_field_1\":\"Size\",\"extra_field_2\":\"FreeSpace\",\"satellite_execution\":\"/etc/pandora/satellite_plugins/wizard_wmi_module -host "_address_" -namespace "_namespace_wmi_" -user "_user_wmi_" -pass "_pass_wmi_" -wmiClass "_class_wmi_" -fieldsList "_field_wmi_1_,_field_wmi_2_" -queryFilter "DeviceID = '_DeviceID_'" -operation "((_f1_ - _f2_) * 100) / _f1_" -wmicPath /usr/bin/wmic\",\"value_operation\":\"((_Size_ - _FreeSpace_) * 100) / _Size_\",\"server_plugin\":\"',@plugin_id,'\",\"_field2__wmi_field\":\"_namespace_wmi_\",\"_field1__wmi_field\":\"_address_\",\"_field4__wmi_field\":\"_pass_wmi_\",\"_field3__wmi_field\":\"_user_wmi_\",\"_field6__wmi_field\":\"_field_wmi_1_,_field_wmi_2_\",\"_field5__wmi_field\":\"_class_wmi_\",\"_field8__wmi_field\":\"((_f1_ - _f2_) * 100) / _f1_\",\"_field7__wmi_field\":\"DeviceID = '_DeviceID_'\",\"field0_wmi_field\":\"\"}'),'','','',0,0,0,'','{\"going_unknown\":0}','',0,0,0,0,0,0,0,0,0,0,1,'wmi','',2,2,'','',1,'','Win32_LogicalDisk','DeviceID','','{\"scan\":\"DriveType = 3\",\"execution\":\"\",\"field\":\"\",\"key_string\":\"\"}',1); + +INSERT IGNORE INTO `tpen` VALUES (171,'dlink','D-Link Systems, Inc.'),(14988,'mikrotik','MikroTik'),(6486,'alcatel','Alcatel-Lucent Enterprise'),(41112,'ubiquiti','Ubiquiti Networks, Inc.'),(207,'telesis','Allied Telesis, Inc.'),(10002,'frogfoot','Frogfoot Networks'),(2,'ibm','IBM'),(4,'unix','Unix'),(63,'apple','Apple Computer, Inc.'),(674,'dell','Dell Inc.'),(111,'oracle','Oracle'),(116,'hitachi','Hitachi, Ltd.'),(173,'netlink','Netlink'),(188,'ascom','Ascom'),(6574,'synology','Synology Inc.'),(3861,'fujitsu','Fujitsu Network Communications, Inc.'),(53526,'dell','Dell ATC'),(52627,'apple','Apple Inc'),(19464,'hitachi','Hitachi Communication Technologies, Ltd.'),(13062,'ascom','Ascom'); diff --git a/pandora_console/godmode/agentes/agent_wizard.php b/pandora_console/godmode/agentes/agent_wizard.php index c04edf4d66..3671d7053e 100644 --- a/pandora_console/godmode/agentes/agent_wizard.php +++ b/pandora_console/godmode/agentes/agent_wizard.php @@ -1,66 +1,67 @@ "; - echo "" . __('SNMP Interfaces explorer') . ""; - echo " | "; - echo "" . __('WMI explorer') . ""; - echo ""; -*/ - -require 'agent_wizard.'.$wizard_section.'.php'; - -?> - \ No newline at end of file +// AJAX controller. +if (is_ajax()) { + $method = get_parameter('method'); + + if (method_exists($obj, $method) === true) { + $obj->{$method}(); + } else { + $obj->error('Method not found. ['.$method.']'); + } + + // Stop any execution. + exit; +} else { + // Run. + $obj->run(); +} diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php deleted file mode 100644 index 21cb4eb378..0000000000 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php +++ /dev/null @@ -1,1179 +0,0 @@ - __('The SNMP remote plugin doesnt seem to be installed').'. '.__('It is necessary to use some features').'.

'.__('Please, install the SNMP remote plugin (The name of the plugin must be snmp_remote.pl)'), 'no_close' => true]); -} - -// Using plugin -if (!empty($plugin)) { - $static_snmp_descriptions['avgCpuLoad'] = 'Average of CPUs Load (%)'; - $static_snmp_descriptions['memoryUse'] = 'Memory use (%)'; -} - -$fail = false; - -$devices = []; -$processes = []; -$disks = []; -$temperatures = []; - -$arrow = false; - -$snmp_translation_data = index_array(snmp_get_translation_wizard(), null, 'description'); -$other_snmp_data = []; - -if ($snmpwalk) { - // OID Used is for DISKS - $snmpis = get_snmpwalk( - $ip_target, - $snmp_version, - $snmp_community, - $snmp3_auth_user, - $snmp3_security_level, - $snmp3_auth_method, - $snmp3_auth_pass, - $snmp3_privacy_method, - $snmp3_privacy_pass, - 0, - '.1.3.6.1.2.1.25.2.3.1.3', - $tcp_port, - $server_to_exec - ); - - if (empty($snmpis)) { - $fail = true; - $snmpis = []; - } else { - // We get here only the interface part of the MIB, not full mib - foreach ($snmpis as $key => $snmp) { - $data = explode(': ', $snmp); - $keydata = explode('::', $key); - $keydata2 = explode('.', $keydata[1]); - - // Avoid results without index and results without name - if (!isset($keydata2[1]) || !isset($data[1])) { - continue; - } - - - if (array_key_exists(1, $data)) { - $disks[$data[1]] = $data[1]; - } else { - $disks[$data[0]] = $data[0]; - } - } - - // OID Used is for PROCESSES - $snmpis = get_snmpwalk( - $ip_target, - $snmp_version, - $snmp_community, - $snmp3_auth_user, - $snmp3_security_level, - $snmp3_auth_method, - $snmp3_auth_pass, - $snmp3_privacy_method, - $snmp3_privacy_pass, - 0, - '.1.3.6.1.2.1.25.4.2.1.2', - $tcp_port, - $server_to_exec - ); - - if ($snmpis === false) { - $snmpis = []; - } - - - // We get here only the interface part of the MIB, not full mib - foreach ($snmpis as $key => $snmp) { - $data = explode(': ', $snmp); - $keydata = explode('::', $key); - $keydata2 = explode('.', $keydata[1]); - - // Avoid results without index and results without name - if (!isset($keydata2[1]) || !isset($data[1])) { - continue; - } - - if (array_key_exists(1, $data)) { - $process_name = str_replace('"', '', $data[1]); - } else { - $process_name = str_replace('"', '', $data[0]); - } - - $processes[$process_name] = $process_name; - } - - // Keep only the first process found - $processes = array_unique($processes); - - - // OID Used is for SENSOR TEMPERATURES - $snmpis = get_snmpwalk( - $ip_target, - $snmp_version, - $snmp_community, - $snmp3_auth_user, - $snmp3_security_level, - $snmp3_auth_method, - $snmp3_auth_pass, - $snmp3_privacy_method, - $snmp3_privacy_pass, - 0, - '.1.3.6.1.4.1.2021.13.16.2.1', - $tcp_port, - $server_to_exec - ); - - if ($snmpis === false) { - $snmpis = []; - } - - - // We get here only the interface part of the MIB, not full mib - foreach ($snmpis as $key => $snmp) { - $data = explode(': ', $snmp); - $keydata = explode('::', $key); - $keydata2 = explode('.', $keydata[1]); - - // Avoid results without index and results without name - if (!isset($keydata2[1]) || !isset($data[1])) { - continue; - } - - - if ($keydata2[0] == 'lmTempSensorsDevice') { - if (array_key_exists(1, $data)) { - $temperatures[$keydata2[1]] = $data[1]; - } else { - $temperatures[$keydata2[1]] = $data[0]; - } - } - } - - // Keep only the first sensor found - $temperatures = array_unique($temperatures); - - // OID Used is for DEVICES - $snmpis = get_snmpwalk( - $ip_target, - $snmp_version, - $snmp_community, - $snmp3_auth_user, - $snmp3_security_level, - $snmp3_auth_method, - $snmp3_auth_pass, - $snmp3_privacy_method, - $snmp3_privacy_pass, - 0, - '.1.3.6.1.4.1.2021.13.15.1.1', - $tcp_port, - $server_to_exec - ); - - if ($snmpis === false) { - $snmpis = []; - } - - - // We get here only the interface part of the MIB, not full mib - foreach ($snmpis as $key => $snmp) { - $data = explode(': ', $snmp); - $keydata = explode('::', $key); - $keydata2 = explode('.', $keydata[1]); - - // Avoid results without index and results without name - if (!isset($keydata2[1]) || !isset($data[1])) { - continue; - } - - - if ($keydata2[0] == 'diskIODevice') { - if (array_key_exists(1, $data)) { - $devices['diskIONRead'.$separator.$keydata2[1]] = $data[1].' - Bytes read'; - $devices['diskIONWritten'.$separator.$keydata2[1]] = $data[1].' - Bytes written'; - $devices['diskIONReads'.$separator.$keydata2[1]] = $data[1].' - Read accesses'; - $devices['diskIONWrites'.$separator.$keydata2[1]] = $data[1].' - Write accesses'; - } else { - $devices['diskIONRead'.$separator.$keydata2[1]] = $data[0].' - Bytes read'; - $devices['diskIONWritten'.$separator.$keydata2[1]] = $data[0].' - Bytes written'; - $devices['diskIONReads'.$separator.$keydata2[1]] = $data[0].' - Read accesses'; - $devices['diskIONWrites'.$separator.$keydata2[1]] = $data[0].' - Write accesses'; - } - } - } - } - - // Other SNMP Data - $arrow = true; - - foreach ($snmp_translation_data as $oid => $temp) { - if ($snmp_version == 3) { - $result = false; - // It is statics oids. - } else { - $result = @snmpget($ip_target, $snmp_community, $oid); - } - - if ($result != false) { - $other_snmp_data[$oid] = $snmp_translation_data[$oid]; - } - } - - if (empty($other_snmp_data)) { - $arrow = false; - $other_snmp_data[0] = __('Remote system doesnt support host SNMP information'); - } -} - -if ($create_modules) { - $modules = io_safe_output(get_parameter('module', [])); - - $devices = []; - $processes = []; - $disks = []; - $temperatures = []; - $snmpdata = []; - - foreach ($modules as $module) { - // Split module data to get type - $module_exploded = explode($separator, $module); - $type = $module_exploded[0]; - - // Delete type from module data - unset($module_exploded[0]); - - // Rebuild module data - $module = implode($separator, $module_exploded); - - switch ($type) { - case 'device': - $devices[] = $module; - break; - - case 'process': - $processes[] = $module; - break; - - case 'disk': - $disks[] = $module; - break; - - case 'temperature': - $temperatures[] = $module; - break; - - case 'snmpdata': - $snmpdata[] = $module; - break; - } - } - - if (agents_get_name($id_agent) == false) { - ui_print_error_message(__('No agent selected or the agent does not exist')); - } else { - // Common values - $common_values = []; - - if ($tcp_port != '') { - $common_values['tcp_port'] = $tcp_port; - } - - $common_values['snmp_community'] = $snmp_community; - if ($use_agent) { - $common_values['ip_target'] = 'auto'; - } else { - $common_values['ip_target'] = $ip_target; - } - - $common_values['tcp_send'] = $snmp_version; - - if ($snmp_version == '3') { - $common_values['plugin_user'] = $snmp3_auth_user; - $common_values['plugin_pass'] = $snmp3_auth_pass; - $common_values['plugin_parameter'] = $snmp3_auth_method; - $common_values['custom_string_1'] = $snmp3_privacy_method; - $common_values['custom_string_2'] = $snmp3_privacy_pass; - $common_values['custom_string_3'] = $snmp3_security_level; - } - - - // DEVICES - $devices_prefix_oids = [ - 'diskIONRead' => '.1.3.6.1.4.1.2021.13.15.1.1.3.', - 'diskIONWritten' => '.1.3.6.1.4.1.2021.13.15.1.1.4.', - 'diskIONReads' => '.1.3.6.1.4.1.2021.13.15.1.1.5.', - 'diskIONWrites' => '.1.3.6.1.4.1.2021.13.15.1.1.6.', - ]; - - $devices_prefix_descriptions = [ - 'diskIONRead' => __('The number of bytes read from this device since boot'), - 'diskIONWritten' => __('The number of bytes written to this device since boot'), - 'diskIONReads' => __('The number of read accesses from this device since boot'), - 'diskIONWrites' => __('The number of write accesses from this device since boot'), - ]; - - $results = []; - - foreach ($devices as $device) { - $module_values = $common_values; - - // Split module data to get type, name, etc - $device_exploded = explode($separator, $device); - $device_name = $device_exploded[0]; - - $name_exploded = explode('-', $device_name); - $name = ltrim(html_entity_decode($name_exploded[1])); - - $device_type = $device_exploded[1]; - - // Delete type from device id - unset($device_exploded[0]); - unset($device_exploded[1]); - - // Rebuild device_name - $device_id = implode($separator, $device_exploded); - - $module_values['descripcion'] = $devices_prefix_descriptions[$device_type]; - - if (($name == 'Bytes read') || ($name == 'Bytes written')) { - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp_inc'); - } else { - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp'); - } - - $module_values['snmp_oid'] = $devices_prefix_oids[$device_type].$device_id; - - $module_values['id_modulo'] = MODULE_SNMP; - - $result = modules_create_agent_module($id_agent, io_safe_input($device_name), $module_values); - - $results[$result][] = $device_name; - } - - // TEMPERATURE SENSORS - $temperatures_prefix_oid = '.1.3.6.1.4.1.2021.13.16.2.1.3.'; - $temperatures_description = 'The temperature of this sensor in C'; - - foreach ($temperatures as $temperature) { - $module_values = $common_values; - - // Split module data to get type, name, etc - $temperature_exploded = explode($separator, $temperature); - $temperature_name = $temperature_exploded[0]; - - // Delete name from temperature sensor id - unset($temperature_exploded[0]); - - // Rebuild device_name - $temperature_id = implode($separator, $temperature_exploded); - - $module_values['descripcion'] = $temperatures_description; - - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp'); - - $module_values['snmp_oid'] = $temperatures_prefix_oid.$temperature_id; - - $module_values['id_modulo'] = MODULE_SNMP; - - // Temperature are given in mC. Convert to Celsius - $module_values['post_process'] = 0.001; - - $module_values['unit'] = 'C'; - - $result = modules_create_agent_module($id_agent, io_safe_input($temperature_name), $module_values); - - $results[$result][] = $temperature_name; - } - - // SNMP DATA (STATIC MODULES) - foreach ($snmpdata as $snmpdata_oid) { - $module_values = $common_values; - $snmp_translation = snmp_get_translation($snmpdata_oid); - - $module_values['descripcion'] = $snmp_translation['description']; - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp'); - $module_values['post_process'] = $snmp_translation['post_process']; - - // Average use of CPUs is a plugin module - switch ($snmpdata_oid) { - case 'avgCpuLoad': - case 'memoryUse': - $module_values['id_modulo'] = MODULE_PLUGIN; - $module_values['id_plugin'] = $plugin['id']; - - // Avoid the return of a string containing the word 'null' if the macros column is not defined - $macros = []; - if (isset($plugin['macros']) && !empty($plugin['macros'])) { - $macros = json_decode($plugin['macros'], true); - } - - foreach ($macros as $k => $macro) { - switch ($macro['macro']) { - case '_field1_': - // Field 1 is the IP Address - $macros[$k]['value'] = $module_values['ip_target']; - break; - - case '_field2_': - // Field 2 is the community - $macros[$k]['value'] = $module_values['snmp_community']; - break; - - case '_field3_': - // Field 3 is the plugin parameters - switch ($snmpdata_name) { - case 'avgCpuLoad': - $macros[$k]['value'] = '-m cpuload'; - break; - - case 'memoryUse': - $macros[$k]['value'] = '-m memuse'; - break; - } - - if ($snmp_version == '3') { - $macros[$k]['value'] .= ' -v3 '; - switch ($snmp3_security_level) { - case 'authNoPriv': - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -A '.$snmp3_auth_pass.' -l '.$snmp3_security_level.' -a '.$snmp3_auth_method; - break; - - case 'noAuthNoPriv': - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -l '.$snmp3_security_level; - break; - - default: - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -A '.$snmp3_auth_pass.' -l '.$snmp3_security_level.' -a '.$snmp3_auth_method.' -x '.$snmp3_privacy_method.' -X '.$snmp3_privacy_pass; - break; - } - } - break; - } - } - - if (!empty($macros)) { - $module_values['macros'] = io_json_mb_encode($macros); - } - - unset($module_values['snmp_community']); - // snmp_community - unset($module_values['ip_target']); - // ip_target - unset($module_values['tcp_send']); - // snmp_version - break; - - default: - $module_values['snmp_oid'] = $snmpdata_oid; - - $module_values['id_modulo'] = MODULE_SNMP; - break; - } - - $result = modules_create_agent_module( - $id_agent, - io_safe_input($snmp_translation['description']), - $module_values - ); - - $results[$result][] = $snmp_translation['description']; - } - - // PROCESSES - foreach ($processes as $process) { - $module_values = $common_values; - - $module_values['descripcion'] = sprintf(__('Check if the process %s is running or not'), $process); - $module_values['id_tipo_modulo'] = modules_get_type_id('generic_proc'); - $module_values['id_modulo'] = MODULE_PLUGIN; - $module_values['id_plugin'] = $plugin['id']; - - // Avoid the return of a string containing the word 'null' if the macros column is not defined - $macros = []; - if (isset($plugin['macros']) && !empty($plugin['macros'])) { - $macros = json_decode($plugin['macros'], true); - } - - foreach ($macros as $k => $macro) { - switch ($macro['macro']) { - case '_field1_': - // Field 1 is the IP Address - $macros[$k]['value'] = $module_values['ip_target']; - break; - - case '_field2_': - // Field 2 is the community - $macros[$k]['value'] = $module_values['snmp_community']; - break; - - case '_field3_': - // Field 3 is the plugin parameters - $macros[$k]['value'] = io_safe_input('-m process -p "'.$process.'"'); - - if ($snmp_version == '3') { - $macros[$k]['value'] .= ' -v3 '; - switch ($snmp3_security_level) { - case 'authNoPriv': - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -A '.$snmp3_auth_pass.' -l '.$snmp3_security_level.' -a '.$snmp3_auth_method; - break; - - case 'noAuthNoPriv': - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -l '.$snmp3_security_level; - break; - - default: - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -A '.$snmp3_auth_pass.' -l '.$snmp3_security_level.' -a '.$snmp3_auth_method.' -x '.$snmp3_privacy_method.' -X '.$snmp3_privacy_pass; - break; - } - } - break; - } - } - - if (!empty($macros)) { - $module_values['macros'] = io_json_mb_encode($macros); - } - - unset($module_values['snmp_community']); - // snmp_community - unset($module_values['ip_target']); - // ip_target - unset($module_values['tcp_send']); - // snmp_version - $result = modules_create_agent_module($id_agent, io_safe_input($process), $module_values); - - $results[$result][] = $process; - } - - - // DISKS USE - foreach ($disks as $disk) { - $module_values = $common_values; - - $module_values['descripcion'] = __('Disk use information'); - $module_values['id_tipo_modulo'] = modules_get_type_id('remote_snmp'); - $module_values['id_modulo'] = MODULE_PLUGIN; - $module_values['id_plugin'] = $plugin['id']; - - // Avoid the return of a string containing the word 'null' if the macros column is not defined - $macros = []; - if (isset($plugin['macros']) && !empty($plugin['macros'])) { - $macros = json_decode($plugin['macros'], true); - } - - foreach ($macros as $k => $macro) { - switch ($macro['macro']) { - case '_field1_': - // Field 1 is the IP Address - $macros[$k]['value'] = $module_values['ip_target']; - break; - - case '_field2_': - // Field 2 is the community - $macros[$k]['value'] = $module_values['snmp_community']; - break; - - case '_field3_': - // Field 3 is the plugin parameters - $macros[$k]['value'] = io_safe_input('-m diskuse -d "'.io_safe_output($disk).'"'); - - if ($snmp_version == '3') { - $macros[$k]['value'] .= ' -v3 '; - switch ($snmp3_security_level) { - case 'authNoPriv': - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -A '.$snmp3_auth_pass.' -l '.$snmp3_security_level.' -a '.$snmp3_auth_method; - break; - - case 'noAuthNoPriv': - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -l '.$snmp3_security_level; - break; - - default: - $macros[$k]['value'] .= ' -u '.$snmp3_auth_user.' -A '.$snmp3_auth_pass.' -l '.$snmp3_security_level.' -a '.$snmp3_auth_method.' -x '.$snmp3_privacy_method.' -X '.$snmp3_privacy_pass; - break; - } - } - } - } - - if (!empty($macros)) { - $module_values['macros'] = io_json_mb_encode($macros); - } - - unset($module_values['snmp_community']); - // snmp_community - unset($module_values['ip_target']); - // ip_target - unset($module_values['tcp_send']); - // snmp_version - $result = modules_create_agent_module( - $id_agent, - io_safe_input($disk), - $module_values - ); - - $results[$result][] = $disk; - } - - $success_message = ''; - $error_message = ''; - - if (isset($results[NOERR])) { - if (count($results[NOERR]) > 0) { - $success_message .= sprintf(__('%s modules created succesfully'), count($results[NOERR])).'
'; - } - } - - if (isset($results[ERR_GENERIC])) { - if (count($results[ERR_GENERIC]) > 0) { - $error_message .= sprintf(__('Error creating %s modules').':
  * '.implode('
  * ', $results[ERR_GENERIC]), count($results[ERR_GENERIC])).'
'; - } - } - - if (isset($results[ERR_DB])) { - if (count($results[ERR_DB]) > 0) { - $error_message .= sprintf(__('Error creating %s modules').':
  * '.implode('
  * ', $results[ERR_DB]), count($results[ERR_DB])).'
'; - } - } - - if (isset($results[ERR_EXIST])) { - if (count($results[ERR_EXIST]) > 0) { - $error_message .= sprintf(__('%s modules already exist').':
  * '.implode('
  * ', $results[ERR_EXIST]), count($results[ERR_EXIST])).'
'; - } - } - - if (!empty($error_message)) { - ui_print_error_message($error_message); - } else { - if (empty($success_message)) { - $success_message .= sprintf(__('Modules created succesfully')).'
'; - } - - ui_print_success_message($success_message); - } - } -} - -echo ''; -echo "
"; - -$table->width = '100%'; -$table->cellpadding = 0; -$table->cellspacing = 0; -$table->class = 'databox filters'; - -$table->data[0][0] = ''.__('Target IP').''; -$table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true); - -$table->data[0][2] = ''.__('Port').''; -$table->data[0][3] = html_print_input_text('tcp_port', $tcp_port, '', 5, 20, true); - -$table->data[1][0] = ''.__('Use agent ip').''; -$table->data[1][1] = html_print_checkbox('use_agent', 1, $use_agent, true); - -$servers_to_exec = []; -$servers_to_exec[0] = __('Local console'); -if (enterprise_installed()) { - enterprise_include_once('include/functions_satellite.php'); - - $rows = get_proxy_servers(); - - // Check if satellite server has remote configuration enabled. - $satellite_remote = config_agents_has_remote_configuration($id_agent); - - foreach ($rows as $row) { - if ($row['server_type'] != 13) { - $s_type = ' (Standard)'; - } else { - $id_satellite = $row['id_server']; - $s_type = ' (Satellite)'; - } - - $servers_to_exec[$row['id_server']] = $row['name'].$s_type; - } -} - -$table->data[1][2] = ''.__('Server to execute command').''.ui_print_help_icon('agent_snmp_explorer_tab', true); -$table->data[1][3] = html_print_select( - $servers_to_exec, - 'server_to_exec', - $server_to_exec, - 'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')', - '', - '', - true -); - -$snmp_versions['1'] = 'v. 1'; -$snmp_versions['2'] = 'v. 2'; -$snmp_versions['2c'] = 'v. 2c'; -$snmp_versions['3'] = 'v. 3'; - -$table->data[2][0] = ''.__('SNMP community').''; -$table->data[2][1] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true); - -$table->data[2][2] = ''.__('SNMP version').''; -$table->data[2][3] = html_print_select($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, ''); - -$table->data[2][3] .= ''; - -html_print_input_hidden('snmpwalk', 1); - -html_print_table($table); - -unset($table); - -// SNMP3 OPTIONS -$table->width = '100%'; - -$table->data[2][1] = ''.__('Auth user').''; -$table->data[2][2] = html_print_input_text('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true); -$table->data[2][3] = ''.__('Auth password').''; -$table->data[2][4] = html_print_input_password('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true); -$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awse', true); - -$table->data[5][0] = ''.__('Privacy method').''; -$table->data[5][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true); -$table->data[5][2] = ''.__('privacy pass').''; -$table->data[5][3] = html_print_input_password('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true); - -$table->data[6][0] = ''.__('Auth method').''; -$table->data[6][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true); -$table->data[6][2] = ''.__('Security level').''; -$table->data[6][3] = html_print_select( - [ - 'noAuthNoPriv' => __('Not auth and not privacy method'), - 'authNoPriv' => __('Auth and not privacy method'), - 'authPriv' => __('Auth and privacy method'), - ], - 'snmp3_security_level', - $snmp3_security_level, - '', - '', - '', - true -); - -if ($snmp_version == 3) { - echo '
'; -} else { - echo ''; - -echo "
"; -echo ''; -html_print_submit_button(__('SNMP Walk'), 'snmp_walk', false, ['class' => 'sub next']); -echo '
'; - -if ($snmpwalk && $fail) { - ui_print_error_message('
'.__('No data found').'

'.__('If the device is a network device, try with the SNMP Interfaces wizard')); -} - -unset($table); - -echo ''; - -if (!$fail) { - echo ''; - echo "
"; - echo ''; - - html_print_input_hidden('create_modules', 1); - html_print_input_hidden('ip_target', $ip_target); - html_print_input_hidden('use_agent', $use_agent); - html_print_input_hidden('tcp_port', $tcp_port); - html_print_input_hidden('snmp_community', $snmp_community); - html_print_input_hidden('snmp_version', $snmp_version); - html_print_input_hidden('snmp3_auth_user', $snmp3_auth_user); - html_print_input_hidden('snmp3_auth_pass', $snmp3_auth_pass); - html_print_input_hidden('snmp3_auth_method', $snmp3_auth_method); - html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method); - html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass); - html_print_input_hidden('snmp3_security_level', $snmp3_security_level); - - $table->width = '100%'; - - // Mode selector - $modes = []; - $modes['devices'] = __('Devices'); - $modes['processes'] = __('Processes'); - $modes['disks'] = __('Free space on disk'); - $modes['temperatures'] = __('Temperature sensors'); - $modes['snmpdata'] = __('Other SNMP data'); - - $table->data[1][0] = __('Wizard mode').': '; - $table->data[1][0] .= html_print_select( - $modes, - 'snmp_wizard_modes', - '', - '', - '', - '', - true, - false, - false - ); - $table->cellstyle[1][0] = 'vertical-align: middle;'; - - $table->colspan[1][0] = 2; - $table->data[1][2] = ''.__('Modules').''; - $table->cellstyle[1][2] = 'vertical-align: middle;'; - - // Devices list - $table->data[2][0] = '
'; - $table->data[2][0] .= html_print_select( - $devices, - 'devices', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - - // If SNMP remote plugin is not installed, show an advice - if (empty($plugin)) { - // Processes list - $table->data[2][0] .= '
'; - $table->data[2][0] .= ui_print_info_message(__('SNMP remote plugin is necessary for this feature'), '', true); - $table->data[2][0] .= '
'; - - // Disks list - $table->data[2][0] .= '
'; - $table->data[2][0] .= ui_print_info_message(__('SNMP remote plugin is necessary for this feature'), '', true); - $table->data[2][0] .= '
'; - } else { - // Processes list - $table->data[2][0] .= '
'; - $table->data[2][0] .= html_print_select( - $processes, - 'processes', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - - // Disks list - $table->data[2][0] .= '
'; - $table->data[2][0] .= html_print_select( - $disks, - 'disks', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - } - - // Sensors temperatures list - $table->data[2][0] .= '
'; - $table->data[2][0] .= html_print_select( - $temperatures, - 'temperatures', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - - // SNMP data list - $table->data[2][0] .= '
'; - $table->data[2][0] .= html_print_select( - $other_snmp_data, - 'snmpdata', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - - $table->cellstyle[2][0] = 'vertical-align: top; text-align: center;'; - - // Devices arrow - $table->data[2][1] = '
'.html_print_image('images/darrowright.png', true, ['title' => __('Add to modules list')]).'
'; - // Processes arrow - $table->data[2][1] .= '
'.html_print_image('images/darrowright.png', true, ['title' => __('Add to modules list')]).'
'; - // Disks arrow - $table->data[2][1] .= '
'.html_print_image('images/darrowright.png', true, ['title' => __('Add to modules list')]).'
'; - // Temperatures arrow - $table->data[2][1] .= '
'.html_print_image('images/darrowright.png', true, ['title' => __('Add to modules list')]).'
'; - // SNMP data arrow - if ($arrow) { - $table->data[2][1] .= '
'.html_print_image('images/darrowright.png', true, ['title' => __('Add to modules list')]).'
'; - } - - $table->data[2][1] .= '

'.html_print_image('images/cross.png', true, ['title' => __('Remove from modules list')]).'
'; - $table->cellstyle[2][1] = 'vertical-align: middle; text-align: center;'; - - $table->data[2][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:300px; height: 100%;'); - $table->data[2][2] .= html_print_input_hidden('agent', $id_agent, true); - $table->cellstyle[2][2] = 'vertical-align: top; text-align: center;'; - - html_print_table($table); - - echo "
"; - html_print_submit_button(__('Create modules'), 'create_modules_btn', false, ['class' => 'sub add']); - echo '
'; - unset($table); - - echo '
'; - echo '
'; - echo '
'; -} - -ui_require_jquery_file('pandora.controls'); -ui_require_jquery_file('ajaxqueue'); -ui_require_jquery_file('bgiframe'); -ui_require_javascript_file('pandora_modules'); - -?> - diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php deleted file mode 100644 index 3c197ac4a1..0000000000 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ /dev/null @@ -1,743 +0,0 @@ -] => [] array. - if (!empty($snmp_int_ip)) { - foreach ($snmp_int_ip as $key => $value) { - // The key is something like IP-MIB::ipAddressIfIndex.ipv4."". - // or IP-MIB::ipAddressIfIndex.ipv6."". - // The value is something like INTEGER: . - $data = explode(': ', $value); - $interface_id = !empty($data) && isset($data[1]) ? $data[1] : false; - - if (preg_match('/^.+"(.+)"$/', $key, $matches) && isset($matches[1])) { - $interface_ip = $matches[1]; - } - - // Get the first ip. - if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) { - $interfaces_ip[$interface_id] = $interface_ip; - } - } - - unset($snmp_int_ip); - } - - $snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems)); - - $interfaces = []; - - // We get here only the interface part of the MIB, not full mib. - foreach ($snmpis as $key => $snmp) { - $data = explode(': ', $snmp, 2); - $keydata = explode('::', $key); - $keydata2 = explode('.', $keydata[1]); - - // Avoid results without index and interfaces without name. - if (!isset($keydata2[1]) || !isset($data[1])) { - continue; - } - - if (array_key_exists(1, $data)) { - $interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0]; - $interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1]; - } else { - $interfaces[$keydata2[1]][$keydata2[0]]['type'] = ''; - $interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0]; - } - - $interfaces[$keydata2[1]][$keydata2[0]]['oid'] = $key; - $interfaces[$keydata2[1]][$keydata2[0]]['checked'] = 0; - } - - unset($interfaces[0]); -} - -if ($create_modules) { - $id_snmp_serialize = get_parameter_post('id_snmp_serialize'); - $interfaces = unserialize_in_temp($id_snmp_serialize); - - $id_snmp_int_ip_serialize = get_parameter_post('id_snmp_int_ip_serialize'); - $interfaces_ip = unserialize_in_temp($id_snmp_int_ip_serialize); - - if (!$interfaces) { - $interfaces = []; - } - - if (!$interfaces_ip) { - $interfaces_ip = []; - } - - $values = []; - - if ($tcp_port != '') { - $values['tcp_port'] = $tcp_port; - } - - $values['snmp_community'] = $snmp_community; - if ($use_agent) { - $values['ip_target'] = 'auto'; - } else { - $values['ip_target'] = $ip_target; - } - - $values['tcp_send'] = $snmp_version; - - if ($snmp_version == '3') { - $values['plugin_user'] = $snmp3_auth_user; - $values['plugin_pass'] = $snmp3_auth_pass; - $values['plugin_parameter'] = $snmp3_auth_method; - $values['custom_string_1'] = $snmp3_privacy_method; - $values['custom_string_2'] = $snmp3_privacy_pass; - $values['custom_string_3'] = $snmp3_security_level; - } - - $oids = []; - foreach ($interfaces as $key => $interface) { - foreach ($interface as $key2 => $module) { - $oid = get_parameter($key.'-'.$key2, ''); - if ($oid != '') { - $interfaces[$key][$key2]['checked'] = 1; - $oids[$key][] = $interfaces[$key][$key2]['oid']; - } else { - $interfaces[$key][$key2]['checked'] = 0; - } - } - } - - $modules = get_parameter('module', []); - $id_snmp = get_parameter('id_snmp'); - - if ($id_snmp == false) { - ui_print_error_message(__('No modules selected')); - $id_snmp = []; - } - - if (agents_get_name($id_agent) == false) { - ui_print_error_message(__('No agent selected or the agent does not exist')); - $id_snmp = []; - } - - $result = false; - - $errors = []; - $done = 0; - - foreach ($id_snmp as $id) { - $ifname = ''; - $ifPhysAddress = ''; - - if (isset($interfaces[$id]['ifName']) && $interfaces[$id]['ifName']['value'] != '') { - $ifname = $interfaces[$id]['ifName']['value']; - } else if (isset($interfaces[$id]['ifDescr']) && $interfaces[$id]['ifDescr']['value'] != '') { - $ifname = $interfaces[$id]['ifDescr']['value']; - } - - if (isset($interfaces[$id]['ifPhysAddress']) && $interfaces[$id]['ifPhysAddress']['value'] != '') { - $ifPhysAddress = $interfaces[$id]['ifPhysAddress']['value']; - $ifPhysAddress = strtoupper($ifPhysAddress); - } - - foreach ($modules as $module) { - $oid_array = explode('.', $module); - $oid_array[(count($oid_array) - 1)] = $id; - $oid = implode('.', $oid_array); - - // Get the name. - $name_array = explode('::', $oid_array[0]); - $name = $ifname.'_'.$name_array[1]; - - // If you select "show all modules" and the module is not from the interface. - if (!array_key_exists($name_array[1], $interfaces[$id])) { - continue; - } - - // Clean the name. - $name = str_replace('"', '', $name); - - // Proc moduletypes. - if (preg_match('/Status/', $name_array[1])) { - $module_type = 18; - } else if (preg_match('/Present/', $name_array[1])) { - $module_type = 18; - } else if (preg_match('/PromiscuousMode/', $name_array[1])) { - $module_type = 18; - } else if (preg_match('/Alias/', $name_array[1])) { - // String moduletypes. - $module_type = 17; - } else if (preg_match('/Address/', $name_array[1])) { - $module_type = 17; - } else if (preg_match('/Name/', $name_array[1])) { - $module_type = 17; - } else if (preg_match('/Specific/', $name_array[1])) { - $module_type = 17; - } else if (preg_match('/Descr/', $name_array[1])) { - $module_type = 17; - } else if (preg_match('/s$/', $name_array[1])) { - // Specific counters (ends in s). - $module_type = 16; - } else { - // Otherwise, numeric. - $module_type = 15; - } - - $values['unit'] = ''; - if (preg_match('/Octets/', $name_array[1])) { - $values['unit'] = 'Bytes'; - } - - $module_server = 2; - - if ($server_to_exec != 0) { - $sql = sprintf('SELECT server_type, ip_address FROM tserver WHERE id_server = %d', $server_to_exec); - $row = db_get_row_sql($sql); - - if ($row['server_type'] == 13) { - if (preg_match('/ifPhysAddress/', $name_array[1])) { - $module_type = 3; - } else if (preg_match('/ifSpecific/', $name_array[1])) { - $module_type = 3; - } else if (preg_match('/ifType/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifSpeed/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifPromiscuousMode/', $name_array[1])) { - $module_type = 2; - } else if (preg_match('/ifOutQLen/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifName/', $name_array[1])) { - $module_type = 3; - } else if (preg_match('/ifMtu/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifLinkUpDownTrapEnable/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifLastChange/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifIndex/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifDescr/', $name_array[1])) { - $module_type = 3; - } else if (preg_match('/ifCounterDiscontinuityTime/', $name_array[1])) { - $module_type = 1; - } else if (preg_match('/ifConnectorPresent/', $name_array[1])) { - $module_type = 2; - } else if (preg_match('/ifAdminStatus/', $name_array[1])) { - $module_type = 2; - } else if (preg_match('/ifOperStatus/', $name_array[1])) { - $module_type = 2; - } else { - $module_type = 4; - } - - $module_server = 1; - - $output_oid = ''; - - exec('snmptranslate -On '.$oid, $output_oid, $rc); - - $conf_oid = $output_oid[0]; - $oid = $conf_oid; - } - } - - $values['id_tipo_modulo'] = $module_type; - - if (!empty($ifPhysAddress) && isset($interfaces_ip[$id])) { - $values['descripcion'] = io_safe_input('(IP: '.$interfaces_ip[$id].' - MAC: '.$ifPhysAddress.' - '.$name.') '.$interfaces[$id]['ifDescr']['value']); - } else if (!empty($ifPhysAddress)) { - $values['descripcion'] = io_safe_input('(MAC: '.$ifPhysAddress.' - '.$name.') '.$interfaces[$id]['ifDescr']['value']); - } else if (isset($interfaces_ip[$id])) { - $values['descripcion'] = io_safe_input('(IP: '.$interfaces_ip[$id].' - '.$name.') '.$interfaces[$id]['ifDescr']['value']); - } else { - $values['descripcion'] = io_safe_input('('.$name.') '.$interfaces[$id]['ifDescr']['value']); - } - - $values['snmp_oid'] = $oid; - $values['id_modulo'] = $module_server; - - $result = modules_create_agent_module($id_agent, io_safe_input($name), $values); - - if (is_error($result)) { - if (!isset($errors[$result])) { - $errors[$result] = 0; - } - - $errors[$result]++; - } else { - if ($server_to_exec != 0) { - $sql = sprintf('SELECT server_type FROM tserver WHERE id_server = %d', $server_to_exec); - $row = db_get_row_sql($sql); - - if ($row['server_type'] == 13) { - $module_type_name = db_get_value_filter('nombre', 'ttipo_modulo', ['id_tipo' => $values['id_tipo_modulo']]); - - $new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_version ".$snmp_version."\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community']; - - if ($snmp_version == '3') { - $new_module_configuration_data .= "\nmodule_secname ".$snmp3_auth_user; - $new_module_configuration_data .= "\nmodule_seclevel ".$snmp3_security_level; - - if ($snmp3_security_level == 'authNoPriv' || $snmp3_security_level == 'authPriv') { - $new_module_configuration_data .= "\nmodule_authpass ".$snmp3_auth_pass; - $new_module_configuration_data .= "\nmodule_authproto ".$snmp3_auth_method; - } - - if ($snmp3_security_level == 'authPriv') { - $new_module_configuration_data .= "\nmodule_privproto ".$snmp3_privacy_method; - $new_module_configuration_data .= "\nmodule_privpass ".$snmp3_privacy_pass; - } - } - - $new_module_configuration_data .= "\nmodule_end"; - - config_agents_add_module_in_conf($id_agent, $new_module_configuration_data); - } - } - - $done++; - } - } - } - - if ($done > 0) { - ui_print_success_message( - __('Successfully modules created').' ('.$done.')' - ); - } - - if (!empty($errors)) { - $msg = __('Could not be created').':'; - - - foreach ($errors as $code => $number) { - switch ($code) { - case ERR_EXIST: - $msg .= '
'.__('Another module already exists with the same name').' ('.$number.')'; - break; - - case ERR_INCOMPLETE: - $msg .= '
'.__('Some required fields are missed').': ('.__('name').') ('.$number.')'; - break; - - case ERR_DB: - case ERR_GENERIC: - default: - $msg .= '
'.__('Processing error').' ('.$number.')'; - break; - } - } - - ui_print_error_message($msg); - } -} - -// Create the interface list for the interface. -$interfaces_list = []; -foreach ($interfaces as $interface) { - // Get the interface name, removing " " characters and avoid "blank" interfaces. - if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') { - $ifname = $interface['ifDescr']['value']; - } else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') { - $ifname = $interface['ifName']['value']; - } else { - continue; - } - - $interfaces_list[$interface['ifIndex']['value']] = str_replace('"', '', $ifname); -} - -echo ''; -echo "
"; - -$table->width = '100%'; -$table->cellpadding = 0; -$table->cellspacing = 0; -$table->class = 'databox filters'; - -$table->data[0][0] = ''.__('Target IP').''; -$table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true); - -$table->data[0][2] = ''.__('Port').''; -$table->data[0][3] = html_print_input_text('tcp_port', $tcp_port, '', 5, 20, true); - -$table->data[1][0] = ''.__('Use agent ip').''; -$table->data[1][1] = html_print_checkbox('use_agent', 1, $use_agent, true); - -$servers_to_exec = []; -$servers_to_exec[0] = __('Local console'); -if (enterprise_installed()) { - enterprise_include_once('include/functions_satellite.php'); - - $rows = get_proxy_servers(); - - // Check if satellite server has remote configuration enabled. - $satellite_remote = config_agents_has_remote_configuration($id_agent); - - foreach ($rows as $row) { - if ($row['server_type'] != 13) { - $s_type = ' (Standard)'; - } else { - $id_satellite = $row['id_server']; - $s_type = ' (Satellite)'; - } - - $servers_to_exec[$row['id_server']] = $row['name'].$s_type; - } -} - -$table->data[1][2] = ''.__('Server to execute command').''.ui_print_help_icon('agent_snmp_explorer_tab', true); -$table->data[1][2] .= ''.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').''; -$table->data[1][4] = html_print_select( - $servers_to_exec, - 'server_to_exec', - $server_to_exec, - 'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')', - '', - '', - true -); - -$snmp_versions['1'] = 'v. 1'; -$snmp_versions['2'] = 'v. 2'; -$snmp_versions['2c'] = 'v. 2c'; -$snmp_versions['3'] = 'v. 3'; - -$table->data[2][0] = ''.__('SNMP community').''; -$table->data[2][1] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true); - -$table->data[2][2] = ''.__('SNMP version').''; -$table->data[2][3] = html_print_select($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, ''); - -$table->data[2][3] .= ''; -html_print_input_hidden('snmpwalk', 1); - -html_print_table($table); - -unset($table); - -// SNMP3 OPTIONS. -$table->width = '100%'; - -$table->data[2][1] = ''.__('Auth user').''; -$table->data[2][2] = html_print_input_text('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true); -$table->data[2][3] = ''.__('Auth password').''; -$table->data[2][4] = html_print_input_password('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true); -$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awsie', true); - -$table->data[5][0] = ''.__('Privacy method').''; -$table->data[5][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true); -$table->data[5][2] = ''.__('privacy pass').''; -$table->data[5][3] = html_print_input_password('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true); - -$table->data[6][0] = ''.__('Auth method').''; -$table->data[6][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true); -$table->data[6][2] = ''.__('Security level').''; -$table->data[6][3] = html_print_select( - [ - 'noAuthNoPriv' => __('Not auth and not privacy method'), - 'authNoPriv' => __('Auth and not privacy method'), - 'authPriv' => __('Auth and privacy method'), - ], - 'snmp3_security_level', - $snmp3_security_level, - '', - '', - '', - true -); - -if ($snmp_version == 3) { - echo '
'; -} else { - echo ''; - -echo "
"; -echo ''; -html_print_submit_button(__('SNMP Walk'), 'snmp_walk', false, ['class' => 'sub next']); -echo '
'; - -if ($snmpwalk && !$snmpis) { - ui_print_error_message(__('Unable to do SNMP walk')); -} - -unset($table); - -echo ''; - -if (!empty($interfaces_list)) { - echo ''; - echo "
"; - echo ''; - - $id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp'); - html_print_input_hidden('id_snmp_serialize', $id_snmp_serialize); - - $id_snmp_int_ip_serialize = serialize_in_temp($interfaces_ip, $config['id_user'].'_snmp_int_ip'); - html_print_input_hidden('id_snmp_int_ip_serialize', $id_snmp_int_ip_serialize); - - html_print_input_hidden('create_modules', 1); - html_print_input_hidden('ip_target', $ip_target); - html_print_input_hidden('use_agent', $use_agent); - html_print_input_hidden('tcp_port', $tcp_port); - html_print_input_hidden('snmp_community', $snmp_community); - html_print_input_hidden('snmp_version', $snmp_version); - html_print_input_hidden('snmp3_auth_user', $snmp3_auth_user); - html_print_input_hidden('snmp3_auth_pass', $snmp3_auth_pass); - html_print_input_hidden('snmp3_auth_method', $snmp3_auth_method); - html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method); - html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass); - html_print_input_hidden('snmp3_security_level', $snmp3_security_level); - html_print_input_hidden('server_to_exec', $server_to_exec); - - $table->width = '100%'; - - // Agent selector. - $table->data[0][0] = ''.__('Interfaces').''; - $table->data[0][1] = ''; - $table->data[0][2] = ''.__('Modules').''; - - $table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;'); - - $table->data[1][1] = __('When selecting interfaces'); - $table->data[1][1] .= '
'; - $table->data[1][1] .= html_print_select( - [ - 1 => __('Show common modules'), - 0 => __('Show all modules'), - ], - 'modules_selection_mode', - 1, - false, - '', - '', - true, - false, - false - ); - - $table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;'); - $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); - - html_print_table($table); - - echo "
"; - html_print_submit_button(__('Create modules'), '', false, ['class' => 'sub add']); - echo '
'; - unset($table); - - echo '
'; - echo '
'; - echo '
'; -} - -ui_require_jquery_file('pandora.controls'); -ui_require_jquery_file('ajaxqueue'); -ui_require_jquery_file('bgiframe'); -?> - diff --git a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php deleted file mode 100644 index 20c955ab05..0000000000 --- a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php +++ /dev/null @@ -1,873 +0,0 @@ - $row) { - // First and second rows are Class and column names, ignore it. - if ($index < 2) { - continue; - } - - $row_exploded = explode('|', $row); - - if (!in_array($row_exploded[$processes_name_field], $processes)) { - if (preg_match('/ERROR/', $row_exploded[$processes_name_field])) { - $processes[$row_exploded[$prouycesses_name_field]] = __('None'); - } else { - $processes[$row_exploded[$prouycesses_name_field]] = $row_exploded[$processes_name_field]; - } - } - } - - unset($output); - - // Services. - $wmi_services = $wmi_command.' "select Name from Win32_Service"'; - $services_name_field = 0; - $services_check_field = 1; - - if (enterprise_installed() && (int) $server_to_exec != 0) { - $server_data = db_get_row( - 'tserver', - 'id_server', - $server_to_exec - ); - if (empty($server_data['port'])) { - exec( - 'ssh pandora_exec_proxy@'.$server_data['ip_address']." - '".$wmi_services."'", - $output, - $rc - ); - } else { - exec( - 'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']." - '".$wmi_services."'", - $output, - $rc - ); - } - } else { - exec($wmi_services, $output); - } - - foreach ($output as $index => $row) { - // First and second rows are Class and column names, ignore it. - if ($index < 2) { - continue; - } - - $row_exploded = explode('|', $row); - - if (!in_array($row_exploded[$services_name_field], $services)) { - if (preg_match('/ERROR/', $row_exploded[$services_name_field])) { - $services[$row_exploded[$services_name_field]] = __('None'); - } else { - $services[$row_exploded[$services_name_field]] = $row_exploded[$services_name_field]; - } - } - } - - unset($output); - - // Disks. - $wmi_disks = $wmi_command.' "Select DeviceID from Win32_LogicalDisk"'; - $disks_name_field = 0; - - if (enterprise_installed() && (int) $server_to_exec != 0) { - $server_data = db_get_row('tserver', 'id_server', $server_to_exec); - - if (empty($server_data['port'])) { - exec( - 'ssh pandora_exec_proxy@'.$server_data['ip_address']." - '".$wmi_disks."'", - $output, - $rc - ); - } else { - exec( - 'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']." - '".$wmi_disks."'", - $output, - $rc - ); - } - } else { - exec($wmi_disks, $output); - } - - foreach ($output as $index => $row) { - // First and second rows are Class and column names, ignore it. - if ($index < 2) { - continue; - } - - $row_exploded = explode('|', $row); - - if (!in_array($row_exploded[$disks_name_field], $services)) { - if (preg_match('/ERROR/', $row_exploded[$disks_name_field])) { - $disks[$row_exploded[$disks_name_field]] = __('None'); - } else { - $disk_string = sprintf( - __('Free space on %s'), - $row_exploded[$disks_name_field] - ); - $disks[$row_exploded[$disks_name_field]] = $disk_string; - } - } - } - - unset($output); - - // WMI Components. - $network_component_groups = network_components_get_groups(MODULE_WMI); - } -} - -if ($create_modules) { - $modules = get_parameter('module', []); - - $services = []; - $processes = []; - $disks = []; - $components = []; - - foreach ($modules as $module) { - // Split module data to get type. - $module_exploded = explode('_', $module); - $type = $module_exploded[0]; - - // Delete type from module data. - unset($module_exploded[0]); - - // Rebuild module data. - $module = implode('_', $module_exploded); - - switch ($type) { - case 'service': - $services[] = $module; - break; - - case 'process': - $processes[] = $module; - break; - - case 'disk': - $disks[] = $module; - break; - - case 'component': - $components[] = $module; - break; - - default: - // Default. - break; - } - } - - // Common values for WMI modules. - $values = [ - 'ip_target' => $ip_target, - 'tcp_send' => $tcp_send, - 'plugin_user' => $plugin_user, - 'plugin_pass' => $plugin_pass, - 'id_modulo' => MODULE_WMI, - ]; - - if ($server_to_exec != 0) { - $sql = sprintf( - 'SELECT server_type FROM tserver WHERE id_server = %d', - $server_to_exec - ); - $row = db_get_row_sql($sql); - - if ($row['server_type'] == 13) { - $values['id_modulo'] = 1; - } - } - - // Create Service modules. - $services_values = $values; - - $services_values['snmp_community'] = 'Running'; - // Key string. - $services_values['tcp_port'] = 1; - // Field number (Running/Stopped). - $services_values['id_tipo_modulo'] = 2; - // Generic boolean. - $services_result = wmi_create_wizard_modules( - $id_agent, - $services, - 'services', - $services_values, - 0, - 0, - $server_to_exec - ); - - // Create Process modules. - $processes_values = $values; - - $processes_values['tcp_port'] = 0; - // Field number (OID). - $processes_values['id_tipo_modulo'] = 2; - // Generic boolean. - $processes_result = wmi_create_wizard_modules( - $id_agent, - $processes, - 'processes', - $processes_values, - 0, - 0, - $server_to_exec - ); - - // Create Space on disk modules. - $disks_values = $values; - - $disks_values['tcp_port'] = 1; - // Free space in bytes. - $disks_values['id_tipo_modulo'] = 1; - // Generic numeric. - $disks_values['unit'] = 'Bytes'; - // Unit. - $disks_result = wmi_create_wizard_modules( - $id_agent, - $disks, - 'disks', - $disks_values, - 0, - 0, - $server_to_exec - ); - - // Create modules from component. - $components_values = $values; - - $components_values['id_agente'] = $id_agent; - - $components_result = wmi_create_module_from_components( - $components, - $components_values, - 0, - 0, - $server_to_exec - ); - - - // Errors/Success messages. - $success_message = ''; - $error_message = ''; - if (!empty($services_result)) { - if (count($services_result[NOERR]) > 0) { - $success_message .= sprintf( - __('%s service modules created succesfully'), - count($services_result[NOERR]) - ).'
'; - } - - if (count($services_result[ERR_GENERIC]) > 0) { - $error_message .= sprintf( - __('Error creating %s service modules'), - count($services_result[ERR_GENERIC]) - ).'
'; - } - } - - if (!empty($processes_result)) { - if (count($processes_result[NOERR]) > 0) { - $success_message .= sprintf( - __('%s process modules created succesfully'), - count($processes_result[NOERR]) - ).'
'; - } - - if (count($processes_result[ERR_GENERIC]) > 0) { - $error_message .= sprintf( - __('Error creating %s process modules'), - count($processes_result[ERR_GENERIC]) - ).'
'; - } - } - - if (!empty($disks_result)) { - if (count($disks_result[NOERR]) > 0) { - $success_message .= sprintf( - __('%s disk space modules created succesfully'), - count($disks_result[NOERR]) - ).'
'; - } - - if (count($disks_result[ERR_GENERIC]) > 0) { - $error_message .= sprintf( - __('Error creating %s disk space modules'), - count($disks_result[ERR_GENERIC]) - ).'
'; - } - } - - if (!empty($components_result)) { - if (count($components_result[NOERR]) > 0) { - $success_message .= sprintf( - __('%s modules created from components succesfully'), - count($components_result[NOERR]) - ).'
'; - } - - if (count($components_result[ERR_GENERIC]) > 0) { - $error_message .= sprintf( - __('Error creating %s modules from components'), - count($components_result[ERR_GENERIC]) - ).'
'; - } - - if (count($components_result[ERR_EXIST]) > 0) { - $error_message .= sprintf( - __('%s modules already exist'), - count($components_result[ERR_EXIST]) - ).'
'; - } - } - - if (!empty($success_message)) { - ui_print_success_message($success_message); - } - - if (!empty($error_message)) { - ui_print_error_message($error_message); - } -} - -echo ''; -echo "
"; - -$table->width = '100%'; -$table->cellpadding = 0; -$table->cellspacing = 0; -$table->class = 'databox filters'; - -$table->data[0][0] = ''.__('Target IP').''; -$table->data[0][1] = html_print_input_text( - 'ip_target', - $ip_target, - '', - 15, - 60, - true -); - -$table->data[0][2] = ''.__('Namespace').''; -$table->data[0][3] = html_print_input_text( - 'tcp_send', - $tcp_send, - '', - 15, - 60, - true -); - -$table->data[1][0] = ''.__('Username').''; -$table->data[1][1] = html_print_input_text( - 'plugin_user', - $plugin_user, - '', - 15, - 60, - true -); - -$table->data[1][2] = ''.__('Password').''; -$table->data[1][3] = html_print_input_password( - 'plugin_pass', - $plugin_pass, - '', - 15, - 60, - true -); - -$table->data[1][3] .= ''; -html_print_input_hidden('wmiexplore', 1); - -$servers_to_exec = []; -$servers_to_exec[0] = __('Local console'); -if (enterprise_installed()) { - enterprise_include_once('include/functions_satellite.php'); - - $rows = get_proxy_servers(); - foreach ($rows as $row) { - if ($row['server_type'] != 13) { - $s_type = ' (Standard)'; - } else { - $s_type = ' (Satellite)'; - } - - $servers_to_exec[$row['id_server']] = $row['name'].$s_type; - } -} - -$table->data[2][0] = ''.__('Server to execute command').''.ui_print_help_icon('agent_snmp_explorer_tab', true); -$table->data[2][1] = html_print_select( - $servers_to_exec, - 'server_to_exec', - $server_to_exec, - '', - '', - '', - true -); - -html_print_table($table); - -echo "
"; -echo ''; -html_print_submit_button( - __('WMI Explore'), - 'wmi_explore', - false, - ['class' => 'sub next'] -); -echo '

'; - -if ($wmiexplore && $fail) { - ui_print_error_message(__('Unable to do WMI explorer')); -} - -unset($table); - -echo '
'; - -if ($wmiexplore && !$fail) { - echo '
'; - echo "
"; - echo ''; - - html_print_input_hidden('create_modules', 1); - html_print_input_hidden('ip_target', $ip_target); - // Host. - html_print_input_hidden('plugin_user', $plugin_user); - // User. - html_print_input_hidden('plugin_pass', $plugin_pass); - // Password. - html_print_input_hidden('tcp_send', $tcp_send); - // Namespace. - html_print_input_hidden('server_to_exec', $server_to_exec); - - $table->width = '100%'; - - // Mode selector. - $modes = []; - $modes['services'] = __('Services'); - $modes['processes'] = __('Processes'); - $modes['disks'] = __('Free space on disk'); - $modes['components'] = __('WMI components'); - - $table->data[1][0] = __('Wizard mode').': '; - $table->data[1][0] .= html_print_select( - $modes, - 'wmi_wizard_modes', - '', - '', - '', - '', - true, - false, - false - ); - $table->cellstyle[1][0] = 'vertical-align: middle;'; - - $table->colspan[1][0] = 2; - $table->data[1][2] = ''.__('Modules').''; - $table->cellstyle[1][2] = 'text-align: center;'; - - // Components list. - $table->data[2][0] = '
'; - $table->data[2][0] .= __('Filter by group').'
'; - $table->data[2][0] .= html_print_select( - $network_component_groups, - 'network_component_group', - '', - '', - '', - '', - true, - false, - false, - '', - false, - 'width: 300px;' - ).'
'; - $table->data[2][0] .= html_print_select( - [], - 'network_component', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - - // Services list. - $table->data[2][0] .= '
'; - $table->data[2][0] .= html_print_select( - $services, - 'services', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - // Processes list. - $table->data[2][0] .= '
'; - $table->data[2][0] .= html_print_select( - $processes, - 'processes', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - $table->data[2][0] .= ''; - - // Disks list. - $table->data[2][0] .= '
'; - $table->data[2][0] .= html_print_select( - $disks, - 'disks', - '', - '', - '', - '', - true, - true, - true, - '', - false, - 'width: 300px;' - ); - $table->data[2][0] .= '
'; - $table->cellstyle[2][0] = 'vertical-align: bottom; text-align: center;'; - - - // Components arrow. - $table->data[2][1] = '
- '.html_print_image( - 'images/darrowright.png', - true, - ['title' => __('Add to modules list')] - ).'
'; - // Services arrow. - $table->data[2][1] .= '
- '.html_print_image( - 'images/darrowright.png', - true, - ['title' => __('Add to modules list')] - ).'
'; - // Processes arrow. - $table->data[2][1] .= '
- '.html_print_image( - 'images/darrowright.png', - true, - ['title' => __('Add to modules list')] - ).'
'; - // Disks arrow. - $table->data[2][1] .= '
- '.html_print_image( - 'images/darrowright.png', - true, - ['title' => __('Add to modules list')] - ).'
'; - - - $table->data[2][1] .= '

-
- '.html_print_image( - 'images/cross.png', - true, - ['title' => __('Remove from modules list')] - ).'
'; - $table->cellstyle[2][1] = 'vertical-align: middle; text-align: center;'; - - $table->data[2][2] = html_print_select( - [], - 'module[]', - 0, - false, - '', - 0, - true, - true, - true, - '', - false, - 'width:300px; height: 100%;' - ); - $table->data[2][2] .= html_print_input_hidden( - 'agent', - $id_agent, - true - ); - $table->cellstyle[2][2] = 'vertical-align: top; text-align: center;'; - - html_print_table($table); - - echo "
"; - html_print_submit_button( - __('Create modules'), - 'create_modules_btn', - false, - ['class' => 'sub add'] - ); - echo '
'; - unset($table); - - echo '
'; - echo '
'; - echo ''; -} - -ui_require_jquery_file('pandora.controls'); -ui_require_jquery_file('ajaxqueue'); -ui_require_jquery_file('bgiframe'); -ui_require_javascript_file('pandora_modules'); - -?> - \ No newline at end of file diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 0635e8e6be..1cd65a95db 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1378,8 +1378,8 @@ if ($update_module || $create_module) { $ip_target = (string) get_parameter('ip_target'); // No autofill if the module is a webserver module. if ($ip_target == '' - && $id_module_type < MODULE_WEBSERVER_CHECK_LATENCY - && $id_module_type > MODULE_WEBSERVER_RETRIEVE_STRING_DATA + && $id_module_type < MODULE_TYPE_WEB_DATA + && $id_module_type > MODULE_TYPE_WEB_CONTENT_STRING ) { $ip_target = 'auto'; } diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index ed691af533..4b1995cd5e 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -47,6 +47,39 @@ require_once $config['homedir'].'/include/functions_categories.php'; enterprise_include_once('meta/include/functions_components_meta.php'); require_once $config['homedir'].'/include/functions_component_groups.php'; +// Header. +if (defined('METACONSOLE')) { + $sec = 'advanced'; + + $id_modulo = (int) get_parameter('id_component_type'); + $new_component = (bool) get_parameter('new_component'); +} else { + $id_modulo = (int) get_parameter('id_component_type'); + $new_component = (bool) get_parameter('new_component'); + if ($id_modulo == COMPONENT_TYPE_NETWORK || $id_modulo == COMPONENT_TYPE_PLUGIN || $id_modulo == COMPONENT_TYPE_WMI || $id_modulo == COMPONENT_TYPE_WIZARD) { + $help_header = 'local_module_tab'; + } else if (!$new_component) { + $help_header = 'network_component_tab'; + } else { + $help_header = 'network_component_tab'; + } + + ui_print_page_header( + __('Remote components'), + '', + false, + $help_header, + true, + '', + false, + 'modulemodal', + GENERIC_SIZE_TEXT, + '', + __('Configuration').' / '.__('Templates').' / '.__('Remote components') + ); + $sec = 'gmodules'; +} + $type = (int) get_parameter('type'); $name = (string) get_parameter('name'); $description = (string) get_parameter('description'); @@ -180,6 +213,68 @@ if ($duplicate_network_component) { $id = 0; } +// Wizard Common. +$module_enabled = get_parameter_switch('module_enabled'); +$module_protocol = get_parameter('module_protocol', 'snmp'); +$scan_type = (int) get_parameter('scan_type', SCAN_TYPE_FIXED); +$execution_type = (int) get_parameter('execution_type', EXECUTION_TYPE_NETWORK); +// Wizard SNMP. +$manufacturer_id = get_parameter('manufacturer_id'); +$name_oid = get_parameter('name_oid'); +$value = get_parameter('value_oid'); +// Other Wizard WMI fields. +$query_filter = ''; +$wmi_class = get_parameter('wmi_class'); +$query_key_field = get_parameter('query_key_field'); +// Enabled Module. +$enabled = get_parameter_switch('enabled'); + +if ($id_modulo === COMPONENT_TYPE_WIZARD) { + // Wizard Common extra fields. + $macros = []; + + $macros['satellite_execution'] = get_parameter('satellite_execution_'.$module_protocol); + $macros['value_operation'] = get_parameter('value_operation_'.$module_protocol); + $macros['server_plugin'] = get_parameter('server_plugin_'.$module_protocol); + + if ($module_protocol === 'snmp') { + // If not select any manufacturer_id, there is 'all'. + if (empty($manufacturer_id) === true) { + $manufacturer_id = 'all'; + } + } else if ($module_protocol === 'wmi') { + // Wizard WMI Query filters. + $query_filter = []; + $query_filter['scan'] = get_parameter('query_filter_scan'); + $query_filter['execution'] = get_parameter('query_filter_execution'); + $query_filter['field'] = get_parameter('field_value_filter'); + $query_filter['key_string'] = get_parameter('key_string_filter'); + $query_filter = json_encode($query_filter); + } + + // Default extra field. + $extra_fields = [ 'extra_field_1' => '' ]; + // If Plugin execution is selected. + if ($execution_type === EXECUTION_TYPE_PLUGIN || $module_protocol === 'wmi') { + // Search all parameters received with extra_fields. + foreach ($_REQUEST as $parameter => $thisValue) { + // Extra fields (OIDs Macros or WMI Extra fields) + if (preg_match('/extra_field_'.$module_protocol.'_/', $parameter) !== 0) { + $tmpParameter = explode('_', $parameter); + $extra_fields['extra_field_'.$tmpParameter[3]] = get_parameter($parameter); + } + + // The plugin macros. + if (preg_match('/'.$module_protocol.'_field/', $parameter) !== 0) { + $macros[$parameter] = io_safe_input($thisValue); + } + } + + // All of macros saved in the same array. + $macros = json_encode(array_merge($extra_fields, $macros)); + } +} + $custom_string_1 = ''; $custom_string_2 = ''; $custom_string_3 = ''; @@ -210,7 +305,7 @@ if (defined('METACONSOLE')) { $sec = 'gmodules'; } -if ($type >= 15 && $type <= 18) { +if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) { // New support for snmp v3. $tcp_send = $snmp_version; $plugin_user = $snmp3_auth_user; @@ -219,7 +314,7 @@ if ($type >= 15 && $type <= 18) { $custom_string_1 = $snmp3_privacy_method; $custom_string_2 = $snmp3_privacy_pass; $custom_string_3 = $snmp3_security_level; -} else if ($type >= 34 && $type <= 37) { +} else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) { $tcp_send = $command_text; $custom_string_1 = $command_credential_identifier; $custom_string_2 = $command_os; @@ -275,7 +370,6 @@ if ($create_component) { 'post_process' => $post_process, 'unit' => $unit, 'wizard_level' => $wizard_level, - 'macros' => $macros, 'critical_instructions' => $critical_instructions, 'warning_instructions' => $warning_instructions, 'unknown_instructions' => $unknown_instructions, @@ -289,6 +383,17 @@ if ($create_component) { 'min_ff_event_critical' => $ff_event_critical, 'ff_type' => $ff_type, 'each_ff' => $each_ff, + 'manufacturer_id' => $manufacturer_id, + 'protocol' => $module_protocol, + 'scan_type' => $scan_type, + 'execution_type' => $execution_type, + 'value' => $value, + 'query_class' => $wmi_class, + 'query_key_field' => $query_key_field, + 'query_filters' => $query_filter, + 'name_oid' => $name_oid, + 'module_enabled' => $module_enabled, + 'enabled' => $enabled, ] ); } else { @@ -298,9 +403,17 @@ if ($create_component) { if ($id === false || !$id) { db_pandora_audit( 'Module management', - 'Fail try to create network component' + 'Fail try to create remote component' ); - ui_print_error_message(__('Could not be created')); + + if ($name_check !== false) { + // If name exists, advice about it. + ui_print_error_message(__('Could not be created because the component exists')); + } else { + // Other cases. + ui_print_error_message(__('Could not be created')); + } + include_once 'godmode/modules/manage_network_components_form.php'; return; } @@ -356,7 +469,6 @@ if ($update_component) { 'post_process' => $post_process, 'unit' => $unit, 'wizard_level' => $wizard_level, - 'macros' => $macros, 'critical_instructions' => $critical_instructions, 'warning_instructions' => $warning_instructions, 'unknown_instructions' => $unknown_instructions, @@ -370,6 +482,17 @@ if ($update_component) { 'min_ff_event_critical' => $ff_event_critical, 'ff_type' => $ff_type, 'each_ff' => $each_ff, + 'manufacturer_id' => $manufacturer_id, + 'protocol' => $module_protocol, + 'scan_type' => $scan_type, + 'execution_type' => $execution_type, + 'value' => $value, + 'query_class' => $wmi_class, + 'query_key_field' => $query_key_field, + 'query_filters' => $query_filter, + 'name_oid' => $name_oid, + 'module_enabled' => $module_enabled, + 'enabled' => $enabled, ] ); } else { @@ -559,11 +682,6 @@ foreach ($component_groups as $component_group_key => $component_group_val) { ); } } - - // Only show component groups with local components. - if ($num_components == 0 && $num_components_childs == 0) { - unset($component_groups[$component_group_key]); - } } $table->data[0][1] = html_print_select( @@ -665,14 +783,16 @@ $table->head['checkbox'] = html_print_checkbox( false ); $table->head[0] = __('Module name'); -$table->head[1] = __('Type'); +$table->head[1] = __('Server'); +$table->head[2] = __('Type'); $table->head[3] = __('Description'); $table->head[4] = __('Group'); $table->head[5] = __('Max/Min'); $table->head[6] = __('Action'); $table->size = []; $table->size['checkbox'] = '20px'; -$table->size[1] = '75px'; +$table->size[1] = '40px'; +$table->size[2] = '50px'; $table->size[6] = '80px'; $table->align[6] = 'left'; $table->data = []; @@ -698,7 +818,6 @@ foreach ($components as $component) { $data[0] = ''; $data[0] .= io_safe_output($component['name']); $data[0] .= ''; - $data[1] = ui_print_moduletype_icon($component['type'], true); switch ($component['id_modulo']) { case MODULE_NETWORK: $data[1] .= html_print_image( @@ -724,11 +843,20 @@ foreach ($components as $component) { ); break; + case MODULE_WIZARD: + $data[1] .= html_print_image( + 'images/wand.png', + true, + ['title' => __('Wizard module')] + ); + break; + default: // Not possible. break; } + $data[2] = ui_print_moduletype_icon($component['type'], true); $data[3] = "".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').''; $data[4] = network_components_get_group_name($component['id_group']); $data[5] = $component['max'].' / '.$component['min']; @@ -777,9 +905,10 @@ echo '
'; html_print_input_hidden('new_component', 1); html_print_select( [ - 2 => __('Create a new network component'), - 4 => __('Create a new plugin component'), - 6 => __('Create a new WMI component'), + COMPONENT_TYPE_NETWORK => __('Create a new network component'), + COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'), + COMPONENT_TYPE_WMI => __('Create a new WMI component'), + COMPONENT_TYPE_WIZARD => __('Create a new wizard component'), ], 'id_component_type', '', diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 53a4edbed1..2a63068b8d 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -110,56 +110,69 @@ if ($create_network_from_module) { if (isset($id)) { $component = network_components_get_network_component((int) $id); if ($component !== false) { - $id_component_type = $component['id_modulo']; - $name = $component['name']; - $type = $component['type']; - $description = $component['description']; - $max = $component['max']; - $min = $component['min']; - $module_interval = $component['module_interval']; - $tcp_port = $component['tcp_port']; - $tcp_rcv = $component['tcp_rcv']; - $tcp_send = $component['tcp_send']; - $snmp_community = $component['snmp_community']; - $snmp_oid = $component['snmp_oid']; - $id_module_group = $component['id_module_group']; - $id_group = $component['id_group']; - $id_plugin = $component['id_plugin']; - $plugin_user = $component['plugin_user']; - $plugin_pass = io_output_password($component['plugin_pass']); - $plugin_parameter = $component['plugin_parameter']; - $macros = $component['macros']; - $max_timeout = $component['max_timeout']; - $max_retries = $component['max_retries']; - $dynamic_interval = $component['dynamic_interval']; - $dynamic_max = $component['dynamic_max']; - $dynamic_min = $component['dynamic_min']; - $dynamic_two_tailed = $component['dynamic_two_tailed']; - $min_warning = $component['min_warning']; - $max_warning = $component['max_warning']; - $str_warning = $component['str_warning']; - $max_critical = $component['max_critical']; - $min_critical = $component['min_critical']; - $str_critical = $component['str_critical']; - $ff_event = $component['min_ff_event']; - $history_data = $component['history_data']; - $post_process = $component['post_process']; - $unit = $component['unit']; - $wizard_level = $component['wizard_level']; - $critical_instructions = $component['critical_instructions']; - $warning_instructions = $component['warning_instructions']; - $unknown_instructions = $component['unknown_instructions']; - $critical_inverse = $component['critical_inverse']; - $warning_inverse = $component['warning_inverse']; - $id_category = $component['id_category']; - $tags = $component['tags']; - $ff_event_normal = $component['min_ff_event_normal']; - $ff_event_warning = $component['min_ff_event_warning']; - $ff_event_critical = $component['min_ff_event_critical']; - $ff_type = $component['ff_type']; - $each_ff = $component['each_ff']; + $id_component_type = $component['id_modulo']; + $name = $component['name']; + $type = $component['type']; + $description = $component['description']; + $max = $component['max']; + $min = $component['min']; + $module_interval = $component['module_interval']; + $tcp_port = $component['tcp_port']; + $tcp_rcv = $component['tcp_rcv']; + $tcp_send = $component['tcp_send']; + $snmp_community = $component['snmp_community']; + $snmp_oid = $component['snmp_oid']; + $id_module_group = $component['id_module_group']; + $id_group = $component['id_group']; + $id_plugin = $component['id_plugin']; + $plugin_user = $component['plugin_user']; + $plugin_pass = io_output_password($component['plugin_pass']); + $plugin_parameter = $component['plugin_parameter']; + $macros = $component['macros']; + $max_timeout = $component['max_timeout']; + $max_retries = $component['max_retries']; + $dynamic_interval = $component['dynamic_interval']; + $dynamic_max = $component['dynamic_max']; + $dynamic_min = $component['dynamic_min']; + $dynamic_two_tailed = $component['dynamic_two_tailed']; + $min_warning = $component['min_warning']; + $max_warning = $component['max_warning']; + $str_warning = $component['str_warning']; + $max_critical = $component['max_critical']; + $min_critical = $component['min_critical']; + $str_critical = $component['str_critical']; + $ff_event = $component['min_ff_event']; + $history_data = $component['history_data']; + $post_process = $component['post_process']; + $unit = $component['unit']; + $wizard_level = $component['wizard_level']; + $critical_instructions = $component['critical_instructions']; + $warning_instructions = $component['warning_instructions']; + $unknown_instructions = $component['unknown_instructions']; + $critical_inverse = $component['critical_inverse']; + $warning_inverse = $component['warning_inverse']; + $id_category = $component['id_category']; + $tags = $component['tags']; + $ff_event_normal = $component['min_ff_event_normal']; + $ff_event_warning = $component['min_ff_event_warning']; + $ff_event_critical = $component['min_ff_event_critical']; + $ff_type = $component['ff_type']; + $each_ff = $component['each_ff']; + $manufacturer_id = $component['manufacturer_id']; + $module_protocol = $component['protocol']; + $scan_type = $component['scan_type']; + $execution_type = $component['execution_type']; + $value = $component['value']; + $wmi_class = $component['query_class']; + $query_key_field = $component['query_key_field']; + $query_Key_wmi = $component['key_string']; + $name_oid = $component['name_oid']; + $value_oid = $component['value_oid']; + $query_filter = $component['query_filters']; + $module_enabled = $component['module_enabled']; + $enabled = $component['enabled']; - if ($type >= 15 && $type <= 18) { + if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) { // New support for snmp v3. $snmp_version = $component['tcp_send']; $snmp3_auth_user = $component['plugin_user']; @@ -170,7 +183,7 @@ if (isset($id)) { $component['custom_string_2'] ); $snmp3_security_level = $component['custom_string_3']; - } else if ($type >= 34 && $type <= 37) { + } else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) { $command_text = $component['tcp_send']; $command_credential_identifier = $component['custom_string_1']; $command_os = $component['custom_string_2']; @@ -192,7 +205,7 @@ if (isset($id)) { $tcp_send = ''; $snmp_community = ''; $id_module_group = ''; - if ($id_component_type == 6) { + if ($id_component_type == COMPONENT_TYPE_WMI) { $id_group = 14; } else { $id_group = ''; @@ -238,28 +251,67 @@ if (isset($id)) { $command_text = ''; $command_os = 'inherited'; $command_credential_identifier = ''; + + $macros = ''; + $manufacturer_id = ''; + $module_protocol = 'snmp'; + $scan_type = SCAN_TYPE_FIXED; + $execution_type = EXECUTION_TYPE_NETWORK; + $value = ''; + $wmi_class = ''; + $query_key_field = ''; + $query_Key_wmi = ''; + $name_oid = ''; + $value_oid = ''; + $query_filter = ''; + $module_enabled = true; + $enabled = true; } } $table = new stdClass(); -if ($id_component_type == 6) { + +/** + * Common function for adding rows to main table + * + * @param array $row Array with the data for add. + * @param mixed $id If added, the DOM id for this block. + * + * @return void + */ +function push_table_row($row, $id=false) +{ + global $table; + + if ($id) { + $data = [$id => $row]; + } else { + $data = [$row]; + } + + $table->data = array_merge($table->data, $data); +} + + +$remote_components_path = $config['homedir'].'/godmode/modules/'; +if ($id_component_type == COMPONENT_TYPE_WMI) { $categories = [ 0, 1, 2, ]; - include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php'; - include $config['homedir'].'/godmode/modules/manage_network_components_form_wmi.php'; -} else if ($id_component_type == 4) { + include $remote_components_path.'manage_network_components_form_common.php'; + include $remote_components_path.'manage_network_components_form_wmi.php'; +} else if ($id_component_type == COMPONENT_TYPE_PLUGIN) { $categories = [ 0, 1, 2, ]; - include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php'; - include $config['homedir'].'/godmode/modules/manage_network_components_form_plugin.php'; -} else if ($id_component_type == 2 || $create_network_from_module) { + include $remote_components_path.'manage_network_components_form_common.php'; + include $remote_components_path.'manage_network_components_form_plugin.php'; +} else if ($id_component_type == COMPONENT_TYPE_WIZARD) { $categories = [ 3, 4, @@ -269,8 +321,19 @@ if ($id_component_type == 6) { $categories[] = 10; } - include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php'; - include $config['homedir'].'/godmode/modules/manage_network_components_form_network.php'; + include $remote_components_path.'manage_network_components_form_wizard.php'; +} else if ($id_component_type == COMPONENT_TYPE_NETWORK || $create_network_from_module) { + $categories = [ + 3, + 4, + 5, + ]; + if (enterprise_installed()) { + $categories[] = 10; + } + + include $remote_components_path.'manage_network_components_form_common.php'; + include $remote_components_path.'manage_network_components_form_network.php'; } else { return; } @@ -291,15 +354,10 @@ if (defined('METACONSOLE')) { $table->headstyle[0] = 'text-align: center'; } -$table->colspan['description'][1] = 3; -$data = []; -$data[0] = __('Description'); -$data[1] = html_print_textarea('description', 2, 65, $description, '', true); -push_table_row($data, 'description'); - html_print_table($table); echo '
'; +html_print_button(__('Go back'), 'go_back', false, 'history.go(-1);', 'class="sub cancel"'); html_print_input_hidden('id_component_type', $id_component_type); if ($id) { html_print_input_hidden('update_component', 1); diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index 7efe7f21ba..35c5648db2 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -23,23 +23,6 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], return; } -include_javascript_d3(); - - -function push_table_row($row, $id=false) -{ - global $table; - - if ($id) { - $data = [$id => $row]; - } else { - $data = [$row]; - } - - $table->data = array_merge($table->data, $data); -} - - $table->id = 'network_component'; $table->width = '100%'; $table->class = 'databox'; @@ -323,7 +306,11 @@ $table->data[12][0] = __('Unknown instructions').ui_print_help_tip(__('Instructi $table->data[12][1] = html_print_textarea('unknown_instructions', 2, 65, $unknown_instructions, '', true); $table->colspan[12][1] = 3; -$next_row = 13; +$table->data[13][0] = __('Description'); +$table->data[13][1] = html_print_textarea('description', 2, 65, $description, '', true); +$table->colspan[13][1] = 3; + +$next_row = 14; if (check_acl($config['id_user'], 0, 'PM')) { $table->data[$next_row][0] = __('Category'); diff --git a/pandora_console/godmode/modules/manage_network_components_form_network.php b/pandora_console/godmode/modules/manage_network_components_form_network.php index 979b6d74b4..a266c2b363 100755 --- a/pandora_console/godmode/modules/manage_network_components_form_network.php +++ b/pandora_console/godmode/modules/manage_network_components_form_network.php @@ -187,8 +187,21 @@ $data[1] = html_print_extended_select_for_post_process( false, true ); -$data[2] = ''; -$data[3] = ''; + +$data[2] = __('Name OID').' '.ui_print_help_icon('xxx', true); +$data[3] = html_print_input_text_extended( + 'name_oid', + $name_oid, + 'name_oid', + '', + 30, + 10000, + '', + '', + '', + true +); + push_table_row($data, 'field_process'); // Advanced stuff. diff --git a/pandora_console/godmode/modules/manage_network_components_form_wizard.php b/pandora_console/godmode/modules/manage_network_components_form_wizard.php new file mode 100644 index 0000000000..c428e206f4 --- /dev/null +++ b/pandora_console/godmode/modules/manage_network_components_form_wizard.php @@ -0,0 +1,839 @@ + $field) { + // Avoid the not extra fields. + if (preg_match('/extra_field_/', $k) === 0) { + continue; + } else { + $cntFields++; + } + + // Get the number of extra field. + $tmpExtraField = explode('_', $k); + $idField = $tmpExtraField[2]; + + if ($protocol === 'snmp') { + $extraFieldText = '_oid_'.$idField.'_'; + $rowId = 'pluginRow-'.$protocol.'Row'; + } else if ($protocol === 'wmi') { + $extraFieldText = '_field_wmi_'.$idField.'_'; + $rowId = $protocol.'Row'; + } + + $data = []; + $data[0] = '
'.$extraFieldText.'
'; + $data[1] = html_print_input_text_extended( + 'extra_field_'.$protocol.'_'.$idField, + $field, + 'extra_field_'.$protocol.'_'.$idField, + '', + 100, + 10000, + '', + '', + '', + true + ); + + $table->colspan['oid-list-'.$rowId.'-row-'.$idField][1] = 3; + push_table_row($data, 'oid-list-'.$rowId.'-row-'.$idField); + } + + $data = []; + $image_add = html_print_div( + [ + 'id' => 'add_field_button', + 'class' => 'float-right clickable', + 'content' => html_print_image( + 'images/add.png', + true, + [ + 'title' => __('Add a macro oid'), + 'onclick' => 'manageComponentFields(\'add\', \'oid-list-'.$rowId.'\');', + ] + ), + ], + true + ); + + $image_del = html_print_div( + [ + 'id' => 'del_field_button', + 'class' => 'float-right', + 'style' => $cntFields <= 1 ? 'opacity: 0.5;' : '', + 'content' => html_print_image( + 'images/cross.png', + true, + [ + 'title' => __('Remove last macro oid'), + 'onclick' => 'manageComponentFields(\'del\', \'oid-list-'.$rowId.'\');', + 'style' => 'margin-left: 1em;', + ] + ), + ], + true + ); + + $data[0] = html_print_div( + [ + 'id' => 'combo_oid_button', + 'content' => $image_del.$image_add, + ], + true + ); + + push_table_row($data, 'manage-oid-list-'.$rowId); +} + + +// Get the data. +$module_type_list = [ + MODULE_TYPE_NUMERIC => __('Numeric'), + MODULE_TYPE_INCREMENTAL => __('Incremental'), + MODULE_TYPE_BOOLEAN => __('Boolean'), + MODULE_TYPE_ALPHANUMERIC => __('Alphanumeric'), +]; + +$module_protocol_list = [ + 'snmp' => 'SNMP', + 'wmi' => 'WMI', +]; + +$scan_type_list = [ + SCAN_TYPE_FIXED => 'Fixed', + SCAN_TYPE_DYNAMIC => 'Dynamic', +]; + +$execution_type_list = [ + EXECUTION_TYPE_NETWORK => 'Network', + EXECUTION_TYPE_PLUGIN => 'Plugin', +]; +// Establish module type value. +switch ($type) { + case MODULE_TYPE_REMOTE_SNMP: + case MODULE_TYPE_GENERIC_DATA: + $module_type = MODULE_TYPE_NUMERIC; + break; + + case MODULE_TYPE_REMOTE_SNMP_INC: + case MODULE_TYPE_GENERIC_DATA_INC: + $module_type = MODULE_TYPE_INCREMENTAL; + break; + + case MODULE_TYPE_REMOTE_SNMP_STRING: + case MODULE_TYPE_GENERIC_DATA_STRING: + $module_type = MODULE_TYPE_ALPHANUMERIC; + break; + + case MODULE_TYPE_REMOTE_SNMP_PROC: + case MODULE_TYPE_GENERIC_PROC: + $module_type = MODULE_TYPE_BOOLEAN; + break; + + default: + $module_type = MODULE_TYPE_NUMERIC; + break; +} + +if (empty($query_filter) === false) { + $query_filter = json_decode($query_filter, true); +} + +$component_group_list = network_components_get_groups(); + +// List of server plugins related with Wizard SNMP. +$server_plugin_data = []; +$server_plugin_list = []; +$plugins = db_get_all_rows_sql( + 'SELECT id, description, execute, name, macros, parameters FROM tplugin' +); +foreach ($plugins as $plugin) { + $server_plugin_list[$plugin['id']] = $plugin['name']; + $server_plugin_data[$plugin['id']] = [ + 'description' => $plugin['description'], + 'name' => $plugin['name'], + 'parameters' => $plugin['parameters'], + 'macros' => array_reverse(json_decode($plugin['macros'], true)), + 'execute' => $plugin['execute'], + 'macrosElement' => base64_encode(json_encode(io_safe_output(json_decode($macros, true)))), + ]; +} + +// Store the plugin data for JS managing in JSON format. +$hiddenPluginServers = ''; +foreach ($server_plugin_data as $index => $plugin) { + // Description can have special chars that would crash Javascript. + $plugin['description'] = mb_strimwidth(io_safe_output($plugin['description']), 0, 80, '...'); + $hiddenPluginServers .= html_print_input_hidden( + 'server_plugin_data_'.$index, + json_encode(io_safe_input($plugin)) + ); +} + +// Generate needed OID macros. +$extra_fields_names = []; +foreach ($extra_fields as $k => $field) { + $extra_fields_names[$k] = $module_protocol === 'snmp' ? '_oid_'.$k.'_' : $k; +} + +// Convert the string DB format of macros to JSON. +$macros = json_decode($macros); +// Only for extra field generate purposes. +if (empty($macros) === true) { + $macros = ['extra_field_1' => '']; +} + +// +// Construction of form. +// +$table->id = 'network_component'; +$table->width = '100%'; +$table->class = 'databox'; +$table->style = []; +$table->style[0] = 'font-weight: bold'; +$table->style[2] = 'font-weight: bold'; +$table->colspan = []; +if (!enterprise_installed()) { + $table->colspan[0][1] = 3; +} + +$table->data = []; + +$data = []; +$data[0] = __('Enabled'); +$data[1] = html_print_checkbox_switch( + 'enabled', + 1, + $enabled, + true, + false, + '', + false +); + +$data[2] = __('Add by default'); +$data[3] = html_print_checkbox_switch( + 'module_enabled', + 1, + $module_enabled, + true, + false, + '', + false +); + +push_table_row($data, 'module-enable-row'); + +$data = []; +$data[0] = __('Module name'); +$data[1] = html_print_input_text_extended( + 'name', + $name, + 'name', + '', + 50, + 255, + '', + '', + '', + true +); + +$data[2] = __('Module protocol'); +$data[3] = html_print_select( + $module_protocol_list, + 'module_protocol', + $module_protocol, + 'manageVisibleFields()', + '', + '', + true, + false, + false, + '' +).' '.html_print_image( + 'images/'.$module_protocol.'.png', + true, + [ + 'title' => strtoupper($module_protocol).' '.__('Protocol'), + 'class' => 'add_comments_button', + 'style' => 'width: 18px;', + 'id' => 'module_protocol_symbol', + ] +); +$type = 4; +$data[4] = html_print_input_hidden('type', $type, true); + +push_table_row($data, 'module-name-type-row'); + +$data = []; + +$data[0] = __('Name OID'); +$data[1] = html_print_input_text('name_oid', $name_oid, '', 50, 255, true); + +$data[2] = __('Manufacturer ID'); +$data[3] = html_print_select_from_sql( + 'SELECT manufacturer as `id`, manufacturer FROM tpen GROUP BY manufacturer', + 'manufacturer_id', + $manufacturer_id, + '', + 'All', + '', + true, + false, + false, + '' +); + +push_table_row($data, 'manufacturer-nameOID-snmpRow-row'); + +$data = []; + +$data[0] = __('Module type'); +$data[1] = html_print_select( + $module_type_list, + 'module_type', + $module_type, + 'changeModuleType()', + '', + '', + true, + false, + false, + '' +); + +$data[2] = __('Component Group'); +$data[3] = html_print_select( + $component_group_list, + 'id_group', + $id_group, + '', + '', + '', + true, + false, + false, + '' +); + +push_table_row($data, 'moduleType-blockName-row'); + +$data = []; + +$data[0] = __('Module unit'); +$data[1] = html_print_extended_select_for_unit( + 'unit', + $unit, + '', + '', + '0', + false, + true, + false, + false +); + +push_table_row($data, 'moduleUnit-blockName-row'); + +$data = []; +$data[0] = __('Warning'); +// Warning interval values. +$data[1] = ''; +$data[1] .= ''.__('Min.').' '; +$data[1] .= html_print_input_text('min_warning', $min_warning, '', 5, 15, true); +$data[1] .= '
'.__('Max.').' '; +$data[1] .= html_print_input_text('max_warning', $max_warning, '', 5, 15, true); +$data[1] .= '
'; +// Warning string values. +$data[1] .= ''.__('String').'  '; +$data[1] .= html_print_input_text('str_warning', $str_warning, '', 5, 1024, true).''; +// Warning inverse values. +$data[1] .= '
'.__('Inverse interval').' '; +$data[1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true); + +$data[2] = ' '; +$table->colspan['warning-svg-row'][2] = 2; +$table->rowspan['warning-svg-row'][2] = 3; + +push_table_row($data, 'warning-svg-row'); + +$data = []; +$data[0] = __('Critical'); +// Critical interval values. +$data[1] = ''; +$data[1] .= ''.__('Min.').' '; +$data[1] .= html_print_input_text( + 'min_critical', + $min_critical, + '', + 5, + 15, + true +); +$data[1] .= '
'.__('Max.').' '; +$data[1] .= html_print_input_text( + 'max_critical', + $max_critical, + '', + 5, + 15, + true +); +$data[1] .= '
'; +// Critical string values. +$data[1] .= ''.__('String').'  '; +$data[1] .= html_print_input_text('str_critical', $str_critical, '', 5, 1024, true).''; +// Critical inverse values. +$data[1] .= '
'.__('Inverse interval').' '; +$data[1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true); + +push_table_row($data, 'critical-row'); + +$data = []; +$data[0] = __('Description'); +$data[1] = html_print_textarea('description', 2, 65, $description, '', true); +$table->colspan['module-description-row'][1] = 3; + +push_table_row($data, 'module-description-row'); + +$data = []; +$data[0] = __('Scan Type'); +$data[1] = html_print_select( + $scan_type_list, + 'scan_type', + $scan_type, + '', + '', + '', + true, + false, + false, + '' +); + +$data[2] = __('Execution type'); +$data[3] = html_print_select( + $execution_type_list, + 'execution_type', + $execution_type, + 'manageVisibleFields()', + '', + '', + true, + false, + false, + '' +); + +push_table_row($data, 'scan-execution-row'); + +// +// SNMP rows. +// +$data = []; +$data[0] = __('Value OID'); +$data[1] = html_print_input_text_extended( + 'value_oid', + (string) $value, + 'value_oid', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['value-oid-networkRow-snmpRow'][1] = 3; +push_table_row($data, 'value-oid-networkRow-snmpRow'); + +$data = []; +$data[0] = __('Macros OID'); + +push_table_row($data, 'title-oid-macros-pluginRow-snmpRow'); + +// Generation of extra fields needed. +generateExtraFields($macros, 'snmp'); + +$data = []; +$data[0] = __('Value operation'); +$data[1] = html_print_input_text_extended( + 'value_operation_snmp', + $macros->value_operation, + 'value_operation_snmp', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['value-operation-pluginRow-snmpRow'][1] = 3; +push_table_row($data, 'value-operation-pluginRow-snmpRow'); + +$data = []; +$data[0] = __('Satellite execution'); +$data[1] = html_print_input_text_extended( + 'satellite_execution_snmp', + $macros->satellite_execution, + 'satellite_execution_snmp', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['satellite-execution-pluginRow-snmpRow'][1] = 3; +push_table_row($data, 'satellite-execution-pluginRow-snmpRow'); + +$data = []; +$data[0] = __('Server plugin'); +$data[1] = html_print_select( + $server_plugin_list, + 'server_plugin_snmp', + $macros->server_plugin, + 'changePlugin()', + '', + '', + true, + false, + false, + '' +).'   '; + +push_table_row($data, 'server-plugin-pluginRow-snmpRow'); + +// The creation of this fields will be dynamically. +$data = []; +$data[0] = 'field0'; +$data[1] = html_print_input_text_extended( + 'field0_snmp_field', + '', + 'field0_snmp_fields', + '', + 30, + 255, + '', + '', + '', + true +); + +push_table_row($data, 'plugin-snmp-fields-dynamicMacroRow-pluginRow-snmpRow-0'); + +// +// WMI Fields. +// +$data = []; +$data[0] = __('WMI class'); +$data[1] = html_print_input_text_extended( + 'wmi_class', + $wmi_class, + 'wmi_class', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['wmi-class-wmiRow'][1] = 3; +push_table_row($data, 'wmi-class-wmiRow'); + +$data = []; +$data[0] = __('Query key field').' (_field_wmi_0_)'; +$data[1] = html_print_input_text_extended( + 'query_key_field', + $query_key_field, + 'query_key_field', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['query-key-field-wmiRow'][1] = 3; +push_table_row($data, 'query-key-field-wmiRow'); + +$data = []; +$data[0] = __('Query extra fields'); + +push_table_row($data, 'title-extra-field-wmiRow'); + +// Generation of extra fields needed. +generateExtraFields($macros, 'wmi'); + +$data = []; +$data[0] = __('Query filters'); +$table->style[0] = 'font-weight: bold;'; + +push_table_row($data, 'title-query-filters-wmiRow'); + +$data = []; +$data[0] = '
'.__('Scan').'
'; +$data[1] = html_print_input_text_extended( + 'query_filter_scan', + $query_filter['scan'], + 'query_filter_scan', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['query-filter-scan-wmiRow'][1] = 3; +push_table_row($data, 'query-filter-scan-wmiRow'); + +if ($execution_type == EXECUTION_TYPE_NETWORK) { + $data = []; + $data[0] = '
'.__('Execution').'
'; + $data[1] = html_print_input_text_extended( + 'query_filter_execution', + $query_filter['execution'], + 'query_filter_execution', + '', + 100, + 10000, + '', + '', + '', + true + ); + $table->colspan['query-filter-execution-wmiRow'][1] = 3; + push_table_row($data, 'query-filter-execution-wmiRow'); +} + + +$data = []; +$data[0] = __('Field value'); +$data[1] = html_print_input_number( + [ + 'name' => 'field_value_filter', + 'value' => $query_filter['field'], + 'id' => 'field_value_filter', + 'min' => 0, + 'return' => true, + ] +); + +$data[2] = __('Key string'); +$data[3] = html_print_input_text_extended( + 'key_string_filter', + $query_filter['key_string'], + 'key_string_filter', + '', + 30, + 255, + '', + '', + '', + true +); + +push_table_row($data, 'filters-list-fields-networkRow-wmiRow'); + +$data = []; +$data[0] = __('Value operation'); +$data[1] = html_print_input_text_extended( + 'value_operation_wmi', + $macros->value_operation, + 'value_operation_wmi', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['value-operation-pluginRow-wmiRow'][1] = 3; +push_table_row($data, 'value-operation-pluginRow-wmiRow'); + +$data = []; +$data[0] = __('Satellite execution'); +$data[1] = html_print_input_text_extended( + 'satellite_execution_wmi', + $macros->satellite_execution, + 'satellite_execution_wmi', + '', + 100, + 10000, + '', + '', + '', + true +); +$table->colspan['satellite-execution-pluginRow-wmiRow'][1] = 3; +push_table_row($data, 'satellite-execution-pluginRow-wmiRow'); + +$data = []; +$data[0] = __('Server plugin'); +$data[1] = html_print_select( + $server_plugin_list, + 'server_plugin_wmi', + $macros->server_plugin, + 'changePlugin()', + '', + '', + true, + false, + false, + '' +).'   '; + +push_table_row($data, 'server-plugin-pluginRow-wmiRow'); + +// The creation of this fields will be dynamically. +$data = []; +$data[0] = 'field0'; +$data[1] = html_print_input_text_extended( + 'field0_wmi_field', + '', + 'field0_wmi_fields', + '', + 30, + 255, + '', + '', + '', + true +); + +push_table_row($data, 'plugin-wmi-fields-dynamicMacroRow-pluginRow-wmiRow-0'); + +?> + + \ No newline at end of file diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 416004a539..2bfd736fe3 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -484,6 +484,16 @@ switch ($action) { $period = $item['period']; break; + case 'last_value': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); + break; + case 'alert_report_module': $description = $item['description']; $idAgentModule = $item['id_agent_module']; @@ -744,6 +754,7 @@ switch ($action) { case 'historical_data': case 'sumatory': case 'database_serialized': + case 'last_value': case 'monitor_report': case 'min_value': case 'max_value': @@ -3843,6 +3854,7 @@ $(document).ready (function () { case 'min_value': case 'monitor_report': case 'database_serialized': + case 'last_value': case 'sumatory': case 'historical_data': case 'agent_configuration': @@ -3884,6 +3896,7 @@ $(document).ready (function () { case 'max_value': case 'min_value': case 'database_serialized': + case 'last_value': case 'sumatory': case 'historical_data': case 'increment': @@ -3964,6 +3977,7 @@ $(document).ready (function () { case 'min_value': case 'monitor_report': case 'database_serialized': + case 'last_value': case 'sumatory': case 'historical_data': case 'agent_configuration': @@ -4003,6 +4017,7 @@ $(document).ready (function () { case 'max_value': case 'min_value': case 'database_serialized': + case 'last_value': case 'sumatory': case 'historical_data': case 'increment': @@ -5142,6 +5157,12 @@ function chooseType() { $("#row_historical_db_check").hide(); break; + case 'last_value': + $("#row_description").show(); + $("#row_agent").show(); + $("#row_module").show(); + break; + case 'alert_report_module': $("#row_description").show(); $("#row_agent").show(); diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index 07365edc6c..ebd368a82a 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -83,9 +83,9 @@ foreach ($osList as $os) { } if (isset($data)) { - ui_pagination($count_osList, false, $offset); + ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset); html_print_table($table); - ui_pagination($count_osList, false, $offset, 0, false, 'offset', true, 'pagination-bottom'); + ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset, 0, false, 'offset', true, 'pagination-bottom'); } else { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]); } diff --git a/pandora_console/godmode/setup/os.php b/pandora_console/godmode/setup/os.php index aa0bd2dd13..1f8694aa32 100644 --- a/pandora_console/godmode/setup/os.php +++ b/pandora_console/godmode/setup/os.php @@ -24,6 +24,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user $action = get_parameter('action', 'new'); $idOS = get_parameter('id_os', 0); +$id_message = get_parameter('message', 0); if (is_metaconsole()) { $tab = get_parameter('tab2', 'list'); } else { @@ -50,6 +51,7 @@ switch ($action) { $textButton = __('Create'); $classButton = 'class="sub next"'; break; + case 'edit': $actionHidden = 'update'; $textButton = __('Update'); @@ -71,15 +73,22 @@ switch ($action) { } if ($resultOrId === false) { - $message = ui_print_error_message(__('Fail creating OS'), '', true); + $message = 2; $tab = 'builder'; $actionHidden = 'save'; $textButton = __('Create'); $classButton = 'class="sub next"'; } else { - $message = ui_print_success_message(__('Success creating OS'), '', true); $tab = 'list'; + $message = 1; } + + if (is_metaconsole()) { + header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message); + } else { + header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message); + } + break; case 'update': @@ -100,10 +109,11 @@ switch ($action) { $result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]); } - $message = ui_print_result_message($result, __('Success updatng OS'), __('Error updating OS'), '', true); if ($result !== false) { + $message = 3; $tab = 'list'; } else { + $message = 4; $tab = 'builder'; $os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]); $name = $os['name']; @@ -112,6 +122,11 @@ switch ($action) { $actionHidden = 'update'; $textButton = __('Update'); $classButton = 'class="sub upd"'; + if (is_metaconsole()) { + header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message); + } else { + header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message); + } break; case 'delete': @@ -120,11 +135,20 @@ switch ($action) { $count = $count[0]['count']; if ($count > 0) { - $message = ui_print_error_message(__('There are agents with this OS.'), '', true); + $message = 5; } else { $result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]); + if ($result) { + $message = 6; + } else { + $message = 7; + } + } - $message = ui_print_result_message($result, __('Success deleting'), __('Error deleting'), '', true); + if (is_metaconsole()) { + header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message); + } else { + header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message); } break; } @@ -143,11 +167,45 @@ $buttons = [ $buttons[$tab]['active'] = true; if (!is_metaconsole()) { - // Header + // Header. ui_print_page_header(__('Edit OS'), '', false, '', true, $buttons); } -echo $message; +if (!empty($id_message)) { + switch ($id_message) { + case 1: + echo ui_print_success_message(__('Success creating OS'), '', true); + break; + + case 2: + echo ui_print_error_message(__('Fail creating OS'), '', true); + break; + + case 3: + echo ui_print_success_message(__('Success updating OS'), '', true); + break; + + case 4: + echo ui_print_error_message(__('Error updating OS'), '', true); + break; + + case 5: + echo ui_print_error_message(__('There are agents with this OS.'), '', true); + break; + + case 6: + echo ui_print_success_message(__('Success deleting'), '', true); + break; + + case 7: + echo ui_print_error_message(__('Error deleting'), '', true); + break; + + default: + // Default. + break; + } +} switch ($tab) { case 'list': diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 48422c5bfe..0d8ce68e8e 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -332,15 +332,18 @@ $table->data[$i++][1] = html_print_input_text( $table->data[$i][0] = __('Include agents manually disabled'); $table->data[$i++][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true); -$table->data[$i][0] = __('Audit log directory'); -$table->data[$i++][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true); - $table->data[$i][0] = __('Set alias as name by default in agent creation'); $table->data[$i++][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true); $table->data[$i][0] = __('Unique IP'); $table->data[$i++][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); +$table->data[$i][0] = __('Enable console log').ui_print_help_tip(__('Log location').': pandora_console/log/console.log', true); +$table->data[$i++][1] = html_print_checkbox_switch('console_log_enabled', 1, $config['console_log_enabled'], true); + +$table->data[$i][0] = __('Enable audit log').ui_print_help_tip(__('Log location').': pandora_console/log/audit.log', true); +$table->data[$i++][1] = html_print_checkbox_switch('audit_log_enabled', 1, $config['audit_log_enabled'], true); + echo '
'; echo '
'; diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 0631a04903..9874d4503b 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1065,8 +1065,12 @@ $row++; } } - // Logo - $table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo'); + // Logo. + $table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( + __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), + true + ); + $table_report->data['custom_report_front-logo'][1] = html_print_select( $customLogos, 'custom_report_front_logo', @@ -1076,7 +1080,7 @@ $row++; '', true ); - // Preview + // Preview. $table_report->data['custom_report_front-preview'][0] = __('Custom report front').' - '.'Preview'; if (empty($config['custom_report_front_logo'])) { $config['custom_report_front_logo'] = 'images/pandora_logo_white.jpg'; @@ -1084,23 +1088,32 @@ $row++; $table_report->data['custom_report_front-preview'][1] = ''.html_print_image($config['custom_report_front_logo'], true).''; - // Header + // Header. $table_report->data['custom_report_front-header'][0] = __('Custom report front').' - '.__('Header'); + + // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. $table_report->data['custom_report_front-header'][1] = html_print_textarea( 'custom_report_front_header', 5, 15, - $config['custom_report_front_header'], + io_safe_output($config['custom_report_front_header']), 'style="width: 38em;"', true ); - // First page + // First page. + // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. + if ($config['custom_report_front']) { + $firstpage_content = $config['custom_report_front_firstpage']; + } else { + $firstpage_content = io_safe_output($config['custom_report_front_firstpage']); + } + $table_report->data['custom_report_front-first_page'][0] = __('Custom report front').' - '.__('First page'); $custom_report_front_firstpage = str_replace( '(_URLIMAGE_)', ui_get_full_url(false, true, false, false), - $config['custom_report_front_firstpage'] + io_safe_output($firstpage_content) ); $table_report->data['custom_report_front-first_page'][1] = html_print_textarea( 'custom_report_front_firstpage', @@ -1111,13 +1124,15 @@ $row++; true ); - // Footer + // Footer. $table_report->data['custom_report_front-footer'][0] = __('Custom report front').' - '.__('Footer'); + + // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. $table_report->data['custom_report_front-footer'][1] = html_print_textarea( 'custom_report_front_footer', 5, 15, - $config['custom_report_front_footer'], + io_safe_output($config['custom_report_front_footer']), 'style="width: 38em;"', true ); diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index ed6d72ef70..2ffae3858d 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -865,16 +865,16 @@ if (check_login()) { $table->align[8] = 'center'; $table->align[9] = 'right'; - $table->headstyle[2] = 'min-width: 85px'; - $table->headstyle[3] = 'min-width: 130px'; - $table->size[3] = '30%'; + $table->headstyle[2] = 'min-width: 65px'; + $table->headstyle[3] = 'min-width: 80px'; + $table->size[3] = '25%'; $table->style[3] = 'max-width: 28em;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'; - $table->size[4] = '30%'; - $table->headstyle[5] = 'min-width: 85px'; - $table->headstyle[6] = 'min-width: 125px; text-align: center;'; - $table->headstyle[7] = 'min-width: 125px;'; - $table->headstyle[8] = 'min-width: 100px; text-align: center;'; - $table->headstyle[9] = 'min-width: 120px; text-align: right;'; + $table->size[4] = '25%'; + $table->headstyle[5] = 'min-width: 65px'; + $table->headstyle[6] = 'min-width: 80px; text-align: center;'; + $table->headstyle[7] = 'min-width: 80px;'; + $table->headstyle[8] = 'min-width: 70px; text-align: center;'; + $table->headstyle[9] = 'min-width: 100px; text-align: right;'; $last_modulegroup = 0; $rowIndex = 0; diff --git a/pandora_console/include/ajax/snmp_browser.ajax.php b/pandora_console/include/ajax/snmp_browser.ajax.php index 5eaa01d659..eb4d8e8b54 100644 --- a/pandora_console/include/ajax/snmp_browser.ajax.php +++ b/pandora_console/include/ajax/snmp_browser.ajax.php @@ -13,6 +13,7 @@ // GNU General Public License for more details. require_once $config['homedir'].'/include/functions_config.php'; require_once $config['homedir'].'/include/functions_snmp_browser.php'; +require_once $config['homedir'].'/include/functions_snmp.php'; require_once $config['homedir'].'/include/functions_network_components.php'; @@ -112,6 +113,17 @@ if (is_ajax()) { $output .= '
'; $output .= '
'; + // Dialog no agent selected. + $output .= ''; + echo $output; } @@ -158,6 +170,11 @@ if (is_ajax()) { $id_target = explode(',', $id_items[0]); } + if (empty($id_items[0])) { + echo json_encode([0 => -1]); + exit; + } + $snmp_extradata = get_parameter('snmp_extradata', ''); if (!is_array($snmp_extradata)) { diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index f638092930..ce8f07b787 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -29,8 +29,14 @@ // Get global data. global $config; -// Necessary class for extends. +// Necessary classes for extends. require_once $config['homedir'].'/include/class/HTML.class.php'; +require_once $config['homedir'].'/include/functions_snmp_browser.php'; +require_once $config['homedir'].'/include/functions_wmi.php'; + + +use PandoraFMS\Module; + /** * AgentWizard class */ @@ -58,6 +64,13 @@ class AgentWizard extends HTML */ private $idAgent; + /** + * Id of this current policy + * + * @var integer + */ + private $idPolicy; + /** * Wizard Section for Explore * @@ -75,15 +88,176 @@ class AgentWizard extends HTML /** * Type of action to do * - * @param string + * @var string */ private $actionType; + /** + * URL with the actual section + * + * @var string + */ + private $sectionUrl; + + /** + * Message to show + * + * @var array + */ + private $message; + + /** + * Is show message. + * + * @var boolean + */ + private $showMessage; + + /** + * Target ip. + * + * @var string + */ + private $targetIp; + + /** + * Target Port. + * + * @var string + */ + private $targetPort; + + /** + * SNMP Community. + * + * @var string + */ + private $community; + + /** + * SNMP Version. + * + * @var string + */ + private $version; + + /** + * Server to execute command. + * + * @var string + */ + private $server; + + /** + * Type Server to execute command. + * + * @var integer + */ + private $serverType; + + /** + * SNMP v3 Authentication User. + * + * @var string + */ + private $authUserV3; + + /** + * SNMP v3 Authentication Password. + * + * @var string + */ + private $authPassV3; + + /** + * SNMP v3 Authentication Method. + * + * @var string + */ + private $authMethodV3; + + /** + * SNMP v3 Security Level. + * + * @var string + */ + private $securityLevelV3; + + /** + * SNMP v3 Privacy Method. + * + * @var string + */ + private $privacyMethodV3; + + /** + * SNMP v3 Privacy Pass. + * + * @var string + */ + private $privacyPassV3; + + /** + * WMI Namespace + * + * @var string + */ + private $namespaceWMI; + + /** + * WMI Username + * + * @var string + */ + private $usernameWMI; + + /** + * WMI Password + * + * @var string + */ + private $passwordWMI; + + /** + * Private Enterprise Number name + * + * @var string + */ + private $penName; + + /** + * Interfaces found + * + * @var mixed + */ + private $interfacesFound; + + /** + * Protocol + * + * @var string + */ + private $protocol; + + /** + * WMI Command + * + * @var string + */ + private $wmiCommand; + + /** + * Results for SNMP or WMI queries + * + * @var mixed + */ + private $moduleBlocks; + /** * Constructor * - * @param string $ajax_controller Pues hace cosas to wapas. + * @param string $ajax_controller Path. */ public function __construct(string $ajax_controller) { @@ -98,7 +272,7 @@ class AgentWizard extends HTML 'Trying to access event viewer' ); - if (is_ajax()) { + if (is_ajax() === true) { echo json_encode(['error' => 'noaccess']); } @@ -106,12 +280,76 @@ class AgentWizard extends HTML exit; } - // Set baseUrl for use it in several locations in this class. - $this->baseUrl = ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard'); // Capture all parameters before start. - $this->ajaxController = $ajax_controller; - $this->wizardSection = get_parameter('wizard_section', ''); - $this->idAgent = get_parameter('id_agente', ''); + $this->ajaxController = $ajax_controller; + $this->wizardSection = get_parameter('wizard_section', 'snmp_explorer'); + $this->idAgent = get_parameter('id_agente', ''); + $this->idPolicy = get_parameter('id', ''); + $this->targetIp = get_parameter('targetIp', ''); + $this->server = (int) get_parameter('server', '1'); + if ($this->server !== 0) { + $this->serverType = (int) db_get_value( + 'server_type', + 'tserver', + 'id_server', + $this->server + ); + } + + // Capture the parameters. + $this->protocol = get_parameter('protocol'); + if ($this->protocol === 'snmp') { + $this->targetPort = get_parameter('targetPort', '161'); + $this->community = get_parameter('community', 'public'); + $this->version = get_parameter('version', '1'); + + // Only for SNMPv3. Catch only if is neccesary. + if ($this->version === '3') { + $this->authUserV3 = get_parameter( + 'authUserV3', + '' + ); + $this->authPassV3 = get_parameter( + 'authPassV3', + '' + ); + $this->authMethodV3 = get_parameter( + 'authMethodV3', + '' + ); + $this->securityLevelV3 = get_parameter('securityLevelV3', ''); + $this->privacyMethodV3 = get_parameter('privacyMethodV3', ''); + $this->privacyPassV3 = get_parameter('privacyPassV3', ''); + } + } else if ($this->protocol === 'wmi') { + $this->namespaceWMI = get_parameter('namespaceWMI', ''); + $this->usernameWMI = get_parameter('usernameWMI', ''); + $this->passwordWMI = get_parameter('passwordWMI', ''); + } + + // Set baseUrl for use it in several locations in this class. + if (empty($this->idPolicy) === true) { + $this->baseUrl = ui_get_full_url( + 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&id_agente='.$this->idAgent + ); + } else { + if (is_metaconsole() === true) { + $this->baseUrl = ui_get_full_url( + 'index.php?sec=gmodules&sec2=advanced/policymanager&tab=agent_wizard&id='.$this->idPolicy + ); + } else { + $this->baseUrl = ui_get_full_url( + 'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies&tab=agent_wizard&id='.$this->idPolicy + ); + } + } + + $this->sectionUrl = $this->baseUrl.'&wizard_section='.$this->wizardSection; + + $this->message['type'] = []; + $this->message['message'] = []; + $this->showMessage = false; + return $this; } @@ -128,14 +366,121 @@ class AgentWizard extends HTML ui_require_css_file('discovery'); // Javascript. - // ui_require_javascript_file('jquery.caret.min'); + $createModules = (bool) get_parameter('create-modules-action', false); + if ($createModules === true) { + $this->processModules(); + } else { + if ($this->protocol === 'snmp') { + $this->performSNMP(); + } else if ($this->protocol === 'wmi') { + $this->performWMI(); + } + } + + // Load main form. $this->loadMainForm(); - $this->performWizard(); - // Load integrated JS + + // Generate the box that allow messages + // (and show messages if needed). + $this->showMessage(); + + if ($this->showMessage === false) { + if ($createModules === false) { + // Show results if we perform any action. + if (empty($this->protocol) === false) { + if ($this->wizardSection === 'snmp_interfaces_explorer') { + if (empty($this->interfacesFound) === false) { + $this->resultsInterfaceWizard(); + } + } else { + $this->moduleBlocks = $this->getModuleBlocks(); + if ($this->moduleBlocks === false) { + $this->message['type'][] = 'info'; + $this->message['message'][] = __( + 'There are not defined Remote components for this performance.' + ); + $this->showMessage(); + } else { + if ($this->wizardSection === 'snmp_explorer') { + $this->resultsSNMPExplorerWizard(); + } else if ($this->wizardSection === 'wmi_explorer') { + $this->resultsWMIExplorerWizard(); + } + } + } + } + } + } + + // Lodaing div. + echo '
'; + + // Modal Div. + echo ''; + echo ''; + + // Load integrated JS. $this->loadJS(); } + /** + * Generate the message if needed + * + * @return void + */ + private function showMessage() + { + if (empty($this->message['type']) === false) { + $message_error = ''; + $message_success = ''; + foreach ($this->message['type'] as $keyMsg => $typeError) { + switch ($typeError) { + case 'error': + $message_error .= ($this->message['message'][$keyMsg] ?? 'Unknown error. Please, review the logs.'); + $message_error .= '

'; + break; + + case 'success': + $message_success .= ($this->message['message'][$keyMsg] ?? 'The action has did successfull'); + $message_success .= '

'; + break; + + case 'warning': + echo ui_print_warning_message( + $this->message['message'][$keyMsg] + ); + break; + + case 'info': + echo ui_print_info_message( + $this->message['message'][$keyMsg] + ); + break; + + default: + // Nothing to do. + break; + } + } + + if (empty($message_error) === false) { + echo ui_print_error_message($message_error); + } + + if (empty($message_success) === false) { + echo ui_print_success_message($message_success); + } + + $this->showMessage = true; + } + + // Clear the message info. + $this->message['type'] = []; + $this->message['message'] = []; + } + + /** * Common Main Wizard form * @@ -143,42 +488,40 @@ class AgentWizard extends HTML */ private function loadMainForm() { - // Define name of explorer button + // Fill with servers to perform the discover. + $fieldsServers = []; + $fieldsServers[0] = __('Local console'); + if (enterprise_installed()) { + enterprise_include_once('include/functions_satellite.php'); + // Get the servers. + $rows = get_proxy_servers(); + + // Check if satellite server has remote configuration enabled. + $satellite_remote = config_agents_has_remote_configuration( + $this->idAgent + ); + + // Generate a list with allowed servers. + if (isset($rows) === true && is_array($rows) === true) { + foreach ($rows as $row) { + if ($row['server_type'] == 13) { + $id_satellite = $row['id_server']; + $serverType = ' (Satellite)'; + } else { + $serverType = ' (Standard)'; + } + + $fieldsServers[$row['id_server']] = $row['name'].$serverType; + } + } + } + + // Set the labels and types. switch ($this->wizardSection) { case 'snmp_explorer': case 'snmp_interfaces_explorer': - // Define labels. $this->actionType = 'snmp'; $this->actionLabel = __('SNMP Walk'); - // Fill with servers to perform SNMP walk. - $fieldsServers = []; - $fieldsServers[0] = __('Local console'); - if (enterprise_installed()) { - enterprise_include_once('include/functions_satellite.php'); - // Get the servers. - $rows = get_proxy_servers(); - // Check if satellite server has remote configuration enabled. - $satellite_remote = config_agents_has_remote_configuration($this->idAgent); - // Generate a list with allowed servers. - foreach ($rows as $row) { - if ($row['server_type'] == 13) { - $id_satellite = $row['id_server']; - $serverType = ' (Satellite)'; - } else { - $serverType = ' (Standard)'; - } - - $fieldsServers[$row['id_server']] = $row['name'].$serverType; - } - } - - // Fill with SNMP versions allowed. - $fieldsVersions = [ - '1' => '1', - '2' => '2', - '2c' => '2c', - '3' => '3', - ]; break; case 'wmi_explorer': @@ -187,17 +530,16 @@ class AgentWizard extends HTML break; default: - $this->actionType = 'none'; - $this->actionLabel = __('Nothing'); + // Something goes wrong. exit; - break; } // Main form. + $this->sectionUrl = $this->baseUrl.'&wizard_section='.$this->wizardSection; + $form = [ - 'action' => '', - // 'action' => $this->baseUrl, - 'id' => 'main_wizard_form', + 'action' => $this->sectionUrl, + 'id' => 'form-main-wizard', 'method' => 'POST', ]; @@ -205,9 +547,9 @@ class AgentWizard extends HTML $inputs = []; $inputs[] = [ - 'id' => 'hdn-type-action', + 'id' => 'protocol', 'arguments' => [ - 'name' => 'type-action', + 'name' => 'protocol', 'type' => 'hidden', 'value' => $this->actionType, 'return' => true, @@ -216,117 +558,139 @@ class AgentWizard extends HTML $inputs[] = [ 'label' => __('Target IP'), - 'id' => 'txt-target-ip', + 'id' => 'txt-targetIp', 'arguments' => [ - 'name' => 'target-ip', + 'name' => 'targetIp', 'input_class' => 'flex-row', 'type' => 'text', 'class' => '', - 'return' => true, - ], - ]; - - $inputs[] = [ - 'label' => __('Port'), - 'id' => 'txt-target-port', - 'arguments' => [ - 'name' => 'target-port', - 'input_class' => 'flex-row', - 'type' => 'text', - 'size' => '20', - 'class' => '', + 'value' => $this->targetIp, 'return' => true, ], ]; if ($this->actionType === 'snmp') { $inputs[] = [ - 'label' => __('Use agent IP'), - 'id' => 'txt-use-agent-ip', + 'label' => __('Port'), + 'id' => 'txt-targetPort', 'arguments' => [ - 'name' => 'use-agent-ip', + 'name' => 'targetPort', 'input_class' => 'flex-row', - 'type' => 'checkbox', + 'type' => 'text', + 'size' => '20', 'class' => '', + 'value' => $this->targetPort, 'return' => true, ], ]; + + if (empty($this->idPolicy) === true) { + $inputs[] = [ + 'label' => __('Use agent IP'), + 'id' => 'txt-use-agent-ip', + 'arguments' => [ + 'name' => 'use-agent-ip', + 'input_class' => 'flex-row', + 'type' => 'checkbox', + 'class' => '', + 'return' => true, + ], + ]; + } } if ($this->actionType === 'wmi') { $inputs[] = [ - 'label' => __('Namespace'), - 'id' => 'txt-namespace', + 'label' => __('namespace'), + 'id' => 'txt-namespaceWMI', 'arguments' => [ - 'name' => 'namespace', + 'name' => 'namespaceWMI', 'input_class' => 'flex-row', 'type' => 'text', 'class' => '', + 'value' => $this->namespaceWMI, 'return' => true, ], ]; $inputs[] = [ 'label' => __('Username'), - 'id' => 'txt-username', + 'id' => 'txt-usernameWMI', 'arguments' => [ - 'name' => 'username', + 'name' => 'usernameWMI', 'input_class' => 'flex-row', 'type' => 'text', 'class' => '', + 'value' => $this->usernameWMI, 'return' => true, ], ]; $inputs[] = [ 'label' => __('Password'), - 'id' => 'txt-password', + 'id' => 'txt-passwordWMI', 'arguments' => [ - 'name' => 'password', + 'name' => 'passwordWMI', 'input_class' => 'flex-row', - 'type' => 'text', + 'type' => 'password', 'class' => '', + 'value' => $this->passwordWMI, 'return' => true, ], ]; } + $hint_server = ' '; + $hint_server .= ui_print_help_icon('agent_snmp_explorer_tab', true); $inputs[] = [ - 'label' => __('Server to execute command'), - 'id' => 'txt-target-port', + 'label' => __('Server to execute command').$hint_server, + 'id' => 'slc-server', 'arguments' => [ - 'name' => 'target-port', + 'name' => 'server', 'input_class' => 'flex-row', 'type' => 'select', 'fields' => $fieldsServers, 'class' => '', + 'selected' => $this->server, 'return' => true, + 'sort' => false, ], ]; if ($this->actionType === 'snmp') { $inputs[] = [ 'label' => __('SNMP community'), - 'id' => 'txt-snmp-community', + 'id' => 'txt-community', 'arguments' => [ - 'name' => 'snmp-community', + 'name' => 'community', 'input_class' => 'flex-row', 'type' => 'text', 'size' => '20', 'class' => '', + 'value' => $this->community, 'return' => true, ], ]; + // Fill with SNMP versions allowed. + $fieldsVersions = [ + '1' => '1', + '2' => '2', + '2c' => '2c', + '3' => '3', + ]; + $inputs[] = [ 'label' => __('SNMP version'), - 'id' => 'txt-snmnp-version', + 'id' => 'txt-version', 'arguments' => [ - 'name' => 'snmnp-version', + 'name' => 'version', 'input_class' => 'flex-row', 'type' => 'select', 'fields' => $fieldsVersions, + 'script' => 'showV3Form();', 'class' => '', + 'selected' => $this->version, 'return' => true, ], ]; @@ -335,20 +699,22 @@ class AgentWizard extends HTML $inputs[] = [ 'arguments' => [ 'label' => $this->actionLabel, - 'name' => 'action', + 'name' => 'sub-protocol', 'type' => 'submit', - 'attributes' => 'class="sub next" onclick="performAction();return false;"', + 'attributes' => 'class="sub next" onclick="$(\'#form-main-wizard\').submit();"', 'return' => true, ], ]; + // Prints main form. html_print_div( [ 'class' => 'white_box', 'content' => $this->printForm( [ - 'form' => $form, - 'inputs' => $inputs, + 'form' => $form, + 'inputs' => $inputs, + 'rawInputs' => '
    '.$this->snmpAuthenticationForm().'
', ], true ), @@ -358,219 +724,2511 @@ class AgentWizard extends HTML /** - * Undocumented function + * This form appears when activate SNMP v3 + * + * @return mixed + */ + public function snmpAuthenticationForm() + { + // Privacy method. + $privacyMethod = [ + 'AES' => 'AES', + 'DES' => 'DES', + ]; + // Authentication method. + $authenticationMethod = [ + 'MD5' => 'MD5', + 'SHA' => 'SHA', + ]; + // Security level. + $securityLevel = [ + 'authNoPriv' => 'Authenticated and non-private method', + 'authPriv' => 'Authenticated and private method', + 'noAuthNoPriv' => 'Non-authenticated and non-private method', + ]; + // Main form. + $form = [ + 'action' => '', + 'id' => 'form-snmp-authentication', + 'method' => 'POST', + ]; + // Inputs. + $inputs = []; + + $inputs[] = [ + 'label' => __('Security level'), + 'id' => 'slc-securityLevelV3', + 'arguments' => [ + 'name' => 'securityLevelV3', + 'input_class' => 'flex-row', + 'type' => 'select', + 'fields' => $securityLevel, + 'class' => '', + 'script' => 'showSecurityLevelForm();', + 'selected' => $this->securityLevelV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'label' => __('User authentication'), + 'id' => 'txt-authUserV3', + 'arguments' => [ + 'name' => 'authUserV3', + 'input_class' => 'flex-row', + 'type' => 'text', + 'size' => '20', + 'class' => '', + 'value' => $this->authUserV3, + 'return' => true, + 'form' => 'form-main-wizard', + ], + ]; + + $inputs[] = [ + 'label' => __('Authentication method'), + 'id' => 'txt-authMethodV3', + 'arguments' => [ + 'name' => 'authMethodV3', + 'input_class' => 'flex-row', + 'type' => 'select', + 'fields' => $authenticationMethod, + 'class' => '', + 'selected' => $this->authMethodV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'label' => __('Password authentication'), + 'id' => 'txt-authPassV3', + 'arguments' => [ + 'name' => 'authPassV3', + 'input_class' => 'flex-row', + 'type' => 'password', + 'size' => '20', + 'class' => '', + 'value' => $this->authPassV3, + 'return' => true, + 'form' => 'form-main-wizard', + ], + ]; + + $inputs[] = [ + 'label' => __('Privacy method'), + 'id' => 'txt-privacyMethodV3', + 'arguments' => [ + 'name' => 'privacyMethodV3', + 'input_class' => 'flex-row', + 'type' => 'select', + 'fields' => $privacyMethod, + 'class' => '', + 'selected' => $this->privacyMethodV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'label' => __('Privacy pass'), + 'id' => 'txt-privacyPassV3', + 'arguments' => [ + 'name' => 'privacyPassV3', + 'type' => 'password', + 'size' => '20', + 'class' => '', + 'value' => $this->privacyPassV3, + 'return' => true, + 'form' => 'form-main-wizard', + ], + ]; + + // Output the form. + return html_print_div( + [ + 'id' => 'form-snmp-authentication-box', + 'class' => 'invisible', + 'style' => 'margin-top: 10px;', + 'content' => $this->printForm( + [ + 'form' => $form, + 'inputs' => $inputs, + ], + true + ), + ], + true + ); + + } + + + /** + * Perform a Interfaces SNMP Walk + * + * @param array $receivedOid Array with the raw oid info. * * @return void */ - public function performWizard() + public function performSNMPInterfaces($receivedOid) { - // echo json_encode(['error' => obhd($_REQUEST)]); - // exit; - $sql = sprintf( - 'SELECT npc.id_nc AS component_id, nc.name, nc.type, nc.description, nc.id_group AS `group`, ncg.name AS `group_name` - FROM tnetwork_profile_component AS npc, tnetwork_component AS nc - INNER JOIN tnetwork_component_group AS ncg ON ncg.id_sg = nc.id_group - WHERE npc.id_nc = nc.id_nc AND npc.id_np = %d', - 10 - ); - $moduleBlocks = db_get_all_rows_sql($sql); + // Create a list with the interfaces. + $interfaces = []; + foreach ($receivedOid as $keyOid => $nameOid) { + list($nameKey, $indexKey) = explode( + '.', + str_replace('IF-MIB::', '', $keyOid) + ); + list($typeValue, $value) = explode(': ', $nameOid); + // Set the name of interface. + $interfaces[$indexKey]['name'] = $value; + // Get the description. + $interfaces[$indexKey]['descr'] = $this->snmpgetValue( + '.1.3.6.1.2.1.2.2.1.2.'.$indexKey + ); + // Get the MAC address. + $interfaces[$indexKey]['mac'] = $this->snmpgetValue( + '.1.3.6.1.2.1.2.2.1.6.'.$indexKey + ); + // Get unicast IP address. + $interfaces[$indexKey]['ip'] = ''; + // Path for get the IPs (ipv4). + $snmpIpDiscover = '.1.3.6.1.2.1.4.34.1.4.1.4'; + $ipsResult = []; + // In this case we need the full information provided by snmpwalk. + $snmpwalkIps = sprintf( + 'snmpwalk -On -v%s -c %s %s %s', + $this->version, + $this->community, + $this->targetIp, + $snmpIpDiscover + ); + exec($snmpwalkIps, $ipsResult); + foreach ($ipsResult as $ipResult) { + list($ipOidDirection, $ipOidValue) = explode(' = ', $ipResult); + // Only catch the unicast records. + if ((preg_match('/unicast/', $ipOidValue) === 1)) { + $tmpIpOidDirection = str_replace( + $snmpIpDiscover, + '', + $ipOidDirection + ); + $snmpIpIndexDiscover = '.1.3.6.1.2.1.4.34.1.3.1.4'; + $snmpIpIndexDiscover .= $tmpIpOidDirection; + $snmpgetIpIndex = $this->snmpgetValue($snmpIpIndexDiscover); + // If this Ip index number match with the current index key. + if ($snmpgetIpIndex === $indexKey) { + $interfaces[$indexKey]['ip'] .= substr( + $tmpIpOidDirection, + 1 + ); + } + } else { + continue; + } + } + } - $blockTables = []; - // Build the information of the blocks. - foreach ($moduleBlocks as $block) { - if (key_exists($block['group'], $blockTables) === false) { - $blockTables[$block['group']] = [ - 'name' => $block['group_name'], - 'data' => [], - ]; + // Save the interfaces found for process later. + $this->interfacesFound = $interfaces; + } + + + /** + * Perform a General SNMP Walk + * + * @param array $receivedOid Array with the raw oid info. + * + * @return void + */ + public function performSNMPGeneral($receivedOid) + { + // Getting the Symbolic Name of the OID. + $symbolicName = explode('OID:', array_shift($receivedOid)); + // Translate the Symbolic Name to numeric OID. + $output_oid = ''; + exec('snmptranslate -On '.$symbolicName[1], $output_oid); + // The PEN is hosted in the seventh position. + $tmpPEN = explode('.', $output_oid[0]); + $pen = $tmpPEN[7]; + // Then look in DB if the PEN is registered. + $penFound = db_get_value('manufacturer', 'tpen', 'pen', $pen); + if ($penFound === false) { + // This PEN is not registered. Let's finish. + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'The PEN (%s) is not registered.', + $pen + ); + return; + } else { + // Save the PEN for process later. + $this->penName = $penFound; + } + } + + + /** + * Let's do a SNMP Walk + * + * @return void + */ + public function performSNMP() + { + // If the target IP is empty, get it form the agent. + if (empty($this->targetIp) === true) { + $this->targetIp = db_get_value( + 'direccion', + 'tagente', + 'id_agente', + $this->idAgent + ); + } + + if ($this->wizardSection === 'snmp_interfaces_explorer') { + // Explore interface names. + $oidExplore = '.1.3.6.1.2.1.31.1.1.1.1'; + } else { + // Get the device PEN. + $oidExplore = '.1.3.6.1.2.1.1.2.0'; + } + + // Doc Interfaces de red. + $receivedOid = get_snmpwalk( + $this->targetIp, + $this->version, + $this->community, + $this->authUserV3, + $this->securityLevelV3, + $this->authMethodV3, + $this->authPassV3, + $this->privacyMethodV3, + $this->privacyPassV3, + 0, + $oidExplore, + $this->targetPort, + $this->server, + $this->extraArguments + ); + // The snmpwalk return information. + if (empty($receivedOid) === false) { + if ($this->wizardSection === 'snmp_interfaces_explorer') { + $this->performSNMPInterfaces($receivedOid); + } else { + $this->performSNMPGeneral($receivedOid); + } + } else { + // If the snmpwalk returns nothing, finish the execution. + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'The SNMP Walk does not return anything with the received arguments.' + ); + } + } + + + /** + * Let's do a WMI Exploration + * + * @return void + */ + public function performWMI() + { + // DOC: Handling WMI Errors --> + // https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmi-error-constants + // Capture the parameters. + // Call WMI Explorer function. + $this->wmiCommand = wmi_compose_query( + 'wmic', + $this->usernameWMI, + $this->passwordWMI, + $this->targetIp, + $this->namespaceWMI + ); + // Send basic query to target for check if + // the host is Windows (and allow WMI). + $commandQuery = $this->wmiCommand; + $commandQuery .= ' "SELECT Caption FROM Win32_ComputerSystem"'; + // Execute the wmic command. + $result = []; + exec($commandQuery, $result); + $execCorrect = true; + $tmpError = ''; + + // Look for the response if we have ERROR messages. + foreach ($result as $info) { + if (preg_match('/ERROR:/', $info) !== 0) { + $execCorrect = false; + $tmpError = strrchr($info, 'ERROR:'); + break; + } + } + + // FOUND ERRORS: TIMEOUT. + // [0] => [librpc/rpc/dcerpc_connect.c:790:dcerpc_pipe_connect_b_recv()] + // failed NT status (c00000b5) in dcerpc_pipe_connect_b_recv. + // [1] => [wmi/wmic.c:196:main()] ERROR: Login to remote object. + // If execution gone fine. + if ($execCorrect === true) { + $this->moduleBlocks = $this->getModuleBlocks(); + } else { + $this->message['type'][] = 'error'; + $this->message['message'][] = sprintf( + __('The target host response with an error: %s'), + $tmpError + ); + } + } + + + /** + * Show list with info modules at create. + * + * @return void + */ + public function listModulesToCreate() + { + $data = get_parameter('data', ''); + + $data = json_decode(io_safe_output($data), true); + + $data = array_reduce( + $data, + function ($carry, $item) { + $carry[$item['name']] = $item['value']; + return $carry; + }, + [] + ); + + $candidateModules = $this->candidateModuleToCreate($data); + $this->sectionUrl = $this->baseUrl.'&wizard_section='.$this->wizardSection; + + $form = [ + 'action' => $this->sectionUrl, + 'id' => 'reviewed-modules', + 'method' => 'POST', + 'class' => '', + 'extra' => '', + ]; + + $inputs = [ + [ + 'arguments' => [ + 'type' => 'hidden', + 'value' => json_encode($candidateModules), + 'return' => true, + 'name' => 'modules-definition', + ], + ], + ]; + + $inputs = array_merge($inputs, $this->getCommonDataInputs()); + + $content = HTML::printForm( + [ + 'form' => $form, + 'inputs' => $inputs, + ], + true + ); + + if (empty($candidateModules) === true) { + echo ui_print_error_message(__('No selected modules')); + return; + } + + $table = new StdClass(); + + $table->data = []; + $table->width = '100%'; + $table->class = 'info_table'; + + // Header section. + $table->head = []; + $table->head[0] = ''.__('Module Name').''; + $table->head[1] = ''.__('Server').''; + $table->head[2] = ''.__('Type').''; + $table->head[3] = ''.__('Description').''; + $table->head[4] = ''.__('Treshold').''; + + $table->data = []; + + $namesArray = []; + $data = []; + $i = 0; + + foreach ($candidateModules as $key => $module) { + if (isset($namesArray[$module['name']]) === false) { + $namesArray[$module['name']] = $module['name']; + + if (empty($this->idPolicy) === false) { + $sql = sprintf( + "SELECT id + FROM tpolicy_modules + WHERE id_policy = %d + AND `name` = '%s'", + $this->idPolicy, + io_safe_input($module['name']) + ); + $msgError = __('Module exist in policy'); + } else { + $sql = sprintf( + "SELECT id_agente_modulo + FROM tagente_modulo + WHERE id_agente = %d + AND nombre = '%s'", + $this->idAgent, + io_safe_input($module['name']) + ); + $msgError = __('Module exist in agent'); + } + + $existInDb = db_get_value_sql($sql); + } else { + $existInDb = true; + $msgError = __( + 'Module with the same name in the module creation list' + ); } - $blockTables[$block['group']]['data'][] = [ - 'component_id' => $block['component_id'], - 'name' => $block['name'], - 'type' => $block['type'], - 'description' => $block['description'], + $data[0] = $module['name']; + if ($existInDb !== false) { + $table->rowstyle[$i] = 'color:#ccc;'; + $data[0] .= ' '; + $data[0] .= html_print_image( + 'images/error.png', + true, + ['title' => $msgError] + ); + } + + if ($this->server !== 0) { + $this->serverType = (int) db_get_value( + 'server_type', + 'tserver', + 'id_server', + $this->server + ); + } + + // Img Server. + if ($this->serverType == SERVER_TYPE_ENTERPRISE_SATELLITE) { + $img_server = html_print_image( + 'images/satellite.png', + true, + ['title' => __('Enterprise Satellite server')] + ); + } else { + if ($module['execution_type'] == EXECUTION_TYPE_PLUGIN) { + $img_server = html_print_image( + 'images/plugin.png', + true, + ['title' => __('Plugin server')] + ); + } else { + if ($this->protocol === 'wmi') { + $img_server = html_print_image( + 'images/wmi.png', + true, + ['title' => __('WMI server')] + ); + } else { + $img_server = html_print_image( + 'images/network.png', + true, + ['title' => __('Network server')] + ); + } + } + } + + $data[1] = $img_server; + + $data[2] = \ui_print_moduletype_icon($module['moduleType'], true); + + $data[3] = mb_strimwidth( + io_safe_output($module['description']), + 0, + 150, + '...' + ); + + $data[4] = __('Warning').' '; + $data[4] .= $module['warningMin'].' / '.$module['warningMax']; + $data[4] .= '
'; + $data[4] .= __('Critical').' '; + $data[4] .= $module['criticalMin'].' / '.$module['criticalMax']; + + array_push($table->data, $data); + $i++; + } + + $content .= html_print_table($table, true); + + echo $content; + return; + } + + + /** + * Prepare data module to create. + * + * @param array $data Array Info module. + * + * @return array + */ + public function candidateModuleToCreate(array $data):array + { + $modulesActivated = []; + $generalInterface = false; + // Lets catch all values. + foreach ($data as $key => $value) { + if (empty(preg_match('/module-active/', $key)) === false + && (int) $value === 1 + ) { + $tmpModules = explode('-', $key); + + $keyData = $tmpModules[2].'-'.$tmpModules[3]; + + $modulesActivated[] = $keyData; + } else if (empty(preg_match('/interfaz_select_/', $key)) === false) { + $tmpInterfaces = explode('interfaz_select_', $key); + $interfaces[$tmpInterfaces[1]] = $tmpInterfaces[1]; + } else if (empty(preg_match('/box_enable_toggle/', $key)) === false) { + $generalInterface = true; + } else { + if (property_exists($this, $key) === true) { + // Reinitialize received values. + $this->{$key} = $value; + } + } + } + + $this->wizardSection = $data['wizard_section']; + + $result = []; + // Only section snmp interfaces explorer. + if ($data['wizard_section'] === 'snmp_interfaces_explorer') { + if (isset($interfaces) === true + && is_array($interfaces) === true + && empty($interfaces) === false + && isset($modulesActivated) === true + && is_array($modulesActivated) === true + && empty($modulesActivated) === false + ) { + foreach ($interfaces as $key => $value) { + $valueStr = preg_replace('/\//', '\/', $value); + foreach ($modulesActivated as $k => $v) { + if (preg_match('/^'.$valueStr.'_\d+-\d+$/', $v) == true) { + $tmp[$v] = $v; + } else if ($generalInterface === true + && preg_match('/^0_\d+-\d+$/', $v) == true + ) { + $id = preg_replace( + '/^0_/', + $value.'_', + $v + ); + $tmp[$id] = $id; + } + } + } + } else { + return $result; + } + + $modulesActivated = $tmp; + } + + foreach (array_keys($data) as $k) { + foreach ($modulesActivated as $key => $value) { + $valueStr = preg_replace('/\//', '\/', $value); + if (empty(preg_match('/'.$valueStr.'$/', $k)) === false) { + if (empty(preg_match('/module-name-set/', $k)) === false) { + $result[$value]['name'] = $data[$k]; + } else if (empty(preg_match('/module-description-set/', $k)) === false) { + $result[$value]['description'] = $data[$k]; + } + + if ($data['wizard_section'] === 'snmp_interfaces_explorer') { + if (isset($data['module-active-'.$key]) === false + || $data['module-active-'.$key] == 0 + ) { + if (empty(preg_match('/module-name-set/', $k)) === false) { + $result[$value]['name'] = $data['module-default_name-'.$key]; + } else if (empty(preg_match('/module-description-set/', $k)) === false) { + $result[$value]['description'] = $data['module-default_description-'.$key]; + } + + preg_match('/^(.*)-.*?_(\d-\d)$/', $k, $matches); + $k = $matches[1].'-0_'.$matches[2]; + } + } + + if (empty(preg_match('/module-warning-min/', $k)) === false) { + $result[$value]['warningMin'] = $data[$k]; + } else if (empty(preg_match('/module-warning-max/', $k)) === false) { + $result[$value]['warningMax'] = $data[$k]; + } else if (empty(preg_match('/module-critical-min/', $k)) === false) { + $result[$value]['criticalMin'] = $data[$k]; + } else if (empty(preg_match('/module-critical-max/', $k)) === false) { + $result[$value]['criticalMax'] = $data[$k]; + } else if (empty(preg_match('/module-critical-inv/', $k)) === false) { + $result[$value]['criticalInv'] = $data[$k]; + } else if (empty(preg_match('/module-warning-inv/', $k)) === false) { + $result[$value]['warningInv'] = $data[$k]; + } else if (empty(preg_match('/module-type/', $k)) === false) { + $result[$value]['moduleType'] = $data[$k]; + } else if (empty(preg_match('/module-unit/', $k)) === false) { + $result[$value]['unit'] = $data[$k]; + } else if (empty(preg_match('/module-scan_type/', $k)) === false) { + $result[$value]['scan_type'] = (int) $data[$k]; + } else if (empty(preg_match('/module-execution_type/', $k)) === false) { + $result[$value]['execution_type'] = (int) $data[$k]; + } else if (empty(preg_match('/module-value/', $k)) === false) { + $result[$value]['value'] = $data[$k]; + } else if (empty(preg_match('/module-macros/', $k)) === false) { + $result[$value]['macros'] = $data[$k]; + } else if (empty(preg_match('/module-name-oid/', $k)) === false) { + $result[$value]['nameOid'] = $data[$k]; + } else if (empty(preg_match('/module-query_class/', $k)) === false) { + $result[$value]['queryClass'] = $data[$k]; + } else if (empty(preg_match('/module-query_key_field/', $k)) === false) { + $result[$value]['queryKeyField'] = $data[$k]; + } else if (empty(preg_match('/module-scan_filters/', $k)) === false) { + $result[$value]['scanFilters'] = $data[$k]; + } else if (empty(preg_match('/module-query_filters/', $k)) === false) { + $result[$value]['queryFilters'] = $data[$k]; + } else { + $result[$value][$k] = $data[$k]; + } + } + } + } + + return $result; + } + + + /** + * Process the information received for modules creation + * + * @return void + */ + public function processModules() + { + $modulesCandidates = json_decode( + io_safe_output(get_parameter('modules-definition', [])), + true + ); + + if (json_last_error() !== JSON_ERROR_NONE) { + $this->message['type'][] = 'error'; + $this->message['message'][] = json_last_error_msg(); + return; + } + + if (empty($this->idPolicy) === false) { + $this->processModulesPolicy($modulesCandidates); + } else { + $this->processModulesAgents($modulesCandidates); + } + } + + + /** + * Process the information received for modules creation in this policy. + * + * @param array $modulesCandidates Modules for create. + * + * @return void + */ + public function processModulesPolicy(array $modulesCandidates) + { + $errorflag = false; + foreach ($modulesCandidates as $candidate) { + $sql = sprintf( + "SELECT id + FROM tpolicy_modules + WHERE id_policy = %d + AND `name` = '%s'", + $this->idPolicy, + io_safe_input($candidate['name']) + ); + + $existInDb = db_get_value_sql($sql); + + if ($existInDb !== false) { + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'Module "%s" exits in this policy', + $candidate['name'] + ); + $errorflag = true; + continue; + } + + $value = []; + $values['name'] = io_safe_input($candidate['name']); + $values['description'] = io_safe_input($candidate['description']); + $values['unit'] = $candidate['unit']; + $values['id_tipo_modulo'] = $candidate['moduleType']; + $values['id_policy'] = $this->idPolicy; + $values['module_interval'] = 300; + + $nameTypeModule = modules_get_moduletype_name( + $candidate['moduleType'] + ); + + if ($this->protocol === 'snmp') { + if ($candidate['execution_type'] === 0 + || $candidate['execution_type'] === EXECUTION_TYPE_NETWORK + ) { + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $values['id_module'] = MODULE_DATA; + $values['module_interval'] = 1; + + $cf = "module_begin\n"; + $cf .= 'module_name '.$candidate['name']."\n"; + $cf .= 'module_type '.$nameTypeModule."\n"; + $cf .= "module_snmp\n"; + $cf .= 'module_version '.$this->version."\n"; + $cf .= 'module_oid '.$candidate['value']."\n"; + $cf .= 'module_community '.$this->community."\n"; + if ($this->version === '3') { + $cf .= 'module_seclevel '.$this->securityLevelV3."\n"; + $cf .= 'module_secname '.$this->authUserV3."\n"; + + if ($this->securityLevelV3 === 'authNoPriv' + || $this->securityLevelV3 === 'authPriv' + ) { + $cf .= 'module_authproto '.$this->authMethodV3."\n"; + $cf .= 'module_authpass '.$this->authPassV3."\n"; + if ($this->securityLevelV3 === 'authPriv') { + $cf .= 'module_privproto '.$this->privacyMethodV3."\n"; + $cf .= 'module_privpass '.$this->privacyPassV3."\n"; + } + } + } + + $cf .= 'module_end'; + $values['configuration_data'] = io_safe_input($cf); + } else { + $values['id_module'] = MODULE_NETWORK; + } + + $values['snmp_community'] = $this->community; + $values['tcp_send'] = $this->version; + $values['snmp_oid'] = $candidate['value']; + $values['tcp_port'] = $this->targetPort; + if ($this->version === '3') { + $values['custom_string_3'] = $this->securityLevelV3; + $values['plugin_user'] = $this->authUserV3; + if ($this->securityLevelV3 === 'authNoPriv' + || $this->securityLevelV3 === 'authPriv' + ) { + $values['plugin_parameter'] = $this->authMethodV3; + $values['plugin_pass'] = $this->authPassV3; + if ($this->securityLevelV3 === 'authPriv') { + $values['custom_string_1'] = $this->privacyMethodV3; + $values['custom_string_2'] = $this->privacyPassV3; + } + } + } + } else if ($candidate['execution_type'] === EXECUTION_TYPE_PLUGIN) { + $infoMacros = json_decode( + base64_decode($candidate['macros']), + true + ); + + if (isset($infoMacros['macros']) === false + || is_array($infoMacros['macros']) === false + ) { + $infoMacros['macros'] = []; + } + + if (isset($candidate['nameOid']) === true + && empty($candidate['nameOid']) === false + ) { + $infoMacros['macros']['_nameOID_'] = $candidate['nameOid']; + } + + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $values['module_interval'] = 1; + if (empty($infoMacros['satellite_execution']) === true) { + // Already defined. + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'Module %s module_exec not configuration', + $candidate['name'] + ); + + $errorflag = true; + continue; + } + + $moduleExec = $this->replacementMacrosPlugin( + $infoMacros['satellite_execution'], + $infoMacros['macros'] + ); + + $values['id_module'] = MODULE_DATA; + $cfData = "module_begin\n"; + $cfData .= 'module_name '.$candidate['name']."\n"; + $cfData .= 'module_type '.$nameTypeModule."\n"; + $cfData .= 'module_exec '.io_safe_output($moduleExec)."\n"; + $cfData .= 'module_end'; + $values['configuration_data'] = io_safe_input($cfData); + } else { + $values['ip_target'] = '_address_'; + $values['id_module'] = MODULE_PLUGIN; + $fieldsPlugin = db_get_value_sql( + sprintf( + 'SELECT macros FROM tplugin WHERE id=%d', + (int) $infoMacros['server_plugin'] + ) + ); + + if ($fieldsPlugin !== false) { + $fieldsPlugin = json_decode($fieldsPlugin, true); + $i = 1; + foreach ($infoMacros as $key => $value) { + if (empty(preg_match('/_snmp_field/', $key)) === false) { + $new_macros = []; + foreach ($fieldsPlugin as $k => $v) { + if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) { + $fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin( + $value, + $infoMacros['macros'] + ); + $i++; + continue; + } + } + } + } + } + + $values['id_plugin'] = $infoMacros['server_plugin']; + $values['macros'] = json_encode($fieldsPlugin); + } + } + } else if ($this->protocol === 'wmi') { + if ($candidate['execution_type'] === EXECUTION_TYPE_NETWORK) { + // Generals fields. + $values['plugin_user'] = io_safe_input($this->usernameWMI); + $values['plugin_pass'] = io_safe_input($this->passwordWMI); + $values['tcp_send'] = io_safe_input($this->namespaceWMI); + + // Build query WMI. + $dataWMI = [ + 'query_class' => $candidate['queryClass'], + 'query_filters' => io_safe_output( + base64_decode( + $candidate['queryFilters'] + ) + ), + 'macros' => base64_decode( + $candidate['macros'] + ), + 'query_key_field' => $candidate['queryKeyField'], + ]; + + $candidate['wmi_query'] = $this->wmiQuery( + $dataWMI, + 'execution', + true + ); + + $queryFilters = json_decode( + base64_decode( + $candidate['queryFilters'] + ), + true + ); + + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $values['module_interval'] = 1; + $values['id_module'] = MODULE_DATA; + + $cfData = "module_begin\n"; + $cfData .= 'module_name '.$candidate['name']."\n"; + $cfData .= 'module_type '.$nameTypeModule."\n"; + $cfData .= "module_wmi\n"; + $cfData .= 'module_wmiquery '.$candidate['wmi_query']."\n"; + $cfData .= 'module_wmicolumn '.(isset($queryFilters['field']) === true) ? $queryFilters['field'] : (0)."\n"; + $cfData .= 'module_wmiauth '.$this->usernameWMI.'%'.$this->passwordWMI."\n"; + $cfData .= 'module_end'; + $values['configuration_data'] = io_safe_input($cfData); + } else { + $values['id_module'] = MODULE_WMI; + } + + $values['snmp_oid'] = io_safe_input( + $candidate['wmi_query'] + ); + + $values['tcp_port'] = (isset($queryFilters['field']) === true) ? $queryFilters['field'] : 0; + $values['snmp_community'] = (isset($queryFilters['key_string']) === true) ? $queryFilters['key_string'] : ''; + } else if ($candidate['execution_type'] === EXECUTION_TYPE_PLUGIN) { + $infoMacros = json_decode( + base64_decode($candidate['macros']), + true + ); + + if (isset($infoMacros['macros']) === false + || is_array($infoMacros['macros']) === false + ) { + $infoMacros['macros'] = []; + } + + if (isset($candidate['queryClass']) === true + && empty($candidate['queryClass']) === false + ) { + $infoMacros['macros']['_class_wmi_'] = $candidate['queryClass']; + } + + if (isset($candidate['queryKeyField']) === true + && empty($candidate['queryKeyField']) === false + ) { + $infoMacros['macros']['_field_wmi_0_'] = $candidate['queryKeyField']; + } + + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $values['module_interval'] = 1; + if (empty($infoMacros['satellite_execution']) === true) { + // Already defined. + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'Module %s satellite execution not configuration', + $candidate['name'] + ); + $errorflag = true; + continue; + } + + $moduleExec = $this->replacementMacrosPlugin( + $infoMacros['satellite_execution'], + $infoMacros['macros'] + ); + + $values['id_module'] = MODULE_DATA; + $cfData = "module_begin\n"; + $cfData .= 'module_name '.$candidate['name']."\n"; + $cfData .= 'module_type '.$nameTypeModule."\n"; + $cfData .= 'module_exec '.io_safe_output($moduleExec)."\n"; + $cfData .= 'module_end'; + $values['configuration_data'] = io_safe_input($cfData); + } else { + $values['id_module'] = MODULE_PLUGIN; + $fieldsPlugin = db_get_value_sql( + sprintf( + 'SELECT macros FROM tplugin WHERE id=%d', + (int) $infoMacros['server_plugin'] + ) + ); + + if ($fieldsPlugin !== false) { + $fieldsPlugin = json_decode($fieldsPlugin, true); + $i = 1; + foreach ($infoMacros as $key => $value) { + if (empty(preg_match('/_wmi_field/', $key)) === false) { + $new_macros = []; + foreach ($fieldsPlugin as $k => $v) { + if ($v['macro'] === preg_replace('/_wmi_field/', '', $key)) { + $fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin( + $value, + $infoMacros['macros'] + ); + $i++; + continue; + } + } + } + } + } + + $values['id_plugin'] = $infoMacros['server_plugin']; + $values['macros'] = json_encode($fieldsPlugin); + } + + $values['ip_target'] = '_address_'; + $values['snmp_oid'] = io_safe_input( + $candidate['wmi_query'] + ); + } + } + + if (preg_match('/string/', $nameTypeModule) === true) { + // String module. + $values['str_warning'] = io_safe_input( + $candidate['warningMax'] + ); + $values['str_critical'] = io_safe_input( + $candidate['criticalMax'] + ); + } else { + // Numeric module. + $values['min_warning'] = $candidate['warningMin']; + $values['max_warning'] = $candidate['warningMax']; + $values['min_critical'] = $candidate['criticalMin']; + $values['max_critical'] = $candidate['criticalMax']; + } + + $values['warning_inverse'] = $candidate['warningInv']; + $values['critical_inverse'] = $candidate['criticalInv']; + + // Insert modules. + $result = policies_create_module( + $values['name'], + $this->idPolicy, + $values['id_module'], + $values + ); + + if ($result === false) { + $errorflag = true; + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'Module "%s" problems insert in bbdd', + $candidate['name'] + ); + } + } + + if ($errorflag === false) { + $this->message['type'][] = 'success'; + $this->message['message'][] = __('Modules created'); + } + } + + + /** + * Process the information received for modules creation in this agent. + * + * @param array $modulesCandidates Modules for create. + * + * @return void + */ + public function processModulesAgents(array $modulesCandidates) + { + $modules = []; + $errorflag = false; + foreach ($modulesCandidates as $candidate) { + $tmp = Module::search( + [ + 'nombre' => io_safe_input($candidate['name']), + 'id_agente' => $this->idAgent, + ], + 1 + ); + + if ($tmp !== null) { + // Already defined. + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'Module "%s" exits in this agent', + $candidate['name'] + ); + $errorflag = true; + continue; + } + + // Not found, it is new. + $tmp = new Module(); + $tmp->nombre(io_safe_input($candidate['name'])); + $tmp->descripcion(io_safe_input($candidate['description'])); + $tmp->unit($candidate['unit']); + $tmp->id_tipo_modulo($candidate['moduleType']); + $tmp->id_agente($this->idAgent); + $tmp->module_interval(agents_get_interval($this->idAgent)); + + if ($this->protocol === 'snmp') { + if ($candidate['execution_type'] === 0 + || $candidate['execution_type'] === EXECUTION_TYPE_NETWORK + ) { + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $tmp->module_interval(300); + $tmp->id_modulo(MODULE_DATA); + $tmp->updateConfigurationData( + 'module_name', + $candidate['name'] + ); + $tmp->updateConfigurationData( + 'module_type', + $tmp->moduleType()->nombre() + ); + $tmp->updateConfigurationData( + 'module_snmp', + $this->targetIp + ); + $tmp->updateConfigurationData( + 'module_version', + $this->version + ); + $tmp->updateConfigurationData( + 'module_oid', + $candidate['value'] + ); + $tmp->updateConfigurationData( + 'module_community', + $this->community + ); + + if ($this->version === '3') { + $tmp->updateConfigurationData( + 'module_seclevel', + $this->securityLevelV3 + ); + $tmp->updateConfigurationData( + 'module_secname', + $this->authUserV3 + ); + + if ($this->securityLevelV3 === 'authNoPriv' + || $this->securityLevelV3 === 'authPriv' + ) { + $tmp->updateConfigurationData( + 'module_authproto', + $this->authMethodV3 + ); + $tmp->updateConfigurationData( + 'module_authpass', + $this->authPassV3 + ); + if ($this->securityLevelV3 === 'authPriv') { + $tmp->updateConfigurationData( + 'module_privproto', + $this->privacyMethodV3 + ); + $tmp->updateConfigurationData( + 'module_privpass', + $this->privacyPassV3 + ); + } + } + } + } else { + $tmp->id_modulo(MODULE_NETWORK); + } + + $tmp->ip_target($this->targetIp); + $tmp->snmp_community($this->community); + $tmp->tcp_send($this->version); + $tmp->snmp_oid($candidate['value']); + $tmp->tcp_port($this->targetPort); + if ($this->version === '3') { + $tmp->custom_string_3($this->securityLevelV3); + $tmp->plugin_user($this->authUserV3); + if ($this->securityLevelV3 === 'authNoPriv' + || $this->securityLevelV3 === 'authPriv' + ) { + $tmp->plugin_parameter($this->authMethodV3); + $tmp->plugin_pass($this->authPassV3); + if ($this->securityLevelV3 === 'authPriv') { + $tmp->custom_string_1($this->privacyMethodV3); + $tmp->custom_string_2($this->privacyPassV3); + } + } + } + } else if ($candidate['execution_type'] === EXECUTION_TYPE_PLUGIN) { + $infoMacros = json_decode( + base64_decode($candidate['macros']), + true + ); + + if (isset($infoMacros['macros']) === false + || is_array($infoMacros['macros']) === false + ) { + $infoMacros['macros'] = []; + } + + if (isset($candidate['nameOid']) === true + && empty($candidate['nameOid']) === false + ) { + $infoMacros['macros']['_nameOID_'] = $candidate['nameOid']; + } + + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $tmp->module_interval(300); + $tmp->id_modulo(MODULE_DATA); + $tmp->updateConfigurationData( + 'module_name', + $candidate['name'] + ); + $tmp->updateConfigurationData( + 'module_type', + $tmp->moduleType()->nombre() + ); + + if (empty($infoMacros['satellite_execution']) === true) { + // Already defined. + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'Module %s module_exec not configuration', + $candidate['name'] + ); + + $errorflag = true; + continue; + } + + $tmp->updateConfigurationData( + 'module_exec', + io_safe_output( + $this->replacementMacrosPlugin( + $infoMacros['satellite_execution'], + $infoMacros['macros'] + ) + ) + ); + } else { + $tmp->ip_target($this->targetIp); + $tmp->id_modulo(MODULE_PLUGIN); + $fieldsPlugin = db_get_value_sql( + sprintf( + 'SELECT macros FROM tplugin WHERE id=%d', + (int) $infoMacros['server_plugin'] + ) + ); + + if ($fieldsPlugin !== false) { + $fieldsPlugin = json_decode($fieldsPlugin, true); + $i = 1; + foreach ($infoMacros as $key => $value) { + if (empty(preg_match('/_snmp_field/', $key)) === false) { + $new_macros = []; + foreach ($fieldsPlugin as $k => $v) { + if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) { + $fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin( + $value, + $infoMacros['macros'] + ); + $i++; + continue; + } + } + } + } + } + + $tmp->id_plugin($infoMacros['server_plugin']); + $tmp->macros(json_encode($fieldsPlugin)); + } + } + } else if ($this->protocol === 'wmi') { + if ($candidate['execution_type'] === EXECUTION_TYPE_NETWORK) { + // Generals fields. + $tmp->plugin_user(io_safe_input($this->usernameWMI)); + $tmp->plugin_pass(io_safe_input($this->passwordWMI)); + $tmp->tcp_send(io_safe_input($this->namespaceWMI)); + $tmp->ip_target(io_safe_input($this->targetIp)); + + // Build query WMI. + $dataWMI = [ + 'query_class' => $candidate['queryClass'], + 'query_filters' => io_safe_output( + base64_decode( + $candidate['queryFilters'] + ) + ), + 'macros' => base64_decode( + $candidate['macros'] + ), + 'query_key_field' => $candidate['queryKeyField'], + ]; + + $candidate['wmi_query'] = $this->wmiQuery( + $dataWMI, + 'execution', + true + ); + + $queryFilters = json_decode( + base64_decode( + $candidate['queryFilters'] + ), + true + ); + + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $tmp->module_interval(300); + $tmp->id_modulo(MODULE_DATA); + $tmp->updateConfigurationData( + 'module_name', + $candidate['name'] + ); + $tmp->updateConfigurationData( + 'module_type', + $tmp->moduleType()->nombre() + ); + $tmp->updateConfigurationData( + 'module_wmi', + $this->targetIp + ); + $tmp->updateConfigurationData( + 'module_wmiquery', + $candidate['wmi_query'] + ); + $tmp->updateConfigurationData( + 'module_wmiauth', + $this->usernameWMI.'%'.$this->passwordWMI + ); + $tmp->updateConfigurationData( + 'module_wmicolumn', + (isset($queryFilters['field']) === true) ? $queryFilters['field'] : 0 + ); + } else { + $tmp->id_modulo(MODULE_WMI); + } + + $tmp->snmp_oid(io_safe_input($candidate['wmi_query'])); + + $tmp->tcp_port( + (isset($queryFilters['field']) === true) ? $queryFilters['field'] : 0 + ); + + $tmp->snmp_community( + (isset($queryFilters['key_string']) === true) ? $queryFilters['key_string'] : '' + ); + } else if ($candidate['execution_type'] === EXECUTION_TYPE_PLUGIN) { + $infoMacros = json_decode( + base64_decode($candidate['macros']), + true + ); + + if (isset($infoMacros['macros']) === false + || is_array($infoMacros['macros']) === false + ) { + $infoMacros['macros'] = []; + } + + if (isset($candidate['queryClass']) === true + && empty($candidate['queryClass']) === false + ) { + $infoMacros['macros']['_class_wmi_'] = $candidate['queryClass']; + } + + if (isset($candidate['queryKeyField']) === true + && empty($candidate['queryKeyField']) === false + ) { + $infoMacros['macros']['_field_wmi_0_'] = $candidate['queryKeyField']; + } + + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + $tmp->module_interval(300); + $tmp->id_modulo(MODULE_DATA); + $tmp->updateConfigurationData( + 'module_name', + $candidate['name'] + ); + $tmp->updateConfigurationData( + 'module_type', + $tmp->moduleType()->nombre() + ); + + if (empty($infoMacros['satellite_execution']) === true) { + // Already defined. + $this->message['type'][] = 'error'; + $this->message['message'][] = __( + 'Module %s satellite execution not configuration', + $candidate['name'] + ); + $errorflag = true; + continue; + } + + $tmp->updateConfigurationData( + 'module_exec', + io_safe_output( + $this->replacementMacrosPlugin( + $infoMacros['satellite_execution'], + $infoMacros['macros'] + ) + ) + ); + } else { + $tmp->id_modulo(MODULE_PLUGIN); + $fieldsPlugin = db_get_value_sql( + sprintf( + 'SELECT macros FROM tplugin WHERE id=%d', + (int) $infoMacros['server_plugin'] + ) + ); + + if ($fieldsPlugin !== false) { + $fieldsPlugin = json_decode($fieldsPlugin, true); + $i = 1; + foreach ($infoMacros as $key => $value) { + if (empty(preg_match('/_wmi_field/', $key)) === false) { + $new_macros = []; + foreach ($fieldsPlugin as $k => $v) { + if ($v['macro'] === preg_replace('/_wmi_field/', '', $key)) { + $fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin( + $value, + $infoMacros['macros'] + ); + $i++; + continue; + } + } + } + } + } + + $tmp->id_plugin($infoMacros['server_plugin']); + $tmp->macros(json_encode($fieldsPlugin)); + } + + $tmp->ip_target(io_safe_input($this->targetIp)); + $tmp->snmp_oid(io_safe_input($candidate['wmi_query'])); + } + } + + if (preg_match('/string/', $tmp->moduleType()->nombre()) === true) { + // String module. + $tmp->str_warning(io_safe_input($candidate['warningMax'])); + $tmp->str_critical(io_safe_input($candidate['criticalMax'])); + } else { + // Numeric module. + $tmp->min_warning($candidate['warningMin']); + $tmp->max_warning($candidate['warningMax']); + $tmp->min_critical($candidate['criticalMin']); + $tmp->max_critical($candidate['criticalMax']); + } + + $tmp->warning_inverse($candidate['warningInv']); + $tmp->critical_inverse($candidate['criticalInv']); + + // Insert modules. + try { + $res = $tmp->save(); + } catch (\Exception $e) { + $errorflag = true; + $this->message['type'][] = 'error'; + $this->message['message'][] = $e->getMessage(); + } + } + + if ($errorflag === false) { + $this->message['type'][] = 'success'; + $this->message['message'][] = __('Modules created'); + } + } + + + /** + * Replacement macros. + * + * @param string $text String. + * @param array $macros Macros for replacement. + * + * @return string Retun string to replacement. + */ + private function replacementMacrosPlugin( + string $text, + array $macros + ):string { + // Only agents. + if (empty($this->idPolicy) === true) { + // Common. + $text = preg_replace('/_address_/', $this->targetIp, $text); + } + + // WMI. + $text = preg_replace('/_user_wmi_/', $this->usernameWMI, $text); + $text = preg_replace('/_namespace_wmi_/', $this->namespaceWMI, $text); + $text = preg_replace('/_pass_wmi_/', $this->passwordWMI, $text); + + // SNMP. + $text = preg_replace('/_port_/', $this->targetPort, $text); + $text = preg_replace('/_version_/', $this->version, $text); + $text = preg_replace('/_community_/', $this->community, $text); + $text = preg_replace('/_auth_user_/', $this->authUserV3, $text); + $text = preg_replace('/_auth_pass_/', $this->authPassV3, $text); + $text = preg_replace('/_auth_method_/', $this->authMethodV3, $text); + $text = preg_replace('/_priv_method_/', $this->privacyMethodV3, $text); + $text = preg_replace('/_priv_pass_/', $this->privacyPassV3, $text); + $text = preg_replace('/_sec_level_/', $this->securityLevelV3, $text); + + // Dinamic. + if (empty($macros) === false) { + foreach ($macros as $key => $value) { + $text = preg_replace('/'.$key.'/', $value, $text); + } + } + + return $text; + } + + + /** + * Value with unit. + * + * @param string|null $value Value. + * @param string|null $unit Type unit. + * @param integer|null $moduleType Type Module. + * + * @return string + */ + private function replacementUnit( + ?string $value, + ?string $unit='', + ?int $moduleType=0 + ):string { + if ($moduleType !== MODULE_TYPE_REMOTE_SNMP_INC + && $moduleType !== MODULE_TYPE_GENERIC_DATA_INC + && $moduleType !== MODULE_TYPE_REMOTE_TCP_INC + && $moduleType !== MODULE_TYPE_REMOTE_CMD_INC + ) { + if ($unit === '_timeticks_') { + preg_match('/\((\d+?)\)/', $value, $match); + if (isset($match[1]) === true) { + $value = human_milliseconds_to_string($match[1]); + } else { + $value = human_milliseconds_to_string($value); + } + } else if (empty($unit) === false && $unit !== 'none') { + $value .= ' '.$unit; + } + } + + return $value; + } + + + /** + * Perform Interface Wizard and show a table with results. + * + * @return void + */ + private function resultsInterfaceWizard() + { + $generalInterfaceModules = $this->getInterfacesModules(); + $generalInterfaceTables = []; + $generalInterfaceModulesUpdated = []; + $component_id_number = 0; + foreach ($generalInterfaceModules as $moduleIndex => $moduleData) { + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP) { + $moduleData['module_type'] = MODULE_TYPE_GENERIC_DATA; + } else if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP_PROC) { + $moduleData['module_type'] = MODULE_TYPE_GENERIC_PROC; + } else if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP_INC) { + $moduleData['module_type'] = MODULE_TYPE_GENERIC_DATA_INC; + } else if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP_STRING) { + // MODULE_TYPE_REMOTE_SNMP_STRING. + $moduleData['module_type'] = MODULE_TYPE_GENERIC_DATA_STRING; + } + } + + // Get current value. + $currentValue = $this->snmpgetValue($moduleData['value']); + // It unit of measure have data, attach to current value. + if (empty($moduleData['module_unit']) === false) { + $currentValue .= ' '.$moduleData['module_unit']; + } + + // Stablish the data for show. + $generalInterfaceModulesUpdated[] = [ + 'component_id' => $component_id_number++, + 'name' => $moduleData['module_name'], + 'type' => $moduleData['module_type'], + 'description' => $moduleData['module_info'], + 'min_warning' => $moduleData['module_thresholds']['min_warning'], + 'max_warning' => $moduleData['module_thresholds']['max_warning'], + 'inv_warning' => $moduleData['module_thresholds']['inv_warning'], + 'min_critical' => $moduleData['module_thresholds']['min_critical'], + 'max_critical' => $moduleData['module_thresholds']['max_critical'], + 'inv_critical' => $moduleData['module_thresholds']['inv_critical'], + 'module_enabled' => $moduleData['default_enabled'], + 'name_oid' => $moduleData['value'], + 'value' => $moduleData['value'], ]; } - // Lets generate the block tables. - $output = ''; - foreach ($blockTables as $id_group => $blockTable) { - // Data with all components. - $blockData = $blockTable['data']; - // Creation of list of all components. - $blockComponentList = ''; - foreach ($blockData as $component) { - $blockComponentList .= $component['component_id'].','; - } + $generalInterfaceTables[0]['data'] = $generalInterfaceModulesUpdated; - $blockComponentList = chop($blockComponentList, ','); - // Title of Block. - $blockTitle = $blockTable['name']; - $blockTitle .= html_print_div( + // General Default monitoring. + html_print_div( + [ + 'class' => 'wizard wizard-result', + 'style' => 'margin-top: 20px;', + 'content' => $this->toggleTableModules( + $generalInterfaceTables, + false, + true, + true + ), + ] + ); + + // Interface filter. + $form = [ + 'action' => $this->sectionUrl, + 'id' => 'form-filter-interfaces', + 'method' => 'POST', + 'class' => 'modal flex flex-row', + 'extra' => '', + ]; + // Inputs. + $inputs = []; + + $inputs[] = [ + 'direct' => 1, + 'class' => 'select-interfaces', + 'block_content' => [ [ - 'class' => 'white_table_header_checkbox', - 'content' => html_print_checkbox_switch_extended( - 'sel_block_'.$id_group, - 1, - 0, - false, - 'switchBlockControl(event)', - '', - true - ), + 'label' => __('Select all filtered interfaces'), + 'arguments' => [ + 'name' => 'select-all-interfaces', + 'type' => 'switch', + 'class' => '', + 'return' => true, + 'value' => 1, + 'onclick' => 'switchBlockControlInterfaces(this);', + ], ], + ], + ]; + + $inputs[] = [ + 'direct' => 1, + 'block_content' => [ + [ + 'label' => __('Search'), + 'id' => 'txt-filter-search', + 'arguments' => [ + 'name' => 'filter-search', + 'type' => 'text', + 'class' => '', + 'return' => true, + ], + ], + ], + ]; + + // Print the filter form. + $filterForm = $this->printForm( + [ + 'form' => $form, + 'inputs' => $inputs, true - ); - - $table = new StdClasS(); - $table->class = 'databox data'; - $table->width = '75%'; - $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; - $table->rowid = []; - $table->data = []; - - $table->cellpadding = 0; - $table->cellspacing = 0; - $table->width = '100%'; - $table->class = 'info_table'; - - $table->head = []; - $table->head[0] = html_print_div(['style' => 'font-weight:700;', 'content' => __('Module Name')], true); - $table->head[1] = html_print_div(['style' => 'font-weight:700;text-align:center;', 'content' => __('Type')], true); - $table->head[2] = html_print_div(['style' => 'font-weight:700;', 'content' => __('Module info')], true); - $table->head[3] = html_print_div(['style' => 'font-weight:700;text-align:center;', 'content' => __('Warning')], true); - $table->head[4] = html_print_div(['style' => 'font-weight:700;text-align:center;', 'content' => __('Critical')], true); - $table->head[5] = html_print_div(['style' => 'font-weight:700;margin-right:1.2em;', 'content' => __('Active')], true); - - $table->size = []; - $table->size[0] = '15%'; - $table->size[1] = '3%'; - $table->size[3] = '210px'; - $table->size[4] = '210px'; - $table->size[5] = '3%'; - - $table->align = []; - $table->align[5] = 'right'; - - $table->data = []; - - foreach ($blockData as $module) { - // Module Name column. - $data[0] = $module['name']; - // Module Type column. - $data[1] = ui_print_moduletype_icon($module['type'], true); - // Module info column. - $data[2] = mb_strimwidth(io_safe_output($module['description']), 0, 150, '...'); - // Warning column. - $data[3] = html_print_div( - [ - 'class' => 'wizard-column-levels', - 'content' => 'Min: '.html_print_input_text( - 'warning_min_'.$module['component_id'], - '0', - '', - 3, - 4, - true - ).' ', - ], - true - ); - $data[3] .= html_print_div( - [ - 'class' => 'wizard-column-levels', - 'content' => 'Max: '.html_print_input_text( - 'warning_max_'.$module['component_id'], - '0', - '', - 3, - 4, - true - ), - ], - true - ); - $data[3] .= html_print_div( - [ - 'class' => 'wizard-column-levels', - 'style' => 'margin-top: 0.3em;', - 'content' => 'Inv: '.html_print_checkbox( - 'warning_inv_'.$module['component_id'], - 0, - false, - true, - false - ), - ], - true - ); - // Critical column. - $data[4] = html_print_div( - [ - 'class' => 'wizard-column-levels', - 'content' => 'Min: '.html_print_input_text( - 'critical_min_'.$module['component_id'], - '0', - '', - 3, - 4, - true - ).' ', - ], - true - ); - $data[4] .= html_print_div( - [ - 'class' => 'wizard-column-levels', - 'content' => 'Max: '.html_print_input_text( - 'critical_max_'.$module['component_id'], - '0', - '', - 3, - 4, - true - ), - ], - true - ); - $data[4] .= html_print_div( - [ - 'class' => 'wizard-column-levels', - 'style' => 'margin-top: 0.3em;', - 'content' => 'Inv: '.html_print_checkbox( - 'critical_inv_'.$module['component_id'], - 0, - false, - true, - false - ), - ], - true - ); - // Activation column. - $data[5] = html_print_checkbox_switch_extended('sel_module_'.$id_group.'_'.$module['component_id'], 1, 0, false, 'switchBlockControl(event)', '', true); - - array_push($table->data, $data); - } - - $content = html_print_table($table, true); - - $output .= ui_toggle($content, $blockTitle, '', '', false, true); - } + ], + true + ); html_print_div( [ 'class' => 'white_box', 'style' => 'margin-top: 20px;', - 'content' => $output, + 'content' => $filterForm, ] ); - // Form. Not used at this moment. + $interfaceTables = []; + // Build the information of the blocks. + foreach ($this->interfacesFound as $index => $interface) { + // Add the index position of this interface. + $interface['index'] = $index; + + if (key_exists($interface['name'], $interfaceTables) === false) { + $interfaceTables[$interface['name']] = [ + 'name' => $interface['name'], + 'data' => [], + ]; + } + + $thisInterfaceModules = $this->getInterfacesModules($interface); + + $interfaceModulesUpdated = []; + $component_id_number = 0; + foreach ($thisInterfaceModules as $moduleIndex => $moduleData) { + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP) { + $moduleData['module_type'] = MODULE_TYPE_GENERIC_DATA; + } else if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP_PROC) { + $moduleData['module_type'] = MODULE_TYPE_GENERIC_PROC; + } else if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP_INC) { + $moduleData['module_type'] = MODULE_TYPE_GENERIC_DATA_INC; + } else if ($moduleData['module_type'] == MODULE_TYPE_REMOTE_SNMP_STRING) { + // MODULE_TYPE_REMOTE_SNMP_STRING. + $moduleData['module_type'] = MODULE_TYPE_GENERIC_DATA_STRING; + } + } + + // Get current value. + $currentValue = $this->snmpgetValue($moduleData['value']); + // Format current value with thousands and decimals. + if (is_numeric($currentValue) === true) { + $decimals = (is_float($currentValue) === true) ? 2 : 0; + $currentValue = number_format($currentValue, $decimals); + } + + // It unit of measure have data, attach to current value. + if (empty($moduleData['module_unit']) === false) { + $currentValue .= ' '.$moduleData['module_unit']; + } + + // Stablish the data for show. + $interfaceModulesUpdated[] = [ + 'component_id' => $component_id_number++, + 'name' => $moduleData['module_name'], + 'type' => $moduleData['module_type'], + 'description' => $moduleData['module_description'], + 'min_warning' => $moduleData['module_thresholds']['min_warning'], + 'max_warning' => $moduleData['module_thresholds']['max_warning'], + 'inv_warning' => $moduleData['module_thresholds']['inv_warning'], + 'min_critical' => $moduleData['module_thresholds']['min_critical'], + 'max_critical' => $moduleData['module_thresholds']['max_critical'], + 'inv_critical' => $moduleData['module_thresholds']['inv_critical'], + 'module_enabled' => $moduleData['module_enabled'], + 'current_value' => $currentValue, + 'name_oid' => $moduleData['value'], + 'value' => $moduleData['value'], + ]; + } + + $interfaceTables[$interface['name']]['data'] = $interfaceModulesUpdated; + } + + html_print_div( + [ + 'class' => 'wizard wizard-result', + 'style' => 'margin-top: 20px;', + 'content' => $this->toggleTableModules( + $interfaceTables, + true, + true + ), + ] + ); + + // Add Create Modules form. + $this->createModulesForm(); + } + + + /** + * Perform WMI Module Wizard and show a table with results. + * + * @return void + */ + private function resultsWMIExplorerWizard() + { + $moduleBlocks = $this->moduleBlocks; + + $blockTables = []; + foreach ($moduleBlocks as $k => $module) { + // Construction of the WMI query. + $execCommand = $this->wmiQuery($module, 'scan'); + + // Execution of the WMI Query. + $outputCommand = $this->wmiExecution(io_safe_output($execCommand)); + + // Unpack the extra fields + // and include with key field in a field set. + $macros = json_decode($module['macros'], true); + $fieldSet = [ '0' => $module['query_key_field'] ]; + foreach ($macros as $fieldKey => $fieldMacro) { + if (preg_match('/extra_field_/', $fieldKey) !== 0) { + $tmpKey = explode('_', $fieldKey); + $macros['macros']['_field_wmi_'.$tmpKey[2].'_'] = $fieldMacro; + $fieldSet[(string) $tmpKey[2]] = $fieldMacro; + } + } + + // Value operation. + $valueOperation = io_safe_output($macros['value_operation']); + // Unpack the query filters. + $queryFilters = json_decode($module['query_filters'], true); + // Name of query filter field. + $fieldValueName = $fieldSet[$queryFilters['field']]; + + // Evaluate type of scan and execution. + if ($module['scan_type'] == SCAN_TYPE_FIXED) { + // Common actions for FIXED scan type. + $columnsList = []; + $rowList = []; + + foreach ($outputCommand as $rowLine => $rowContent) { + if (($rowLine == 0) + && (preg_match( + '/CLASS: '.$module['query_class'].'/', + $rowContent + ) === 0) + ) { + // Erase this module because give us an error. + unset($moduleBlocks[$k]); + // Do not continue with this module. + continue 2; + // The second row has the columns list. + } else if ($rowLine == 1) { + $columnsList = explode('|', $rowContent); + $columnFieldIndex = array_search( + $fieldValueName, + $columnsList, + true + ); + // The rest of the lines have results. + } else if ($rowLine == 2) { + $rowList = explode('|', $rowContent); + } + } + + // If name of the module have a macro. + $moduleBlocks[$k]['name'] = $this->macroFilter( + $module['name'], + $columnsList, + $rowList + ); + // Description can have macros too. + $moduleBlocks[$k]['description'] = $this->macroFilter( + $module['description'], + $columnsList, + $rowList + ); + // Query filters can have macros too. + $moduleBlocks[$k]['query_filters'] = $this->macroFilter( + $module['query_filters'], + $columnsList, + $rowList + ); + + foreach ($columnsList as $columnKey => $columnValue) { + $macros['macros']['_'.$columnValue.'_'] = $rowList[$columnKey]; + } + + $moduleBlocks[$k]['macros'] = json_encode($macros); + + if ($module['execution_type'] == EXECUTION_TYPE_NETWORK) { + // Construction of the WMI query. + // $execCommand = $this->wmiQuery($module, 'execution'); + // Execution of the WMI Query. + // $outputCommand = $this->wmiExecution($execCommand); + // Setting of value of this module (field query filter). + if ($queryFilters['field'] != '') { + if (empty($queryFilters['key_string']) === false) { + // Evaluate if the value is equal than key string. + $moduleBlocks[$k]['current_value'] = (io_safe_output($queryFilters['key_string']) == io_safe_output($rowList[$columnFieldIndex])) ? 1 : 0; + } else { + // Set the value getted. + $moduleBlocks[$k]['current_value'] = $rowList[$columnFieldIndex]; + } + + $moduleBlocks[$k]['current_value'] = $this->replacementUnit( + $moduleBlocks[$k]['current_value'], + $module['unit'], + $module['type'] + ); + } else { + $moduleBlocks[$k]['current_value'] = 0; + } + } else if ($module['execution_type'] == EXECUTION_TYPE_PLUGIN) { + // Combine both data list. + $dataCombined = array_combine($columnsList, $rowList); + // Change the macros for values. + foreach ($dataCombined as $macroKey => $macroValue) { + if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) { + $valueOperation = preg_replace( + '/_'.$macroKey.'_/', + $macroValue, + $valueOperation + ); + } + } + + // Evaluate the operation and set the current value. + $moduleBlocks[$k]['current_value'] = $this->evalOperation( + $valueOperation, + $module['unit'], + $module['type'] + ); + } + } else if ($module['scan_type'] == SCAN_TYPE_DYNAMIC) { + $columnsList = []; + $columnFieldIndex = '0'; + + foreach ($outputCommand as $rowLine => $rowContent) { + // The first result must be the class name. + if (($rowLine == 0) && (preg_match( + '/CLASS: '.$module['query_class'].'/', + $rowContent + ) === 0) + ) { + // Erase this module because give us an error. + unset($moduleBlocks[$k]); + // Do not continue with this module. + continue 2; + // The second row has the columns list. + } else if ($rowLine == 1) { + $columnsList = explode('|', $rowContent); + $columnFieldIndex = array_search( + $fieldValueName, + $columnsList, + true + ); + // The rest of the lines have results. + } else if ($rowLine > 1) { + $newModule = $module; + $rowList = explode('|', $rowContent); + // If name of the module have a macro. + $newModule['name'] = $this->macroFilter( + $module['name'], + $columnsList, + $rowList + ); + // Description can have macros too. + $newModule['description'] = $this->macroFilter( + $module['description'], + $columnsList, + $rowList + ); + + $newModule['query_filters'] = $this->macroFilter( + $module['query_filters'], + $columnsList, + $rowList + ); + + $keyString = $this->macroFilter( + io_safe_output($queryFilters['key_string']), + $columnsList, + $rowList + ); + + foreach ($columnsList as $columnKey => $columnValue) { + $macros['macros']['_'.$columnValue.'_'] = $rowList[$columnKey]; + } + + $newModule['macros'] = json_encode($macros); + + // Setting of value of this module (field query filter). + if ($module['execution_type'] == EXECUTION_TYPE_NETWORK) { + if ($queryFilters['field'] != '') { + // If key string filter filled. + if (empty($keyString) === false) { + // Evaluate if the value + // is equal than key string. + $newModule['current_value'] = ($keyString == io_safe_output($rowList[$columnFieldIndex])) ? 1 : 0; + } else { + // Set the value getted. + $newModule['current_value'] = $rowList[$columnFieldIndex]; + } + + $newModule['current_value'] = $this->replacementUnit( + $newModule['current_value'], + $module['unit'], + $module['type'] + ); + } else { + $newModule['current_value'] = 0; + } + } else if ($module['execution_type'] == EXECUTION_TYPE_PLUGIN) { + // Combine both data list. + $dataCombined = array_combine( + $columnsList, + $rowList + ); + // Change the macros for values. + foreach ($dataCombined as $macroKey => $macroValue) { + if (preg_match('/_'.$macroKey.'_/', $valueOperation) !== 0) { + $valueOperation = preg_replace( + '/_'.$macroKey.'_/', + $macroValue, + $valueOperation + ); + } + } + + // Evaluate the operation and set the result. + $newModule['current_value'] = $this->evalOperation( + $valueOperation, + $module['unit'], + $module['type'] + ); + } + + // Adding new module to the block. + $moduleBlocks[] = $newModule; + } + } + + // Clear the original module. + unset($moduleBlocks[$k]); + } + } + + // Create the final table with all of data received. + foreach ($moduleBlocks as $module) { + // Prepare the blocks. If its new, create a new index. + if (key_exists($module['group'], $blockTables) === false) { + $blockTables[$module['group']] = [ + 'name' => $module['group_name'], + 'data' => [], + ]; + } + + // Add the module info in the block. + $blockTables[$module['group']]['data'][] = $module; + if (isset($blockTables[$module['group']]['activeModules']) === false + && (int) $module['module_enabled'] === 1 + ) { + $blockTables[$module['group']]['activeModules'] = 2; + } else if (isset($blockTables[$module['group']]['activeModules']) === true + && (int) $module['module_enabled'] === 0 + ) { + $blockTables[$module['group']]['activeModules'] = 1; + } + } + + // General Default monitoring. + html_print_div( + [ + 'class' => 'wizard wizard-result', + 'style' => 'margin-top: 20px;', + 'content' => $this->toggleTableModules($blockTables), + ] + ); + // Add Create Modules form. + $this->createModulesForm(); + } + + + /** + * Perform SNMP Module Wizard and show a table with results. + * + * @return void + */ + private function resultsSNMPExplorerWizard() + { + $moduleBlocks = $this->moduleBlocks; + + $blockTables = []; + // Lets work with the modules. + foreach ($moduleBlocks as $k => $module) { + if ($this->serverType === SERVER_TYPE_ENTERPRISE_SATELLITE) { + if ($module['type'] == MODULE_TYPE_REMOTE_SNMP) { + $module['type'] = MODULE_TYPE_GENERIC_DATA; + $moduleBlocks[$k]['type'] = $module['type']; + } else if ($module['type'] == MODULE_TYPE_REMOTE_SNMP_PROC) { + $module['type'] = MODULE_TYPE_GENERIC_PROC; + $moduleBlocks[$k]['type'] = $module['type']; + } else if ($module['type'] == MODULE_TYPE_REMOTE_SNMP_INC) { + $module['type'] = MODULE_TYPE_GENERIC_DATA_INC; + $moduleBlocks[$k]['type'] = $module['type']; + } else if ($module['type'] == MODULE_TYPE_REMOTE_SNMP_STRING) { + // MODULE_TYPE_REMOTE_SNMP_STRING. + $module['type'] = MODULE_TYPE_GENERIC_DATA_STRING; + $moduleBlocks[$k]['type'] = $module['type']; + } + } + + if ($module['scan_type'] == SCAN_TYPE_FIXED) { + // Common for FIXED Scan types. + // If _nameOID_ macro exists, stablish the name getted. + if (empty($module['name_oid']) === false) { + $nameValue = $this->snmpgetValue($module['name_oid']); + $moduleBlocks[$k]['name'] = str_replace( + '_nameOID_', + $nameValue, + $module['name'] + ); + } + + if ($module['execution_type'] == EXECUTION_TYPE_NETWORK) { + // Set the current value to this module. + if (empty($module['value']) === true) { + $module['value'] = 0; + } + + $value = $this->snmpgetValue($module['value']); + // If the value is missing, we must not show this module. + if (empty($value) === true) { + unset($moduleBlocks[$k]); + } else { + $moduleBlocks[$k]['current_value'] = $this->replacementUnit( + $value, + $module['unit'], + $module['type'] + ); + } + + $moduleBlocks[$k]['macros'] = ''; + } else { + // Three steps for FIXED PLUGIN wizard modules. + // Break up macros. + $macros = json_decode($module['macros'], true); + $operation = io_safe_output($macros['value_operation']); + // Loop through the macros for get the + // OIDs and get his values. + foreach ($macros as $key => $oid) { + if (preg_match('/extra_field_/', $key) !== 0) { + $value = (float) $this->snmpgetValue($oid); + + // If the value not exists, + // we must not create a module. + if (empty($value) === true) { + unset($moduleBlocks[$k]); + continue 2; + } else { + $tmp = explode('_', $key); + $newKey = str_replace( + $key, + '_oid_'.$tmp[2].'_', + $key + ); + $macros['macros']['_oid_'.$tmp[2].'_'] = $oid; + $operation = preg_replace( + '/'.$newKey.'/', + $value, + $operation + ); + } + } + } + + $moduleBlocks[$k]['macros'] = json_encode($macros); + + // Get the result of the operation and set it. + $moduleBlocks[$k]['current_value'] = $this->evalOperation( + $operation, + $module['unit'], + $module['type'] + ); + } + } else { + if ($module['execution_type'] == EXECUTION_TYPE_NETWORK) { + // Get the values of snmpwalk. + $snmpwalkNames = $this->snmpwalkValues($module['name_oid']); + $snmpwalkValues = $this->snmpwalkValues($module['value']); + + $snmpwalkCombined = []; + foreach ($snmpwalkNames as $index => $name) { + $snmpwalkCombined[$index] = [ + 'name' => $name, + 'value' => $snmpwalkValues[$index], + ]; + } + + foreach ($snmpwalkCombined as $index => $r) { + $name = $r['name']; + $value = $r['value']; + + $newModule = $module; + // Setting the new values. + $newModule['name'] = str_replace( + '_nameOID_', + io_safe_input($name), + $module['name'] + ); + + // Save complete OID reference + index. + $newModule['value'] = $module['value'].$index; + $newModule['current_value'] = $this->replacementUnit( + $value, + $module['unit'], + $module['type'] + ); + $newModule['macros'] = ''; + + // Add this new module to the module list. + $moduleBlocks[] = $newModule; + } + + // Erase the main module. + unset($moduleBlocks[$k]); + } else { + // Break up macros. + $macros = (array) json_decode($module['macros']); + $operation = io_safe_output($macros['value_operation']); + $oids = []; + foreach ($macros as $key => $oid) { + if (preg_match('/extra_field_/', $key) !== 0) { + $tmp = explode('_', $key); + $newKey = str_replace( + $key, + '_oid_'.$tmp[2].'_', + $key + ); + $oids[$newKey] = $oid; + } + } + + $snmpwalkNamesTmp = []; + // Is needed the index and the values of snmpwalk. + $snmpwalkNamesTmp = $this->snmpwalkValues( + $module['name_oid'], + true + ); + + $snmpwalkNames = []; + foreach ($snmpwalkNamesTmp as $value) { + // Generate a new module based + // in the first for every name found. + $newModule = $module; + // Split the values got to obtain the name. + $tmpFirst = explode('.', $value); + $tmpSecond = explode(' ', $tmpFirst[1]); + // Position 0 is the index, Position 3 is the MIB name. + $snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3]; + // Perform the operations for get the values. + $thisOperation = $operation; + foreach ($oids as $oidName => $oid) { + $currentOid = $oid.'.'.$tmpSecond[0]; + $macros['macros'][$oidName] = $currentOid; + $currentOidValue = $this->snmpgetValue($currentOid); + $thisOperation = preg_replace( + '/'.$oidName.'/', + $currentOidValue, + $thisOperation + ); + } + + $newModule['macros'] = json_encode($macros); + + // Get the result of the operation and set it. + $newModule['current_value'] = $this->evalOperation( + $thisOperation, + $module['unit'], + $module['type'] + ); + + // Add the name to this module. + $newModule['name'] = str_replace( + '_nameOID_', + io_safe_input($tmpSecond[3]), + $module['name'] + ); + + // Add this new module to the module list. + $moduleBlocks[] = $newModule; + } + + // Erase the main module. + unset($moduleBlocks[$k]); + } + } + } + + // Create the final table with all of data received. + foreach ($moduleBlocks as $module) { + if (is_array($module) === true + && count($module) <= 1 + && empty($module['macros']) === true + ) { + // Invalid module. + continue; + } + + // Prepare the blocks. If its new, create a new index. + if (key_exists($module['group'], $blockTables) === false) { + $blockTables[$module['group']] = [ + 'name' => $module['group_name'], + 'data' => [], + ]; + } + + // Add the module info in the block. + $blockTables[$module['group']]['data'][] = $module; + if (isset($blockTables[$module['group']]['activeModules']) === false + && (int) $module['module_enabled'] === 1 + ) { + $blockTables[$module['group']]['activeModules'] = 2; + } else if (isset($blockTables[$module['group']]['activeModules']) === true + && (int) $module['module_enabled'] === 0 + ) { + $blockTables[$module['group']]['activeModules'] = 1; + } + } + + if (empty($blockTables) === true) { + $this->message['type'][] = 'warning'; + $this->message['message'][] = __( + 'No information could be retrieved.' + ); + } else { + // General Default monitoring. + html_print_div( + [ + 'class' => 'wizard wizard-result', + 'style' => 'margin-top: 20px;', + 'content' => $this->toggleTableModules($blockTables), + ] + ); + + // Add Create Modules form. + $this->createModulesForm(); + } + + } + + + /** + * Get the data from the module blocks + * + * @return array Return an array with the module blocks needed. + */ + private function getModuleBlocks() + { + // Definition of filters. + $whereString = sprintf( + 'nc.id_modulo = %d AND nc.protocol = "%s"', + MODULE_WIZARD, + $this->protocol + ); + // Special considerations for both protocols. + if ($this->protocol === 'snmp') { + if (empty($this->penName) === true) { + return false; + } + + $whereString .= sprintf( + ' AND ( + nc.manufacturer_id = "all" OR nc.manufacturer_id = "%s" + )', + $this->penName + ); + $fields = 'nc.name_oid'; + } else if ($this->protocol === 'wmi') { + $fields = 'nc.query_class, nc.query_key_field,'; + $fields .= 'nc.scan_filters, nc.query_filters'; + } else { + $fields = ''; + } + + $sql = sprintf( + 'SELECT nc.id_nc AS component_id, + nc.name, + nc.type, + nc.description, + nc.id_group AS `group`, + ncg.name AS `group_name`, + nc.min_warning, + nc.max_warning, + nc.warning_inverse AS `inv_warning`, + nc.min_critical, + nc.max_critical, + nc.critical_inverse AS `inv_critical`, + nc.module_enabled, + %s, + nc.scan_type, + nc.execution_type, + nc.value, + nc.macros, + nc.unit + FROM tnetwork_component AS nc + LEFT JOIN tnetwork_component_group AS ncg + ON nc.id_group = ncg.id_sg + WHERE %s AND nc.enabled=1', + $fields, + $whereString + ); + + return db_get_all_rows_sql($sql); + } + + + /** + * Perform a snmpget for get a value from provided oid. + * + * @param string $oid Oid for get the value. + * @param boolean $full_output Array with full output.. + * + * @return mixed String when response, null if error. + */ + private function snmpgetValue(string $oid, ?bool $full_output=false) + { + $output = get_snmpwalk( + $this->targetIp, + $this->version, + $this->community, + $this->authUserV3, + $this->securityLevelV3, + $this->authMethodV3, + $this->authPassV3, + $this->privacyMethodV3, + $this->privacyPassV3, + 0, + $oid, + $this->targetPort, + $this->server, + $this->extraArguments, + (($full_output === false) ? '-Oa -On' : '-Oa') + ); + + if (is_array($output) === true) { + foreach ($output as $k => $v) { + if ($full_output === true) { + return $k.' = '.$v; + } + + $value = explode(': ', $v, 2); + return $value[1]; + } + } + + return false; + + } + + + /** + * Perform a snmpwalk for get the values from the provided oid. + * + * @param string $oid Oid for get the values. + * @param boolean $full_output Array with full output. + * + * @return array + */ + private function snmpwalkValues(string $oid, bool $full_output=false) + { + $output = []; + $temporal = get_snmpwalk( + $this->targetIp, + $this->version, + $this->community, + $this->authUserV3, + $this->securityLevelV3, + $this->authMethodV3, + $this->authPassV3, + $this->privacyMethodV3, + $this->privacyPassV3, + 0, + $oid, + $this->targetPort, + $this->server, + $this->extraArguments, + (($full_output === false) ? '-Oa -On' : '-Oa') + ); + + if (empty($temporal) === false) { + foreach ($temporal as $key => $oid_unit) { + if ($full_output === true) { + $output[] = $key.' = '.$oid_unit; + } else { + preg_match('/\.\d+$/', $key, $index); + $tmp = explode(': ', $oid_unit); + $output[$index[0]] = $tmp[1]; + } + } + } + + return $output; + } + + + /** + * Add a button for Create the modules selected. + * + * @return void + */ + private function createModulesForm() + { + // Create modules form. $form = [ - 'action' => $this->baseUrl, - 'id' => 'modal_form_action_response', + 'action' => $this->sectionUrl, + 'id' => 'form-create-modules', 'method' => 'POST', 'class' => 'modal', 'extra' => '', @@ -578,17 +3236,21 @@ class AgentWizard extends HTML // Inputs. $inputs = []; - + // Submit button. $inputs[] = [ - 'id' => 'inp-id_np', 'arguments' => [ - 'name' => 'id_np', - 'type' => 'hidden', - 'value' => '69', - 'return' => true, + 'label' => __('Create modules'), + 'name' => 'create-modules-action', + 'type' => 'button', + 'attributes' => 'class="sub cog float-right"', + 'script' => 'processListModules();', + 'return' => true, ], ]; + $inputs = array_merge($inputs, $this->getCommonDataInputs()); + + // Print the the submit button for create modules. $this->printForm( [ 'form' => $form, @@ -600,31 +3262,1360 @@ class AgentWizard extends HTML /** - * Perform SNMP + * Inputs. * - * @return void + * @return array Inputs for common data. */ - private function performSNMP() + private function getCommonDataInputs():array { - echo 'HOLA'; + $inputs[] = [ + 'id' => 'create-modules-action', + 'arguments' => [ + 'name' => 'create-modules-action', + 'type' => 'hidden', + 'value' => 1, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'protocol', + 'arguments' => [ + 'name' => 'protocol', + 'id' => 'protocol_data', + 'type' => 'hidden', + 'value' => $this->protocol, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'targetIp', + 'arguments' => [ + 'name' => 'targetIp', + 'type' => 'hidden', + 'value' => $this->targetIp, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'targetPort', + 'arguments' => [ + 'name' => 'targetPort', + 'type' => 'hidden', + 'value' => $this->targetPort, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'community', + 'arguments' => [ + 'name' => 'community', + 'type' => 'hidden', + 'value' => $this->community, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'version', + 'arguments' => [ + 'name' => 'version', + 'type' => 'hidden', + 'value' => $this->version, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'server', + 'arguments' => [ + 'name' => 'server', + 'type' => 'hidden', + 'value' => $this->server, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'authUserV3', + 'arguments' => [ + 'name' => 'authUserV3', + 'type' => 'hidden', + 'value' => $this->authUserV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'authPassV3', + 'arguments' => [ + 'name' => 'authPassV3', + 'type' => 'hidden', + 'value' => $this->authPassV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'authMethodV3', + 'arguments' => [ + 'name' => 'authMethodV3', + 'type' => 'hidden', + 'value' => $this->authMethodV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'securityLevelV3', + 'arguments' => [ + 'name' => 'securityLevelV3', + 'type' => 'hidden', + 'value' => $this->securityLevelV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'privacyMethodV3', + 'arguments' => [ + 'name' => 'privacyMethodV3', + 'type' => 'hidden', + 'value' => $this->privacyMethodV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'privacyPassV3', + 'arguments' => [ + 'name' => 'privacyPassV3', + 'type' => 'hidden', + 'value' => $this->privacyPassV3, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'namespaceWMI', + 'arguments' => [ + 'name' => 'namespaceWMI', + 'type' => 'hidden', + 'value' => $this->namespaceWMI, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'usernameWMI', + 'arguments' => [ + 'name' => 'usernameWMI', + 'type' => 'hidden', + 'value' => $this->usernameWMI, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'passwordWMI', + 'arguments' => [ + 'name' => 'passwordWMI', + 'type' => 'hidden', + 'value' => $this->passwordWMI, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'idAgent', + 'arguments' => [ + 'name' => 'idAgent', + 'type' => 'hidden', + 'value' => $this->idAgent, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'idPolicy', + 'arguments' => [ + 'name' => 'id', + 'type' => 'hidden', + 'value' => $this->idPolicy, + 'return' => true, + ], + ]; + + $inputs[] = [ + 'id' => 'wizardSection', + 'arguments' => [ + 'name' => 'wizard_section', + 'type' => 'hidden', + 'value' => $this->wizardSection, + 'return' => true, + ], + ]; + + return $inputs; } /** - * Perform WMI + * Create the tables with toggle interface for show the modules availables. * - * @return void + * @param mixed $blocks Info getted. + * @param boolean $showCurrentValue If true, show the + * column of current values. + * @param boolean $isInterface If true, the form is + * displayed for interface purposes. + * @param boolean $isPrincipal If true, the form is + * displayed for first interface module list. + * + * @return mixed String with the tables formed. */ - private function performWMI() - { + private function toggleTableModules( + $blocks, + bool $showCurrentValue=true, + bool $isInterface=false, + bool $isPrincipal=false + ) { + $output = ''; + foreach ($blocks as $idBlock => $block) { + // Data with all components. + $blockData = $block['data']; + // Active modules. + $activeModules = 0; + if (isset($block['activeModules']) === true) { + $activeModules = $block['activeModules']; + } + + // Creation of list of all components. + $blockComponentList = ''; + foreach ($blockData as $component) { + $blockComponentList .= $component['component_id'].','; + } + + $blockComponentList = chop($blockComponentList, ','); + // Title of Block. + if ($isInterface === true) { + if ($isPrincipal === true) { + $blockTitle = ''; + $blockTitle .= __( + 'Add general monitoring for all selected interfaces' + ); + $blockTitle .= ''; + } else { + $blockTitle = html_print_checkbox_switch_extended( + 'interfaz_select_'.$idBlock, + 1, + true, + false, + '', + 'form="form-create-modules" class="interfaz_select"', + true, + '' + ); + $blockTitle .= ''.$block['name']; + $blockTitle .= '  '; + $blockTitle .= html_print_image( + 'images/tip_help.png', + true, + [ + 'title' => __('Modules selected'), + 'alt' => __('Modules selected'), + 'id' => 'image-info-modules-'.$idBlock, + 'class' => 'hidden', + ] + ); + $blockTitle .= ''; + } + } else { + $blockTitle = ''.$block['name']; + $classImg = ''; + if ($activeModules === 0) { + $classImg = 'hidden'; + } + + $blockTitle .= '  '; + $blockTitle .= html_print_image( + 'images/tip_help.png', + true, + [ + 'title' => __('Modules selected'), + 'alt' => __('Modules selected'), + 'id' => 'image-info-modules-'.$idBlock, + 'class' => $classImg, + ] + ); + $blockTitle .= ''; + } + + $table = new StdClass(); + $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; + $table->rowid = []; + $table->data = []; + + $table->cellpadding = 0; + $table->cellspacing = 0; + $table->width = '100%'; + $table->class = 'info_table'; + // Subheaders for Warning and Critical columns. + $subheaders = 'Min.'; + $subheaders .= 'Max.'; + $subheaders .= 'Inv.'; + // Warning header. + $warning_header = html_print_div( + [ + 'style' => 'font-weight:700;text-align:center;', + 'content' => html_print_div( + [ + 'style' => 'width: 100%; text-align:center;', + 'content' => __('Warning'), + ], + true + ), + ], + true + ); + // Critical header. + $critical_header = html_print_div( + [ + 'style' => 'font-weight:700;text-align:center;', + 'content' => html_print_div( + [ + 'style' => 'width: 100%; text-align:center;', + 'content' => __('Critical'), + ], + true + ), + ], + true + ); + // Header section. + $table->head = []; + $table->head[0] = html_print_div( + [ + 'style' => 'font-weight:700;', + 'content' => __('Module Name'), + ], + true + ); + $table->head[1] = html_print_div( + [ + 'style' => 'font-weight:700;', + 'content' => __('Type'), + ], + true + ); + if ($isPrincipal === true) { + $headerInfo = __('Module info'); + } else { + $headerInfo = __('Description'); + } + + $table->head[2] = html_print_div( + [ + 'style' => 'font-weight:700;', + 'content' => $headerInfo, + ], + true + ); + $table->head[3] = $warning_header.$subheaders; + $table->head[4] = $critical_header.$subheaders; + + // Size. + $table->size = []; + $table->size[0] = '15%'; + $table->size[1] = '3%'; + $table->size[3] = '140px'; + $table->size[4] = '140px'; + $table->size[5] = '3%'; + + // If is needed show current value, we must correct the table. + if ($showCurrentValue === true) { + // Correct headers. + $table->head[5] = html_print_div( + [ + 'style' => 'font-weight:700;text-align:center;', + 'content' => __('Current value'), + ], + true + ); + + $class = ''; + if ($activeModules === 1) { + $class = 'alpha50'; + } + + $table->head[6] = html_print_checkbox_switch_extended( + 'sel_block_'.$idBlock, + 1, + $activeModules, + false, + 'switchBlockControl(event)', + '', + true, + '', + $class + ); + + // Correct size. + $table->size[5] = '5%'; + $table->size[6] = '3%'; + } else { + // Correct size. + $table->size[5] = '1%'; + $table->size[6] = '3%'; + $table->head[5] = ''; + $table->head[6] = html_print_checkbox_switch_extended( + 'sel_block_'.$idBlock, + 1, + true, + false, + 'switchBlockControl(event)', + '', + true, + '', + 'alpha50' + ); + } + + $table->data = []; + + foreach ($blockData as $kId => $module) { + $uniqueId = $idBlock.'_'.$module['component_id'].'-'.$kId; + + // Module Name column. + if ($isPrincipal === true) { + $data[0] = $module['name']; + } else { + $data[0] = html_print_input_text( + 'module-name-set-'.$uniqueId, + $module['name'], + '', + 25, + 255, + true, + false, + false, + '', + '', + '', + '', + false, + '', + 'form-create-modules' + ); + } + + // Module Type column. + $data[1] = ui_print_moduletype_icon($module['type'], true); + // Module info column. + if ($isPrincipal === true) { + $data[2] = io_safe_output($module['description']); + } else { + $data[2] = html_print_textarea( + 'module-description-set-'.$uniqueId, + 1, + 20, + $module['description'], + 'form=\'form-create-modules\' style=\'min-height: 50px;\'', + true + ); + } + + // Warning column. + $data_warning = ''; + $data_warning = html_print_div( + [ + 'class' => 'wizard-column-levels', + 'content' => html_print_input_text( + 'module-warning-min-'.$uniqueId, + $module['min_warning'], + '', + 3, + 4, + true, + false, + false, + '', + '', + '', + '', + false, + '', + 'form-create-modules' + ).' ', + ], + true + ); + $data_warning .= html_print_div( + [ + 'class' => 'wizard-column-levels', + 'content' => html_print_input_text( + 'module-warning-max-'.$uniqueId, + $module['max_warning'], + '', + 3, + 4, + true, + false, + false, + '', + '', + '', + '', + false, + '', + 'form-create-modules' + ), + ], + true + ); + $data_warning .= html_print_div( + [ + 'class' => 'wizard-column-levels', + 'style' => 'margin-top: 0.3em;', + 'content' => html_print_checkbox( + 'module-warning-inv-'.$uniqueId, + $module['inv_warning'], + $module['inv_warning'], + true, + false, + '', + false, + 'form="form-create-modules"' + ), + ], + true + ); + $data[3] = $data_warning; + // Critical column. + $data[4] = ''; + $data[4] .= html_print_div( + [ + 'class' => 'wizard-column-levels', + 'content' => html_print_input_text( + 'module-critical-min-'.$uniqueId, + $module['min_critical'], + '', + 3, + 4, + true, + false, + false, + '', + '', + '', + '', + false, + '', + 'form-create-modules' + ).' ', + ], + true + ); + $data[4] .= html_print_div( + [ + 'class' => 'wizard-column-levels', + 'content' => html_print_input_text( + 'module-critical-max-'.$uniqueId, + $module['max_critical'], + '', + 3, + 4, + true, + false, + false, + '', + '', + '', + '', + false, + '', + 'form-create-modules' + ), + ], + true + ); + + $data[4] .= html_print_div( + [ + 'class' => 'wizard-column-levels', + 'style' => 'margin-top: 0.3em;', + 'content' => html_print_checkbox( + 'module-critical_inv_'.$uniqueId, + $module['inv_critical'], + $module['inv_critical'], + true, + false, + '', + false, + 'form="form-create-modules"' + ), + ], + true + ); + + if (is_string($module['module_enabled']) === true) { + if ($module['module_enabled'] === false || $module['module_enabled'] === '0') { + $module['module_enabled'] = false; + } else { + $module['module_enabled'] = true; + } + } + + if ($isPrincipal === true) { + // Activation column. + $data[5] = ''; + $data[6] = html_print_checkbox_switch_extended( + 'sel_module_'.$uniqueId, + $module['module_enabled'], + $module['module_enabled'], + false, + 'switchBlockControl(event)', + '', + true + ); + } else { + // WIP. Current value of this module. + if (isset($module['current_value']) === false) { + $module['current_value'] = 'NO DATA'; + } + + $data[5] = ui_print_truncate_text( + io_safe_output($module['current_value']), + 20, + false, + true, + true, + '…', + false + ); + + // Activation column. + $data[6] = html_print_checkbox_switch_extended( + 'sel_module_'.$uniqueId, + $module['module_enabled'], + $module['module_enabled'], + false, + 'switchBlockControl(event)', + 'form="form-create-modules"', + true + ); + } + + // Input info for activate (active: 1 true 0 false). + $data[6] .= html_print_input_hidden( + 'module-active-'.$uniqueId, + $module['module_enabled'], + true, + false, + 'form="form-create-modules"' + ); + + // Type module. + $data[6] .= html_print_input_hidden( + 'module-type-'.$uniqueId, + $module['type'], + true, + false, + 'form="form-create-modules"' + ); + + // Unit module. + $data[6] .= html_print_input_hidden( + 'module-unit-'.$uniqueId, + $module['unit'], + true, + false, + 'form="form-create-modules"' + ); + + // Value module OID. + $data[6] .= html_print_input_hidden( + 'module-value-'.$uniqueId, + $module['value'], + true, + false, + 'form="form-create-modules"' + ); + + // Macro module. + $data[6] .= html_print_input_hidden( + 'module-macros-'.$uniqueId, + base64_encode($module['macros']), + true, + false, + 'form="form-create-modules"' + ); + + // Macro module. + $data[6] .= html_print_input_hidden( + 'module-name-oid-'.$uniqueId, + $module['name_oid'], + true, + false, + 'form="form-create-modules"' + ); + + // Scan type module. + $data[6] .= html_print_input_hidden( + 'module-scan_type-'.$uniqueId, + $module['scan_type'], + true, + false, + 'form="form-create-modules"' + ); + + // Execution type module. + $data[6] .= html_print_input_hidden( + 'module-execution_type-'.$uniqueId, + $module['execution_type'], + true, + false, + 'form="form-create-modules"' + ); + + // WMI Query class. + $data[6] .= html_print_input_hidden( + 'module-query_class-'.$uniqueId, + $module['query_class'], + true, + false, + 'form="form-create-modules"' + ); + + // WMI Query key. + $data[6] .= html_print_input_hidden( + 'module-query_key_field-'.$uniqueId, + $module['query_key_field'], + true, + false, + 'form="form-create-modules"' + ); + + // WMI scan filters. + $data[6] .= html_print_input_hidden( + 'module-scan_filters-'.$uniqueId, + $module['scan_filters'], + true, + false, + 'form="form-create-modules"' + ); + + // WMI query filters. + $data[6] .= html_print_input_hidden( + 'module-query_filters-'.$uniqueId, + base64_encode($module['query_filters']), + true, + false, + 'form="form-create-modules"' + ); + + if ($isInterface === true) { + // Is neccesary for default + // module name and description uin general monitoring. + $data[6] .= html_print_input_hidden( + 'module-default_name-'.$uniqueId, + $module['name'], + true, + false, + 'form="form-create-modules"' + ); + + $data[6] .= html_print_input_hidden( + 'module-default_description-'.$uniqueId, + $module['description'], + true, + false, + 'form="form-create-modules"' + ); + } + + array_push($table->data, $data); + } + + $content = html_print_table($table, true); + + $open = true; + $buttonSwitch = false; + $class = 'box-shadow white_table_graph interfaces_search'; + $reverseImg = true; + if ($isPrincipal === true) { + $open = false; + $buttonSwitch = true; + $class = 'box-shadow white_table_graph'; + $reverseImg = false; + } + + $output .= ui_toggle( + $content, + $blockTitle, + '', + $idBlock, + $open, + true, + '', + 'white-box-content', + $class, + 'images/arrow_down_green.png', + 'images/arrow_right_green.png', + false, + $reverseImg, + $buttonSwitch, + 'form="form-create-modules"' + ); + } + + return $output; + } + + + /** + * This function return the definition of modules for SNMP Interfaces + * + * @param array $data Data. + * + * @return array Return modules for defect. + */ + private function getInterfacesModules(array $data=[]) + { + $moduleDescription = ''; + $name = ''; + $value = '1'; + // Unpack the array with data. + if (empty($data) === false) { + if (empty($data['mac']) === false) { + $moduleDescription .= 'MAC: '.$data['mac'].' - '; + } else { + $moduleDescription .= ''; + } + + if (empty($data['ip']) === false) { + $moduleDescription .= 'IP: '.$data['ip'].' - '; + } else { + $moduleDescription .= ''; + } + + $name = $data['name'].'_'; + $value = $data['index']; + } + + // Definition object. + $definition = []; + // IfInOctets. + $moduleName = $name.'ifInOctets'; + $definition['ifInOctets'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The total number of octets received on the interface, including framing characters', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.10.'.$value, + 'module_unit' => 'bytes/s', + 'default_enabled' => true, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + + ]; + // IfOutOctets. + $moduleName = $name.'ifOutOctets'; + $definition['ifOutOctets'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The total number of octets transmitted out of the interface, including framing characters', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.16.'.$value, + 'module_unit' => 'bytes/s', + 'default_enabled' => true, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfOperStatus. + $adminStatusValue = 1; + if (empty($data) === false) { + $adminStatusValue = $this->snmpgetValue( + '1.3.6.1.2.1.2.2.1.7.'.$value + ); + preg_match('/\((\d+?)\)/', $adminStatusValue, $match); + $adminStatusValue = (int) $match[1]; + } + + if ($adminStatusValue === 3) { + $min_warning = 3; + $max_warning = 4; + $min_critical = 2; + $max_critical = 3; + $inv_warning = true; + $inv_critical = false; + } else if ($adminStatusValue === 2) { + $min_warning = 3; + $max_warning = 0; + $min_critical = 1; + $max_critical = 2; + $inv_warning = false; + $inv_critical = false; + } else { + $min_warning = 3; + $max_warning = 0; + $min_critical = 2; + $max_critical = 3; + $inv_warning = false; + $inv_critical = false; + } + + $moduleName = $name.'ifOperStatus'; + $definition['ifOperStatus'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The current operational state of the interface: up(1), down(2), testing(3), unknown(4), dormant(5), notPresent(6), lowerLayerDown(7)', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.8.'.$value, + 'module_unit' => '', + 'default_enabled' => true, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => $min_warning, + 'max_warning' => $max_warning, + 'inv_warning' => $inv_warning, + 'min_critical' => $min_critical, + 'max_critical' => $max_critical, + 'inv_critical' => $inv_critical, + ], + ]; + + // IfAdminStatus. + $moduleName = $name.'ifAdminStatus'; + $definition['ifAdminStatus'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The desired state of the interface: up(1), down(2), testing(3)', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.7.'.$value, + 'module_unit' => '', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfInDiscards. + $moduleName = $name.'ifInDiscards'; + $definition['ifInDiscards'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The number of inbound packets which were chosen to be discarded even though no errors had been detected to prevent their being deliverable to a higher-layer protocol', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.13.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfOutDiscards. + $moduleName = $name.'ifOutDiscards'; + $definition['ifOutDiscards'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The number of outbound packets which were chosen to be discarded even though no errors had been detected to prevent their being transmitted', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.19.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfInErrors. + $moduleName = $name.'ifInErrors'; + $definition['ifInErrors'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'For packet-oriented interfaces, the number of inbound packets that contained errors preventing them from being deliverable to a higher-layer protocol. For character- oriented or fixed-length interfaces, the number of inbound transmission units that contained errors preventing them from being deliverable to a higher-layer protocol', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.14.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfOutErrors. + $moduleName = $name.'ifOutErrors'; + $definition['ifOutErrors'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'For packet-oriented interfaces, the number of outbound packets that could not be transmitted because of errors. For character-oriented or fixed-length interfaces, the number of outbound transmission units that could not be transmitted because of errors', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.20.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfInUcastPkts. + $moduleName = $name.'ifInUcastPkts'; + $definition['ifInUcastPkts'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The number of packets, delivered by this sub-layer to a higher (sub-)layer, which were not addressed to a multicast or broadcast address at this sub-layer', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.11.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfOutUcastPkts. + $moduleName = $name.'ifOutUcastPkts'; + $definition['ifOutUcastPkts'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The total number of packets that higher-level protocols requested be transmitted, and which were not addressed to a multicast or broadcast address at this sub-layer, including those that were discarded or not sent', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.17.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfInNUcastPkts. + $moduleName = $name.'ifInNUcastPkts'; + $definition['ifInNUcastPkts'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The number of packets, delivered by this sub-layer to a higher (sub-)layer, which were addressed to a multicast or broadcast address at this sub-layer', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.12.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + // IfOutNUcastPkts. + $moduleName = $name.'ifOutNUcastPkts'; + $definition['ifOutNUcastPkts'] = [ + 'module_name' => $moduleName, + 'module_type' => MODULE_TYPE_REMOTE_SNMP_INC, + 'module_description' => sprintf( + '(%s%s)', + $moduleDescription, + $moduleName + ), + 'module_info' => 'The total number of packets that higher-level protocols requested be transmitted, and which were addressed to a multicast or broadcast address at this sub-layer, including those that were discarded or not sent', + 'execution_type' => 'network', + 'value' => '1.3.6.1.2.1.2.2.1.18.'.$value, + 'module_unit' => 'packets/s', + 'default_enabled' => false, + 'module_enabled' => false, + 'module_thresholds' => [ + 'min_warning' => '0', + 'max_warning' => '0', + 'inv_warning' => false, + 'min_critical' => '0', + 'max_critical' => '0', + 'inv_critical' => false, + ], + ]; + + return $definition; + } + + + /** + * Watch if is a arithmetic operation and perform it. + * + * @param string $operation Operation for perform. + * @param string $unit If filled, + * add unit of measure to the output. + * @param integer|null $type Module type. + * + * @return string + */ + private function evalOperation( + string $operation, + string $unit='', + ?int $type=0 + ) { + // Avoid non-numeric or arithmetic chars for security reasons. + if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) { + $output = 'ERROR'; + } else { + try { + // Get the result of the operation and set it. + $output = ''; + eval('$output = '.$operation.';'); + // If this module has unit, attach to current value. + $output = $this->replacementUnit( + round($output, 2), + $unit, + $type + ); + } catch (Exception $e) { + $output = 'ERROR'; + } + } + + return $output; + } + + + /** + * Filters macros in attributes + * + * @param string $attribute String for manage. + * @param array $columnsList List of the columns. + * @param array $rowList List of the values of current row. + * + * @return string Returns the value filtered. + */ + private function macroFilter( + string $attribute, + array $columnsList, + array $rowList + ) { + // By default, the output is the raw input of attribute. + $output = $attribute; + // If the attribute has a macro, here is filled with the info. + if (preg_match('/_(.*?)_/', $attribute, $macro) !== 0) { + $indexColumn = array_search($macro[1], $columnsList, true); + if ($indexColumn !== false) { + $output = str_replace( + $macro[0], + $rowList[$indexColumn], + $attribute + ); + } + } + + return $output; + } + + + /** + * WMI query execution. + * + * @param string $execution Entire string with the execution command. + * + * @return mixed Result of the operation. + */ + private function wmiExecution(string $execution) + { + $output = []; + try { + exec($execution, $output); + } catch (Exception $ex) { + $output = [ '0' => 'ERROR: Failed execution: '.(string) $ex]; + } + + return $output; + } + + + /** + * WMI query constructor. + * + * @param array $moduleAttr Array with attributes of modules. + * @param string $filterType If filled, what query filter to use. + * @param boolean $onlyQuery Return only query, no command. + * + * @return string A string with the complete query to perform + */ + private function wmiQuery( + array $moduleAttr, + string $filterType='', + ?bool $onlyQuery=false + ) { + // Definition of vars. + $queryClass = $moduleAttr['query_class']; + $queryFilters = json_decode( + $moduleAttr['query_filters'], + true + ); + $macros = json_decode($moduleAttr['macros'], true); + + $queryFields = []; + + // If query key field is filled, add to the query fields. + if (empty($moduleAttr['query_key_field']) === false) { + $queryFields[] = $moduleAttr['query_key_field']; + } + + // Unpack the macros. + foreach ($macros as $key => $macro) { + // Only attach extra field macros and with data inside. + if (preg_match('/extra_field_/', $key) !== 0) { + if (empty($macro) === false) { + $queryFields[] = $macro; + } + } + } + + // Generate the string with fields to perform the query. + $queryFieldsStr = implode(',', $queryFields); + + // Where statement. + if (($filterType === 'scan' || $filterType === 'execution') + && empty($queryFilters[$filterType]) === false + ) { + $queryWhere = ' WHERE '; + $queryWhere .= $queryFilters[$filterType]; + } else { + $queryWhere = ' '; + } + + if ($onlyQuery === true) { + // Set up the execute command. + $executeCommand = sprintf( + 'SELECT %s FROM %s%s', + $queryFieldsStr, + $queryClass, + $queryWhere + ); + } else { + // Set up the execute command. + $executeCommand = sprintf( + '%s \'SELECT %s FROM %s%s\'', + $this->wmiCommand, + $queryFieldsStr, + $queryClass, + $queryWhere + ); + } + + return $executeCommand; } /** * Generate the JS needed for use inside * - * @return void + * @return mixed */ private function loadJS() { @@ -633,49 +4624,78 @@ class AgentWizard extends HTML ob_start(); ?> @@ -779,4 +4905,6 @@ class AgentWizard extends HTML echo $str; return $str; } -} \ No newline at end of file + + +} diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 2c7ae0253f..f0f9b28bba 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -226,6 +226,19 @@ class ConsoleSupervisor * NOTIF.HAMASTER.MESSAGE */ $this->checkHaStatus(); + + /* + * Check if the Pandora Console log + * file remains in old location. + */ + $this->checkPandoraConsoleLogOldLocation(); + + /* + * Check if the audit log file + * remains in old location. + */ + $this->checkAuditLogOldLocation(); + } @@ -463,6 +476,17 @@ class ConsoleSupervisor $this->checkHaStatus(); } + /* + * Check if the audit log file + * remains in old location. + */ + $this->checkAuditLogOldLocation(); + + /* + Check if AllowOverride is None or All. + */ + $this->checkAllowOverrideEnabled(); + } @@ -1363,7 +1387,7 @@ class ConsoleSupervisor $this->cleanNotifications('NOTIF.PHP.INPUT_TIME'); } - if ($PHPmax_execution_time !== '0') { + if ((int) $PHPmax_execution_time !== 0) { $url = 'http://php.net/manual/en/info.configuration.php#ini.max-execution-time'; if ($config['language'] == 'es') { $url = 'http://php.net/manual/es/info.configuration.php#ini.max-execution-time'; @@ -2255,8 +2279,8 @@ class ConsoleSupervisor ui_get_full_url(false) ); $message_conf_cron .= ENTERPRISE_DIR.'/'.EXTENSIONS_DIR; - $message_conf_cron .= '/cron/cron.php >> '; - $message_conf_cron .= $config['homedir'].'/pandora_console.log'; + $message_conf_cron .= '/cron/cron.php >> '; + $message_conf_cron .= $config['homedir'].'/log/cron.log'; } if (isset($config['cron_last_run']) === true) { @@ -2485,4 +2509,77 @@ class ConsoleSupervisor } + /* + * Check if Pandora console log file remains in old location. + * + * @return void + */ + public function checkPandoraConsoleLogOldLocation() + { + global $config; + + if (file_exists($config['homedir'].'/pandora_console.log')) { + $title_pandoraconsole_old_log = __( + 'Pandora FMS console log file changed location', + $config['homedir'] + ); + $message_pandoraconsole_old_log = __( + 'Pandora FMS console log file has been moved to new location %s/log. Currently you have an outdated and inoperative version of this file at %s. Please, consider deleting it.', + $config['homedir'], + $config['homedir'] + ); + + $url = 'https://wiki.pandorafms.com/index.php?title=Pandora:QuickGuides_EN:General_Quick_Guide#Solving_problems._Where_to_look_and_who_to_ask'; + if ($config['language'] == 'es') { + $url = 'https://wiki.pandorafms.com/index.php?title=Pandora:QuickGuides_ES:Guia_Rapida_General#Soluci.C3.B3n_de_problemas._D.C3.B3nde_mirar.2C_a_qui.C3.A9n_preguntar'; + } + + $this->notify( + [ + 'type' => 'NOTIF.PANDORACONSOLE.LOG.OLD', + 'title' => __($title_pandoraconsole_old_log), + 'message' => __($message_pandoraconsole_old_log), + 'url' => $url, + ] + ); + } else { + $this->cleanNotifications('NOTIF.PANDORACONSOLE.LOG.OLD'); + } + } + + + /** + * Check if audit log file remains in old location. + * + * @return void + */ + public function checkAuditLogOldLocation() + { + global $config; + + if (file_exists($config['homedir'].'/audit.log')) { + $title_audit_old_log = __( + 'Pandora FMS audit log file changed location', + $config['homedir'] + ); + $message_audit_old_log = __( + 'Pandora FMS audit log file has been moved to new location %s/log. Currently you have an outdated and inoperative version of this file at %s. Please, consider deleting it.', + $config['homedir'], + $config['homedir'] + ); + + $this->notify( + [ + 'type' => 'NOTIF.AUDIT.LOG.OLD', + 'title' => __($title_audit_old_log), + 'message' => __($message_audit_old_log), + 'url' => '#', + ] + ); + } else { + $this->cleanNotifications('NOTIF.AUDIT.LOG.OLD'); + } + } + + } diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index bcf36551d7..82bf0487e3 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -1008,7 +1008,7 @@ class Diagnostics extends Wizard $pathErrLogs = '/var/log/pandora/pandora_server.error'; $errors = $this->getLogInfo($pathErrLogs); - $pathConsoleLogs = $config['homedir'].'/pandora_console.log'; + $pathConsoleLogs = $config['homedir'].'/log/console.log'; $console = $this->getLogInfo($pathConsoleLogs); $result = [ @@ -2079,7 +2079,7 @@ class Diagnostics extends Wizard ], 'text' => [ ui_print_error_message(__('Invalid cron task'), '', true), - ui_print_success_message(__('Cron task generated'), '', true), + ui_print_success_message(__('Sending of information has been processed'), '', true), ], ]; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index abbb243e67..e34b0549d7 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC200623'; +$build_version = 'PC200701'; $pandora_version = 'v7.0NG.746'; // Do not overwrite default timezone set if defined. @@ -51,8 +51,6 @@ if ($develop_bypass != 1) { } ini_set('display_errors', 0); - ini_set('log_errors', 1); - ini_set('error_log', $config['homedir'].'/pandora_console.log'); } else { // Develop mode, show all notices and errors on Console (and log it) if (version_compare(PHP_VERSION, '5.3.0') >= 0) { @@ -62,8 +60,6 @@ if ($develop_bypass != 1) { } ini_set('display_errors', 1); - ini_set('log_errors', 1); - ini_set('error_log', $config['homedir'].'/pandora_console.log'); } // Check if mysqli is available diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 1217677bb5..677dac4743 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -50,7 +50,9 @@ define('EVENT_NO_VALIDATED', 3); define('AGENT_ENABLED', 0); define('AGENT_DISABLED', 1); - +// Module disabled status. +define('MODULE_ENABLED', 0); +define('MODULE_DISABLED', 1); // Error report codes. define('NOERR', 11111); @@ -347,6 +349,7 @@ define('MODULE_PREDICTION', 5); define('MODULE_WMI', 6); define('MODULE_WEB', 7); define('MODULE_WUX', 8); +define('MODULE_WIZARD', 9); // Type of Modules of Prediction. define('MODULE_PREDICTION_SERVICE', 2); @@ -674,3 +677,54 @@ define('W_CREATE_MODULE', 3); define('W_CREATE_ALERT', 4); define('W_CREATE_TASK', 5); define('WELCOME_FINISHED', -1); + +// Fixed tnetwork_component values. +define('MODULE_TYPE_NUMERIC', 1); +define('MODULE_TYPE_INCREMENTAL', 2); +define('MODULE_TYPE_BOOLEAN', 3); +define('MODULE_TYPE_ALPHANUMERIC', 4); +define('SCAN_TYPE_FIXED', 1); +define('SCAN_TYPE_DYNAMIC', 2); +define('EXECUTION_TYPE_NETWORK', 1); +define('EXECUTION_TYPE_PLUGIN', 2); + +// Id of component type. +define('COMPONENT_TYPE_NETWORK', 2); +define('COMPONENT_TYPE_PLUGIN', 4); +define('COMPONENT_TYPE_WMI', 6); +define('COMPONENT_TYPE_WIZARD', 9); + +// Wizard Internal Plugins. +define('PLUGIN_WIZARD_SNMP_MODULE', 1); +define('PLUGIN_WIZARD_SNMP_PROCESS', 2); +define('PLUGIN_WIZARD_WMI_MODULE', 3); + +// Module Types. +define('MODULE_TYPE_GENERIC_DATA', 1); +define('MODULE_TYPE_GENERIC_PROC', 2); +define('MODULE_TYPE_GENERIC_DATA_STRING', 3); +define('MODULE_TYPE_GENERIC_DATA_INC', 4); +define('MODULE_TYPE_GENERIC_DATA_INC_ABS', 5); +define('MODULE_TYPE_REMOTE_ICMP_PROC', 6); +define('MODULE_TYPE_REMOTE_ICMP', 7); +define('MODULE_TYPE_REMOTE_TCP', 8); +define('MODULE_TYPE_REMOTE_TCP_PROC', 9); +define('MODULE_TYPE_REMOTE_TCP_STRING', 10); +define('MODULE_TYPE_REMOTE_TCP_INC', 11); +define('MODULE_TYPE_REMOTE_SNMP', 15); +define('MODULE_TYPE_REMOTE_SNMP_INC', 16); +define('MODULE_TYPE_REMOTE_SNMP_STRING', 17); +define('MODULE_TYPE_REMOTE_SNMP_PROC', 18); +define('MODULE_TYPE_ASYNC_PROC', 21); +define('MODULE_TYPE_ASYNC_DATA', 22); +define('MODULE_TYPE_ASYNC_STRING', 23); +define('MODULE_TYPE_WEB_ANALYSIS', 25); +define('MODULE_TYPE_WEB_DATA', 30); +define('MODULE_TYPE_WEB_PROC', 31); +define('MODULE_TYPE_WEB_CONTENT_DATA', 32); +define('MODULE_TYPE_WEB_CONTENT_STRING', 33); +define('MODULE_TYPE_REMOTE_CMD', 34); +define('MODULE_TYPE_REMOTE_CMD_PROC', 35); +define('MODULE_TYPE_REMOTE_CMD_STRING', 36); +define('MODULE_TYPE_REMOTE_CMD_INC', 37); +define('MODULE_TYPE_KEEP_ALIVE', 100); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 1855997f11..f5d9cdc5e5 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -4011,7 +4011,7 @@ function generate_hash_to_api() * @param string Key to identify the profiler run. * @param string Way to display the result * "link" (default): Click into word "Performance" to display the profilling info. - * "console": Display with a message in pandora_console.log. + * "console": Display with a message in console.log. */ function pandora_xhprof_display_result($key='', $method='link') { diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 6c1bcbc331..7f3183f91c 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1631,8 +1631,10 @@ function agents_get_alias($id_agent, $case='none') } // Check cache. - if (isset($cache[$case][$id_agent])) { - return $cache[$case][$id_agent]; + if (!is_metaconsole()) { + if (isset($cache[$case][$id_agent])) { + return $cache[$case][$id_agent]; + } } $alias = (string) db_get_value( @@ -1656,7 +1658,61 @@ function agents_get_alias($id_agent, $case='none') break; } - $cache[$case][$id_agent] = $alias; + if (!is_metaconsole()) { + $cache[$case][$id_agent] = $alias; + } + + return $alias; +} + + +/** + * Get alias of an agent in metaconsole (cached function). + * + * @param integer $id_agent Agent id. + * @param string $case Case (upper, lower, none). + * @param integer $id_server server id. + * + * @return string Alias of the given agent. + */ +function agents_get_alias_metaconsole($id_agent, $case='none', $id_server=false) +{ + global $config; + // Prepare cache. + static $cache = []; + if (empty($case)) { + $case = 'none'; + } + + // Check cache. + if (isset($cache[$case][$id_server][$id_agent])) { + return $cache[$case][$id_server][$id_agent]; + } + + $alias = (string) db_get_value_filter( + 'alias', + 'tmetaconsole_agent', + [ + 'id_tagente' => $id_agent, + 'id_tmetaconsole_setup' => $id_server, + ] + ); + + switch ($case) { + case 'upper': + $alias = mb_strtoupper($alias, 'UTF-8'); + break; + + case 'lower': + $alias = mb_strtolower($alias, 'UTF-8'); + break; + + default: + // Not posible. + break; + } + + $cache[$case][$id_server][$id_agent] = $alias; return $alias; } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index d045577f4e..bd25a0b555 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -10723,7 +10723,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db $data['type'] = 'array'; $data['data'] = $result; - // returnData($returnType, $data, $separator); + returnData($returnType, $data, $separator); if (empty($result)) { return false; } @@ -10840,6 +10840,8 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null) returnError('ERROR_API_PANDORAFMS', $returnType); } } + + return; } if ($other['type'] == 'string') { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 1938a220fe..e8fc2a392c 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -323,8 +323,12 @@ function config_update_config() $error_update[] = __('alias_as_name'); } - if (!config_update_value('auditdir', get_parameter('auditdir'))) { - $error_update[] = __('Audit log directory'); + if (!config_update_value('console_log_enabled', get_parameter('console_log_enabled'))) { + $error_update[] = __('Console log enabled'); + } + + if (!config_update_value('audit_log_enabled', get_parameter('audit_log_enabled'))) { + $error_update[] = __('Audit log enabled'); } if (!config_update_value('unique_ip', get_parameter('unique_ip'))) { @@ -1930,14 +1934,12 @@ function config_process_config() config_update_value('alias_as_name', 0); } - if (!isset($config['auditdir'])) { - $auditdir = '/var/www/html/pandora_console'; - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - // Windows. - $auditdir = $config['homedir']; - } + if (!isset($config['console_log_enabled'])) { + config_update_value('console_log_enabled', 0); + } - config_update_value('auditdir', $auditdir); + if (!isset($config['audit_log_enabled'])) { + config_update_value('audit_log_enabled', 0); } if (!isset($config['elasticsearch_ip'])) { diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index a99ab2e41e..7b4525b408 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -251,10 +251,8 @@ function db_pandora_audit($accion, $descripcion, $user_id=false, $ip=true, $info $valor = ''.$values['fecha'].' - '.io_safe_output($id).' - '.io_safe_output($accion).' - '.$ip.' - '.io_safe_output($descripcion)."\n"; - if (empty($config['auditdir'])) { - file_put_contents($config['homedir'].'/audit.log', $valor, FILE_APPEND); - } else { - file_put_contents($config['auditdir'].'/audit.log', $valor, FILE_APPEND); + if ($config['audit_log_enabled']) { + file_put_contents($config['homedir'].'/log/audit.log', $valor, FILE_APPEND); } enterprise_include_once('include/functions_audit.php'); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index e3afbb8ded..dc96a3b115 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1797,6 +1797,7 @@ function html_print_div($options, $return=false) 'id', 'style', 'class', + 'title', ]; if (isset($options['hidden'])) { @@ -2224,21 +2225,36 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $ * * The element will have an id like: "hidden-$name" * - * @param string $name Input name. - * @param string $value Input value. - * @param boolean $return Whether to return an output string or echo now (optional, echo by default). - * @param string $class Set the class of input. + * @param string $name Input name. + * @param string $value Input value. + * @param boolean $return Whether to return an output string or echo now + * (optional, echo by default). + * @param string $class Set the class of input. + * @param string $attributes String with the needed attributes to add. + * @param string $id Specific id. * * @return string HTML code if return parameter is true. */ -function html_print_input_hidden($name, $value, $return=false, $class=false) -{ +function html_print_input_hidden( + $name, + $value, + $return=false, + $class=false, + $attributes=false, + $id='' +) { if ($class !== false) { $classText = 'class="'.$class.'"'; } else { $classText = ''; } + if ($attributes !== false) { + $otherAttributes = $attributes; + } else { + $otherAttributes = ''; + } + $separator = '"'; if (is_string($value)) { @@ -2247,7 +2263,12 @@ function html_print_input_hidden($name, $value, $return=false, $class=false) } } - $output = ''; + $idInput = 'hidden-'.$name; + if (empty($id) === false) { + $idInput = $id; + } + + $output = ''; if ($return) { return $output; @@ -3042,34 +3063,53 @@ function html_print_checkbox( /** - * Render a checkbox button input switch type. Extended version, use html_print_checkbox_switch() to simplify. + * Render a checkbox button input switch type. + * Extended version, use html_print_checkbox_switch() to simplify. * - * @param string Input name. - * @param string Input value. - * @param string Set the button to be marked (optional, unmarked by default). - * @param bool Disable the button (optional, button enabled by default). - * @param string Script to execute when onClick event is triggered (optional). - * @param string Optional HTML attributes. It's a free string which will be - * @param bool Whether to return an output string or echo now (optional, echo by default). + * @param string $name Input name. + * @param integer $value Input value. + * @param integer $checked Input checked. + * @param boolean $disabled Disable the button (optional, + * button enabled by default). + * @param string $script Script to execute when onClick event + * is triggered (optional). + * @param string $attributes Optional HTML attributes. + * It's a free string which will be. + * @param boolean $return Whether to return an output string or echo now + * (optional, echo by default). + * @param string $id Input id. + * @param string $classParent Class for label. * - * @return string HTML code if return parameter is true. + * @return string Input html. */ - - -function html_print_checkbox_switch_extended($name, $value, $checked, $disabled, $script, $attributes, $return=false, $id='') -{ +function html_print_checkbox_switch_extended( + $name, + $value, + $checked, + $disabled=false, + $script='', + $attributes='', + $return=false, + $id='', + $classParent='' +) { static $idcounter = []; - // If duplicate names exist, it will start numbering. Otherwise it won't + // If duplicate names exist, it will start numbering. Otherwise it won't. if (isset($idcounter[$name])) { $idcounter[$name]++; } else { $idcounter[$name] = 0; } - $id_aux = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); + $id_aux = preg_replace( + '/[^a-z0-9\:\;\-\_]/i', + '', + $name.($idcounter[$name] ? $idcounter[$name] : '') + ); - $output = '