'30', 'descripcion' => '', 'max' => '0', 'min' => '0', 'snmp_oid' => '', 'snmp_community' => 'public', 'id_module_group' => $id_group, 'module_interval' => '300', 'module_ff_interval' => '0', 'ip_target' => '', 'tcp_port' => '0', 'tcp_rcv' => '', 'tcp_send' => '', 'id_export' => '0', 'plugin_user' => '', 'plugin_pass' => '0', 'plugin_parameter' => 'task_begin get '.$url_search.' resource 1 '.$str_search.' task_end', 'id_plugin' => '0', 'post_process' => '0', 'prediction_module' => '0', 'max_timeout' => '0', 'max_retries' => '0', 'disabled' => '', 'id_modulo' => '7', 'custom_id' => '', 'history_data' => '1', 'dynamic_interval' => '0', 'dynamic_max' => '0', 'dynamic_min' => '0', 'dynamic_two_tailed' => '0', 'parent_module_id' => '0', 'min_warning' => '0', 'max_warning' => '0', 'str_warning' => '', 'min_critical' => '0', 'max_critical' => '0', 'str_critical' => '', 'custom_string_1' => '', 'custom_string_2' => '', 'custom_string_3' => '', 'custom_integer_1' => '0', 'custom_integer_2' => '0', 'min_ff_event' => '0', 'min_ff_event_normal' => '0', 'min_ff_event_warning' => '0', 'min_ff_event_critical' => '0', 'ff_type' => '0', 'each_ff' => '0', 'ff_timeout' => '0', 'unit' => '', 'macros' => '', 'quiet' => '0', 'cps' => '0', 'critical_instructions' => '', 'warning_instructions' => '', 'unknown_instructions' => '', 'critical_inverse' => '0', 'warning_inverse' => '0', 'percentage_critical' => '0', 'percentage_warning' => '0', 'cron_interval' => '* * * * *', 'id_category' => '0', 'disabled_types_event' => '{\"going_unknown\":0}', 'module_macros' => 'W10=', 'warning_time' => '0', ]; return modules_create_agent_module($id_agent, $module_name.'_latency', $array_values); } /** * Create_module_status_goliat and return module id. * * @param mixed $id_agent Id agent. * @param mixed $module_name Module name. * @param mixed $id_group Id group. * @param mixed $url_search Url to search. * @param mixed $string_search Text to search. * * @return interger Module id. */ function create_module_status_goliat($id_agent, $module_name, $id_group, $url_search, $string_search='') { if ($string_search !== '') { $str_search = 'check_string '.$string_search.' '; } include_once 'include/functions_modules.php'; $array_values = [ 'id_tipo_modulo' => '31', 'descripcion' => '', 'max' => '0', 'min' => '0', 'snmp_oid' => '', 'snmp_community' => 'public', 'id_module_group' => $id_group, 'module_interval' => '300', 'module_ff_interval' => '0', 'ip_target' => '', 'tcp_port' => '0', 'tcp_rcv' => '', 'tcp_send' => '', 'id_export' => '0', 'plugin_user' => '', 'plugin_pass' => '0', 'plugin_parameter' => 'task_begin get '.$url_search.' resource 1 '.$str_search.' task_end', 'id_plugin' => '0', 'post_process' => '0', 'prediction_module' => '0', 'max_timeout' => '0', 'max_retries' => '0', 'disabled' => '', 'id_modulo' => '7', 'custom_id' => '', 'history_data' => '1', 'dynamic_interval' => '0', 'dynamic_max' => '0', 'dynamic_min' => '0', 'dynamic_two_tailed' => '0', 'parent_module_id' => '0', 'min_warning' => '0', 'max_warning' => '0', 'str_warning' => '', 'min_critical' => '0', 'max_critical' => '0', 'str_critical' => '', 'custom_string_1' => '', 'custom_string_2' => '', 'custom_string_3' => '', 'custom_integer_1' => '0', 'custom_integer_2' => '0', 'min_ff_event' => '0', 'min_ff_event_normal' => '0', 'min_ff_event_warning' => '0', 'min_ff_event_critical' => '0', 'ff_type' => '0', 'each_ff' => '0', 'ff_timeout' => '0', 'unit' => '', 'macros' => '', 'quiet' => '0', 'cps' => '0', 'critical_instructions' => '', 'warning_instructions' => '', 'unknown_instructions' => '', 'critical_inverse' => '0', 'warning_inverse' => '0', 'percentage_critical' => '0', 'percentage_warning' => '0', 'cron_interval' => '* * * * *', 'id_category' => '0', 'disabled_types_event' => '{\"going_unknown\":0}', 'module_macros' => 'W10=', 'warning_time' => '0', ]; return modules_create_agent_module($id_agent, $module_name.'_status', $array_values); } /** * Create module basic network and return module id. * * @param mixed $id_agent Id agent. * @param mixed $id_group Id group. * @param mixed $ip_target Ip target. * * @return interger Module id. */ function create_module_basic_network($id_agent, $id_group, $ip_target) { include_once 'include/functions_modules.php'; $array_values = [ 'id_tipo_modulo' => '6', 'descripcion' => 'Basic network check (ping)', 'max' => '0', 'min' => '0', 'snmp_oid' => '', 'snmp_community' => 'public', 'id_module_group' => $id_group, 'module_interval' => '300', 'module_ff_interval' => '0', 'ip_target' => $ip_target, 'tcp_port' => '0', 'tcp_rcv' => '', 'tcp_send' => '', 'id_export' => '0', 'plugin_user' => '', 'plugin_pass' => '0', 'plugin_parameter' => '', 'id_plugin' => '0', 'post_process' => '0', 'prediction_module' => '0', 'max_timeout' => '0', 'max_retries' => '0', 'disabled' => '', 'id_modulo' => '2', 'custom_id' => '', 'history_data' => '1', 'dynamic_interval' => '0', 'dynamic_max' => '0', 'dynamic_min' => '0', 'dynamic_two_tailed' => '0', 'parent_module_id' => '0', 'min_warning' => '0', 'max_warning' => '0', 'str_warning' => '', 'min_critical' => '0', 'max_critical' => '0', 'str_critical' => '', 'custom_string_1' => '', 'custom_string_2' => '', 'custom_string_3' => '', 'custom_integer_1' => '0', 'custom_integer_2' => '0', 'min_ff_event' => '0', 'min_ff_event_normal' => '0', 'min_ff_event_warning' => '0', 'min_ff_event_critical' => '0', 'ff_type' => '0', 'each_ff' => '0', 'ff_timeout' => '0', 'unit' => '', 'macros' => '', 'quiet' => '0', 'cps' => '0', 'critical_instructions' => '', 'warning_instructions' => '', 'unknown_instructions' => '', 'critical_inverse' => '0', 'warning_inverse' => '0', 'percentage_critical' => '0', 'percentage_warning' => '0', 'cron_interval' => '* * * * *', 'id_category' => '0', 'disabled_types_event' => '{\"going_unknown\":0}', 'module_macros' => 'W10=', 'warning_time' => '0', ]; return modules_create_agent_module($id_agent, 'Basic_Network_Check', $array_values); } /** * Create module latency network and return module id. * * @param mixed $id_agent Id agent. * @param mixed $id_group Id group. * @param mixed $ip_target Ip target. * * @return interger Module id. */ function create_module_latency_network($id_agent, $id_group, $ip_target) { include_once 'include/functions_modules.php'; $array_values = [ 'id_tipo_modulo' => '7', 'descripcion' => 'Basic network connectivity check to measure network latency in miliseconds', 'max' => '0', 'min' => '0', 'snmp_oid' => '', 'snmp_community' => 'public', 'id_module_group' => $id_group, 'module_interval' => '300', 'module_ff_interval' => '0', 'ip_target' => $ip_target, 'tcp_port' => '0', 'tcp_rcv' => '', 'tcp_send' => '', 'id_export' => '0', 'plugin_user' => '', 'plugin_pass' => '0', 'plugin_parameter' => '', 'id_plugin' => '0', 'post_process' => '0', 'prediction_module' => '0', 'max_timeout' => '0', 'max_retries' => '0', 'disabled' => '', 'id_modulo' => '2', 'custom_id' => '', 'history_data' => '1', 'dynamic_interval' => '0', 'dynamic_max' => '0', 'dynamic_min' => '0', 'dynamic_two_tailed' => '1', 'parent_module_id' => '0', 'min_warning' => '0', 'max_warning' => '0', 'str_warning' => '', 'min_critical' => '0', 'max_critical' => '0', 'str_critical' => '', 'custom_string_1' => '', 'custom_string_2' => '', 'custom_string_3' => '', 'custom_integer_1' => '0', 'custom_integer_2' => '0', 'min_ff_event' => '0', 'min_ff_event_normal' => '0', 'min_ff_event_warning' => '0', 'min_ff_event_critical' => '0', 'ff_type' => '0', 'each_ff' => '0', 'ff_timeout' => '0', 'unit' => '', 'macros' => '', 'quiet' => '0', 'cps' => '0', 'critical_instructions' => '', 'warning_instructions' => '', 'unknown_instructions' => '', 'critical_inverse' => '0', 'warning_inverse' => '0', 'percentage_critical' => '0', 'percentage_warning' => '0', 'cron_interval' => '* * * * *', 'id_category' => '0', 'disabled_types_event' => '{\"going_unknown\":0}', 'module_macros' => 'W10=', 'warning_time' => '0', ]; return modules_create_agent_module($id_agent, 'Basic_Network_Latency', $array_values); } /** * Create module packet lost and return module id. * * @param mixed $id_agent Id agent. * @param mixed $id_group Id group. * @param mixed $ip_target Ip target. * * @return interger Module id. */ function create_module_packet_lost($id_agent, $id_group, $ip_target) { include_once 'include/functions_modules.php'; $array_values = [ 'id_tipo_modulo' => '1', 'descripcion' => 'Basic network connectivity check to measure packet loss in %', 'max' => '0', 'min' => '0', 'snmp_oid' => '', 'snmp_community' => 'public', 'id_module_group' => $id_group, 'module_interval' => '300', 'module_ff_interval' => '0', 'ip_target' => '', 'tcp_port' => '0', 'tcp_rcv' => '', 'tcp_send' => '', 'id_export' => '0', 'plugin_user' => '', 'plugin_pass' => '0', 'plugin_parameter' => '', 'id_plugin' => '9', 'post_process' => '0', 'prediction_module' => '0', 'max_timeout' => '0', 'max_retries' => '0', 'disabled' => '', 'id_modulo' => '4', 'custom_id' => '', 'history_data' => '1', 'dynamic_interval' => '0', 'dynamic_max' => '0', 'dynamic_min' => '0', 'dynamic_two_tailed' => '1', 'parent_module_id' => '0', 'min_warning' => '0', 'max_warning' => '0', 'str_warning' => '', 'min_critical' => '0', 'max_critical' => '0', 'str_critical' => '', 'custom_string_1' => '', 'custom_string_2' => '', 'custom_string_3' => '', 'custom_integer_1' => '0', 'custom_integer_2' => '0', 'min_ff_event' => '0', 'min_ff_event_normal' => '0', 'min_ff_event_warning' => '0', 'min_ff_event_critical' => '0', 'ff_type' => '0', 'each_ff' => '0', 'ff_timeout' => '0', 'unit' => '', 'macros' => '{"1":{"macro":"_field1_","desc":"Test time","help":"","value":"8","hide":""},"2":{"macro":"_field2_","desc":"Target IP","help":"","value":"'.$ip_target.'","hide":""}}', 'quiet' => '0', 'cps' => '0', 'critical_instructions' => '', 'warning_instructions' => '', 'unknown_instructions' => '', 'critical_inverse' => '0', 'warning_inverse' => '0', 'percentage_critical' => '0', 'percentage_warning' => '0', 'cron_interval' => '* * * * *', 'id_category' => '0', 'disabled_types_event' => '{\"going_unknown\":0}', 'module_macros' => 'W10=', 'warning_time' => '0', ]; return modules_create_agent_module($id_agent, 'Basic_Network_Packetloss', $array_values); } /** * Create module packet lost and return module id. * * @param string $ip_target Ip and red mask. * * @return interger Module id. */ function create_net_scan($ip_target) { global $config; include_once $config['homedir'].'/godmode/wizards/HostDevices.class.php'; $HostDevices = new HostDevices(1); $id_recon_server = db_get_row_filter('tserver', ['server_type' => SERVER_TYPE_DISCOVERY], 'id_server')['id_server']; $_POST = [ 'page' => '1', 'interval_manual_defined' => '1', 'interval_select' => '-1', 'interval_text' => '0', 'interval' => '0', 'interval_units' => '1', 'taskname' => __('Basic network'), 'id_recon_server' => $id_recon_server, 'network' => $ip_target, 'id_group' => '8', 'comment' => __('Created on welcome'), ]; $task_created = $HostDevices->parseNetScan(); if ($task_created === true) { $HostDevicesFinal = new HostDevices(2); $_POST = [ 'task' => $HostDevices->task['id_rt'], 'page' => '2', 'recon_ports' => '', 'auto_monitor' => 'on', 'id_network_profile' => ['0' => '2'], 'review_results' => 'on', 'review_limited' => '0', 'snmp_enabled' => 'on', 'snmp_version' => '1', 'snmp_skip_non_enabled_ifs' => 'on', 'community' => '', 'snmp_context' => '', 'snmp_auth_user' => '', 'snmp_security_level' => 'authNoPriv', 'snmp_auth_method' => 'MD5', 'snmp_auth_pass' => '', 'snmp_privacy_method' => 'AES', 'snmp_privacy_pass' => '', 'os_detect' => 'on', 'resolve_names' => 'on', 'parent_detection' => 'on', 'parent_recursion' => 'on', 'vlan_enabled' => 'on', ]; $task_final_created = $HostDevicesFinal->parseNetScan(); if ($task_final_created === true) { $net_scan_id = $HostDevices->task['id_rt']; unset($HostDevices, $HostDevicesFinal); return $net_scan_id; } } else { return 0; } } /** * Create new template unknown. * * @return boolean 1 correct create 0 bad create. */ function create_template_alert_unknown() { $name = io_safe_input(__('Unknown condition')); $type = 'critical'; $values = [ 'description' => __('This is a generic alert template to fire on UNKNOWN condition'), 'max_value' => 0, 'min_value' => 0, 'id_group' => 0, 'priority' => 4, 'wizard_level' => 'nowizard', 'time_threshold' => '300', 'min_alerts_reset_counter' => 1, 'schedule' => '{"monday":[{"start":"00:00:00","end":"00:00:00"}],"tuesday":[{"start":"00:00:00","end":"00:00:00"}],"wednesday":[{"start":"00:00:00","end":"00:00:00"}],"thursday":[{"start":"00:00:00","end":"00:00:00"}],"friday":[{"start":"00:00:00","end":"00:00:00"}],"saturday":[{"start":"00:00:00","end":"00:00:00"}],"sunday":[{"start":"00:00:00","end":"00:00:00"}]}', 'recovery_notify' => true, 'field2' => '[PANDORA] Alert for UNKNOWN status on _agent_ / _module_', 'field2_recovery' => '[PANDORA] Alert RECOVERED for UNKNOWN status on _agent_ / _module_', 'field3' => '

Automatic alert system


We have bad news for you, something is on UNKNOWN status!

Monitoring details

Data: _data_ (warning)

Agent: _agent_ _address_

Module: _module_ _moduledescription_

Timestamp: _timestamp_

This is a graph of latest 24hr data for this module

_modulegraph_24h_

Contact Us  |  Support  |  Docs

', 'field3_recovery' => '

Automatic alert system


We have good news for you, alert has been recovered

Monitoring details

Data: _data_ (normal)

Agent: _agent_ _address_

Module: _module_ _moduledescription_

Timestamp: _timestamp_

This is a graph of latest 24hr data for this module

_modulegraph_24h_

Contact Us  |  Support  |  Docs

', ]; $result = alerts_create_alert_template($name, $type, $values); return $result; }