Fixes for oracle

This commit is contained in:
Alejandro Gallardo Escobar 2015-06-16 15:07:06 +02:00
parent 72ee6158fa
commit c437797ef7
3 changed files with 36 additions and 14 deletions

View File

@ -48,7 +48,16 @@ $snmpwalk = (int) get_parameter("snmpwalk", 0);
$create_modules = (int) get_parameter("create_modules", 0);
// Get the plugin
$plugin = db_get_row_sql("SELECT * FROM tplugin WHERE execute LIKE '%/snmp_remote.pl'");
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$plugin = db_get_row_sql("SELECT id, macros FROM tplugin WHERE execute LIKE '%/snmp_remote.pl'");
break;
case 'oracle':
$plugin = db_get_row_sql("SELECT id, TO_CHAR(macros) AS macros FROM tplugin WHERE execute LIKE '%/snmp_remote.pl'");
break;
}
if (empty($plugin)) {
ui_print_info_message(array('message' => __('The SNMP remote plugin doesnt seem to be installed') . '. ' . __('It is necessary to use some features') . '.<br><br>' . __('Please, install the SNMP remote plugin (The name of the plugin must be snmp_remote.pl)'), 'no_close' => true));
@ -465,7 +474,10 @@ if ($create_modules) {
$module_values['id_modulo'] = MODULE_PLUGIN;
$module_values['id_plugin'] = $plugin['id'];
$macros = json_decode($plugin['macros'], true);
// Avoid the return of a string containing the word 'null' if the macros column is not defined
$macros = array();
if (isset($plugin['macros']) && !empty($plugin['macros']))
$macros = json_decode($plugin['macros'], true);
foreach ($macros as $k => $macro) {
switch($macro['macro']) {
@ -518,7 +530,8 @@ if ($create_modules) {
}
}
$module_values['macros'] = io_json_mb_encode($macros);
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
@ -545,7 +558,10 @@ if ($create_modules) {
$module_values['id_modulo'] = MODULE_PLUGIN;
$module_values['id_plugin'] = $plugin['id'];
$macros = json_decode($plugin['macros'], true);
// Avoid the return of a string containing the word 'null' if the macros column is not defined
$macros = array();
if (isset($plugin['macros']) && !empty($plugin['macros']))
$macros = json_decode($plugin['macros'], true);
foreach ($macros as $k => $macro) {
switch($macro['macro']) {
@ -591,7 +607,8 @@ if ($create_modules) {
}
}
$module_values['macros'] = io_json_mb_encode($macros);
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
@ -612,7 +629,10 @@ if ($create_modules) {
$module_values['id_modulo'] = MODULE_PLUGIN;
$module_values['id_plugin'] = $plugin['id'];
$macros = json_decode($plugin['macros'], true);
// Avoid the return of a string containing the word 'null' if the macros column is not defined
$macros = array();
if (isset($plugin['macros']) && !empty($plugin['macros']))
$macros = json_decode($plugin['macros'], true);
foreach ($macros as $k => $macro) {
switch($macro['macro']) {
@ -657,7 +677,8 @@ if ($create_modules) {
}
}
$module_values['macros'] = io_json_mb_encode($macros);
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

View File

@ -1220,7 +1220,7 @@ LOCK TABLE talert_templates IN EXCLUSIVE MODE;
EXECUTE IMMEDIATE 'ALTER TRIGGER talert_templates_inc DISABLE';
INSERT INTO talert_templates (id, name, description, id_alert_action, field1, field2, field3, type, value, matches_value, max_value, min_value, time_threshold, max_alerts, min_alerts, time_from, time_to, monday, tuesday, wednesday, thursday, friday, saturday, sunday, recovery_notify, field2_recovery, field3_recovery, priority, id_group, special_day, wizard_level) VALUES (1,'Critical&#x20;condition','This is a generic alert template to fire on condition CRITICAL',1,'','','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been fired because a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n','critical','',1,0.00,0.00,86400,1,0,to_date('12:00:00','hh24:mi:ss'),to_date('12:00:00','hh24:mi:ss'),1,1,1,1,1,1,1,1,'[PANDORA] Alert RECOVERED for CRITICAL status on _agent_ / _module_','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been RECOVERED from a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n',4,0,0,'basic');
INSERT INTO talert_templates (id, name, description, id_alert_action, field1, field2, field3, type, value, matches_value, max_value, min_value, time_threshold, max_alerts, min_alerts, time_from, time_to, monday, tuesday, wednesday, thursday, friday, saturday, sunday, recovery_notify, field2_recovery, field3_recovery, priority, id_group, special_day, wizard_level) VALUES (2,'Manual&#x20;alert','This is a template used to fire manual alerts, condition defined here never will be executed. Use this template to assign to your actions/commands used to do remote management (Agent restart, execute commands on server, etc).',NULL,'','',' ','max_min','',1,0.00,1.00,86400,1,0,to_date('12:00:00','hh24:mi:ss'),to_date('12:00:00','hh24:mi:ss'),1,1,1,1,1,1,1,0,' ',' ',1,0,0,'basic');
INSERT INTO talert_templates (id, name, description, id_alert_action, field1, field2, field3, type, value, matches_value, max_value, min_value, time_threshold, max_alerts, min_alerts, time_from, time_to, monday, tuesday, wednesday, thursday, friday, saturday, sunday, recovery_notify, field2_recovery, field3_recovery, priority, id_group, special_day, wizard_level) VALUES (2,'Manual&#x20;alert','This is a template used to fire manual alerts, condition defined here never will be executed. Use this template to assign to your actions/commands used to do remote management (Agent restart, execute commands on server, etc).',NULL,'','','','max_min','',1,0.00,1.00,86400,1,0,to_date('12:00:00','hh24:mi:ss'),to_date('12:00:00','hh24:mi:ss'),1,1,1,1,1,1,1,0,'','',1,0,0,'basic');
INSERT INTO talert_templates (id, name, description, id_alert_action, field1, field2, field3, type, value, matches_value, max_value, min_value, time_threshold, max_alerts, min_alerts, time_from, time_to, monday, tuesday, wednesday, thursday, friday, saturday, sunday, recovery_notify, field2_recovery, field3_recovery, priority, id_group, special_day, wizard_level) VALUES (3,'Warning&#x20;condition','This&#x20;is&#x20;a&#x20;generic&#x20;alert&#x20;template&#x20;to&#x20;fire&#x20;on&#x20;WARNING&#x20;condition.',1,'','','Hello,&#x20;this&#x20;is&#x20;an&#x20;automated&#x20;email&#x20;coming&#x20;from&#x20;Pandora&#x20;FMS&#x0d;&#x0a;&#x0d;&#x0a;This&#x20;alert&#x20;has&#x20;been&#x20;fired&#x20;because&#x20;a&#x20;WARNING&#x20;condition&#x20;in&#x20;one&#x20;of&#x20;your&#x20;monitored&#x20;items:&#x0d;&#x0a;&#x0d;&#x0a;Agent&#x20;:&#x20;_agent_&#x0d;&#x0a;Module:&#x20;_module_&#x0d;&#x0a;Module&#x20;description:&#x20;_moduledescription_&#x0d;&#x0a;Timestamp&#x20;_timestamp_&#x0d;&#x0a;Current&#x20;value:&#x20;_data_&#x0d;&#x0a;&#x0d;&#x0a;Thanks&#x20;for&#x20;your&#x20;time.&#x0d;&#x0a;&#x0d;&#x0a;Best&#x20;regards&#x0d;&#x0a;Pandora&#x20;FMS&#x0d;&#x0a;','warning','',1,0.00,0.00,86400,1,0,to_date('12:00:00','hh24:mi:ss'),to_date('12:00:00','hh24:mi:ss'),1,1,1,1,1,1,1,1,'[PANDORA]&#x20;Alert&#x20;RECOVERED&#x20;for&#x20;WARNING&#x20;status&#x20;on&#x20;_agent_&#x20;/&#x20;_module_','Hello,&#x20;this&#x20;is&#x20;an&#x20;automated&#x20;email&#x20;coming&#x20;from&#x20;Pandora&#x20;FMS&#x0d;&#x0a;&#x0d;&#x0a;This&#x20;alert&#x20;has&#x20;been&#x20;RECOVERED&#x20;from&#x20;a&#x20;WARNING&#x20;condition&#x20;in&#x20;one&#x20;of&#x20;your&#x20;monitored&#x20;items:&#x0d;&#x0a;&#x0d;&#x0a;Agent&#x20;:&#x20;_agent_&#x0d;&#x0a;Module:&#x20;_module_&#x0d;&#x0a;Module&#x20;description:&#x20;_moduledescription_&#x0d;&#x0a;Timestamp&#x20;_timestamp_&#x0d;&#x0a;Current&#x20;value:&#x20;_data_&#x0d;&#x0a;&#x0d;&#x0a;Thanks&#x20;for&#x20;your&#x20;time.&#x0d;&#x0a;&#x0d;&#x0a;Best&#x20;regards&#x0d;&#x0a;Pandora&#x20;FMS&#x0d;&#x0a;',3,0,0,'basic');
-- Update curr val of sequence
@ -1334,12 +1334,12 @@ LOCK TABLE tplugin IN EXCLUSIVE MODE;
EXECUTE IMMEDIATE 'ALTER TRIGGER tplugin_inc DISABLE';
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (1,'IPMI&#x20;Plugin','Plugin&#x20;to&#x20;get&#x20;IPMI&#x20;monitors&#x20;from&#x20;a&#x20;IPMI&#x20;Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:"","hide":""},2:{macro:"_field2_",desc:Username,help:"",value:"","hide":""},3:{macro:"_field3_",desc:Password,help:"",value:"","hide":""},"4":{"macro":"_field4_","desc":"Sensor","help":"","value":"","hide":""},"5":{"macro":"_field5_","desc":"Additional&#x20;Options","help":"","value":"","hide":""}}','-h&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-s&#x20;_field4_&#x20;--&#x20;_field5_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (2,'DNS&#x20;Plugin','This&#x20;plugin&#x20;is&#x20;used&#x20;to&#x20;check&#x20;if&#x20;a&#x20;specific&#x20;domain&#x20;return&#x20;a&#x20;specific&#x20;IP&#x20;address,&#x20;and&#x20;to&#x20;check&#x20;how&#x20;time&#x20;&#40;milisecs&#41;&#x20;takes&#x20;the&#x20;DNS&#x20;to&#x20;answer.&#x20;Use&#x20;IP&#x20;address&#x20;parameter&#x20;to&#x20;specify&#x20;the&#x20;IP&#x20;of&#x20;your&#x20;domain.&#x20;Use&#x20;these&#x20;custom&#x20;parameters&#x20;for&#x20;the&#x20;other&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-d&#x20;domain&#x20;to&#x20;check&#x20;&#40;for&#x20;example&#x20;pandorafms.com&#41;&#x0d;&#x0a;-s&#x20;DNS&#x20;Server&#x20;to&#x20;check&#x20;&#x20;&#40;for&#x20;example&#x20;8.8.8.8&#41;&#x0d;&#x0a;&#x0d;&#x0a;Optional&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-t&#x20;Do&#x20;a&#x20;DNS&#x20;time&#x20;response&#x20;check&#x20;instead&#x20;DNS&#x20;resolve&#x20;test&#x0d;&#x0a;&#x0d;&#x0a;',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:""},2:{macro:"_field2_",desc:Domain&#x20;to&#x20;check,help:For&#x20;example&#x20;pandorafms.com,value:""},3:{macro:"_field3_",desc:DNS&#x20;Server&#x20;to&#x20;check,help:For&#x20;example&#x20;8.8.8.8,value:""},4:{macro:"_field4_",desc:Optional&#x20;parameters,help:"",value:""}}','-i&#x20;_field1_&#x20;-d&#x20;_field2_&#x20;-s&#x20;_field3_&#x20;_field4_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (3,'UDP&#x20;port&#x20;check','Check&#x20;a&#x20;remote&#x20;UDP&#x20;port&#x20;&#40;by&#x20;using&#x20;NMAP&#41;.&#x20;Use&#x20;IP&#x20;address&#x20;and&#x20;Port&#x20;options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:""},2:{macro:"_field2_",desc:Port,help:"",value:""}}','-t&#x20;_field1_-p&#x20;_field2_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (4,'SMTP&#x20;Check','This&#x20;plugin&#x20;is&#x20;used&#x20;to&#x20;send&#x20;a&#x20;mail&#x20;to&#x20;a&#x20;SMTP&#x20;server&#x20;and&#x20;check&#x20;if&#x20;works.&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Parameters&#x20;in&#x20;the&#x20;plugin:&#x0d;&#x0a;&#x0d;&#x0a;IP&#x20;Address&#x20;-&#x20;SMTP&#x20;Server&#x20;IP&#x20;address&#x0d;&#x0a;User&#x20;-&#x20;AUTH&#x20;login&#x20;&#x20;&#x0d;&#x0a;Pass&#x20;-&#x20;AUTH&#x20;password&#x0d;&#x0a;Port&#x20;-&#x20;SMTP&#x20;port&#x20;&#40;optional&#41;&#x0d;&#x0a;&#x0d;&#x0a;Optional&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-d&#x20;Destination&#x20;email&#x0d;&#x0a;-f&#x20;Email&#x20;of&#x20;the&#x20;sender&#x0d;&#x0a;-a&#x20;Authentication&#x20;system.&#x20;Could&#x20;be&#x20;LOGIN,&#x20;PLAIN,&#x20;CRAM-MD5&#x20;or&#x20;DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:""},2:{macro:"_field2_",desc:Port,help:"",value:""},3:{macro:"_field3_",desc:Username,help:"",value:""},4:{macro:"_field4_",desc:Password,help:"",value:""},5:{macro:"_field5_",desc:Optional&#x20;parameters,help:"",value:""}}','-h&#x20;_field1_&#x20;-o&#x20;_field2_&#x20;-u&#x20;_field3_&#x20;-p&#x20;_field4_&#x20;_field5_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (6,'MySQL&#x20;Plugin','Samples:&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;none&#x20;-s&#x20;localhost&#x20;-q&#x20;Com_select&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;none&#x20;-s&#x20;localhost&#x20;-q&#x20;Com_update&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;none&#x20;-s&#x20;localhost&#x20;-q&#x20;Connections&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;anypass&#x20;-s&#x20;192.168.50.24&#x20;-q&#x20;Innodb_rows_read&#x0d;&#x0a;',15,'/usr/share/pandora_server/util/plugin/mysql_plugin.sh',0,'{1:{macro:"_field1_",desc:IP&#x20;address,help:IP&#x20;address,value:""},2:{macro:"_field2_",desc:Username,help:Username&#x20;to&#x20;access&#x20;to&#x20;database,value:""},3:{macro:"_field3_",desc:Password,help:Password&#x20;to&#x20;access&#x20;to&#x20;database,value:""},4:{macro:"_field4_",desc:Query&#x20;string,help:Query&#x20;string&#x20;of&#x20;global&#x20;status.&#x20;For&#x20;example&#x20;&#039;Aborted_connects&#039;&#x20;or&#x20;&#039;Innodb_rows_read&#039;",value:""}}', '-s&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-q&#x20;_field4_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (8,'SNMP&#x20;remote','Plugin&#x20;that&#x20;gets&#x20;remotely,&#x20;using&#x20;SNMP,&#x20;values&#x20;such&#x20;as&#x20;the&#x20;percentage&#x20;of&#x20;disk&#x20;or&#x20;memory&#x20;used,&#x20;the&#x20;status&#x20;of&#x20;a&#x20;process&#x20;or&#x20;the&#x20;CPU&#x20;load',0,'perl&#x20;/usr/share/pandora_server/util/plugin/snmp_remote.pl',0,'{1:{macro:"_field1_",desc:Target&#x20;IP,help:"",value:"_address_"},2:{macro:"_field2_",desc:Community,help:"",value:public},3:{macro:"_field3_",desc:Plug-in&#x20;Parameters,help:Memory&#x20;use&#x20;&#40;%&#41;&#x0d;&#x0a;-m&#x20;memuse&#x0d;&#x0a;&#x0d;&#x0a;Disk&#x20;use&#x20;&#40;%&#41;&#x0d;&#x0a;-m&#x20;diskuse&#x20;-d&#x20;[disk&#x20;name]&#x0d;&#x0a;&#x0d;&#x0a;Status&#x20;of&#x20;a&#x20;process&#x20;&#40;0/1&#41;&#x0d;&#x0a;-m&#x20;process&#x20;-p&#x20;[process_name]&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Average&#x20;of&#x20;CPUs&#x20;Load&#x20;&#40;%&#41;&#x0d;&#x0a;-m&#x20;cpuload,value:""}}', '-H&#x20;_field1_&#x20;-c&#x20;_field2_&#x20;_field3_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (1,'IPMI&#x20;Plugin','Plugin&#x20;to&#x20;get&#x20;IPMI&#x20;monitors&#x20;from&#x20;a&#x20;IPMI&#x20;Device.',0,'/usr/share/pandora_server/util/plugin/ipmi-plugin.pl',0,'{"1":{"macro":"_field1_","desc":"Target&#x20;IP","help":"","value":"","hide":""},"2":{"macro":"_field2_","desc":"Username","help":"","value":"","hide":""},"3":{"macro":"_field3_","desc":"Password","help":"","value":"","hide":""},"4":{"macro":"_field4_","desc":"Sensor","help":"","value":"","hide":""},"5":{"macro":"_field5_","desc":"Additional&#x20;Options","help":"","value":"","hide":""}}','-h&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-s&#x20;_field4_&#x20;--&#x20;_field5_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (2,'DNS&#x20;Plugin','This&#x20;plugin&#x20;is&#x20;used&#x20;to&#x20;check&#x20;if&#x20;a&#x20;specific&#x20;domain&#x20;return&#x20;a&#x20;specific&#x20;IP&#x20;address,&#x20;and&#x20;to&#x20;check&#x20;how&#x20;time&#x20;&#40;milisecs&#41;&#x20;takes&#x20;the&#x20;DNS&#x20;to&#x20;answer.&#x20;Use&#x20;IP&#x20;address&#x20;parameter&#x20;to&#x20;specify&#x20;the&#x20;IP&#x20;of&#x20;your&#x20;domain.&#x20;Use&#x20;these&#x20;custom&#x20;parameters&#x20;for&#x20;the&#x20;other&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-d&#x20;domain&#x20;to&#x20;check&#x20;&#40;for&#x20;example&#x20;pandorafms.com&#41;&#x0d;&#x0a;-s&#x20;DNS&#x20;Server&#x20;to&#x20;check&#x20;&#x20;&#40;for&#x20;example&#x20;8.8.8.8&#41;&#x0d;&#x0a;&#x0d;&#x0a;Optional&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-t&#x20;Do&#x20;a&#x20;DNS&#x20;time&#x20;response&#x20;check&#x20;instead&#x20;DNS&#x20;resolve&#x20;test&#x0d;&#x0a;&#x0d;&#x0a;',15,'/usr/share/pandora_server/util/plugin/dns_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target&#x20;IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Domain&#x20;to&#x20;check","help":"For&#x20;example&#x20;pandorafms.com","value":""},"3":{"macro":"_field3_","desc":"DNS&#x20;Server&#x20;to&#x20;check","help":"For&#x20;example&#x20;8.8.8.8","value":""},"4":{"macro":"_field4_","desc":"Optional&#x20;parameters","help":"","value":""}}','-i&#x20;_field1_&#x20;-d&#x20;_field2_&#x20;-s&#x20;_field3_&#x20;_field4_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (3,'UDP&#x20;port&#x20;check','Check&#x20;a&#x20;remote&#x20;UDP&#x20;port&#x20;&#40;by&#x20;using&#x20;NMAP&#41;.&#x20;Use&#x20;IP&#x20;address&#x20;and&#x20;Port&#x20;options.',5,'/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"Target&#x20;IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""}}','-t&#x20;_field1_-p&#x20;_field2_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (4,'SMTP&#x20;Check','This&#x20;plugin&#x20;is&#x20;used&#x20;to&#x20;send&#x20;a&#x20;mail&#x20;to&#x20;a&#x20;SMTP&#x20;server&#x20;and&#x20;check&#x20;if&#x20;works.&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Parameters&#x20;in&#x20;the&#x20;plugin:&#x0d;&#x0a;&#x0d;&#x0a;IP&#x20;Address&#x20;-&#x20;SMTP&#x20;Server&#x20;IP&#x20;address&#x0d;&#x0a;User&#x20;-&#x20;AUTH&#x20;login&#x20;&#x20;&#x0d;&#x0a;Pass&#x20;-&#x20;AUTH&#x20;password&#x0d;&#x0a;Port&#x20;-&#x20;SMTP&#x20;port&#x20;&#40;optional&#41;&#x0d;&#x0a;&#x0d;&#x0a;Optional&#x20;parameters:&#x0d;&#x0a;&#x0d;&#x0a;-d&#x20;Destination&#x20;email&#x0d;&#x0a;-f&#x20;Email&#x20;of&#x20;the&#x20;sender&#x0d;&#x0a;-a&#x20;Authentication&#x20;system.&#x20;Could&#x20;be&#x20;LOGIN,&#x20;PLAIN,&#x20;CRAM-MD5&#x20;or&#x20;DIGEST-MD',10,'/usr/share/pandora_server/util/plugin/SMTP_check.pl',0,'{"1":{"macro":"_field1_","desc":"Target&#x20;IP","help":"","value":""},"2":{"macro":"_field2_","desc":"Port","help":"","value":""},"3":{"macro":"_field3_","desc":"Username","help":"","value":""},"4":{"macro":"_field4_","desc":"Password","help":"","value":""},"5":{"macro":"_field5_","desc":"Optional&#x20;parameters","help":"","value":""}}','-h&#x20;_field1_&#x20;-o&#x20;_field2_&#x20;-u&#x20;_field3_&#x20;-p&#x20;_field4_&#x20;_field5_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (6,'MySQL&#x20;Plugin','Samples:&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;none&#x20;-s&#x20;localhost&#x20;-q&#x20;Com_select&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;none&#x20;-s&#x20;localhost&#x20;-q&#x20;Com_update&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;none&#x20;-s&#x20;localhost&#x20;-q&#x20;Connections&#x0d;&#x0a;&#x20;&#x20;&#x20;./mysql_plugin.sh&#x20;-u&#x20;root&#x20;-p&#x20;anypass&#x20;-s&#x20;192.168.50.24&#x20;-q&#x20;Innodb_rows_read&#x0d;&#x0a;',15,'/usr/share/pandora_server/util/plugin/mysql_plugin.sh',0,'{"1":{"macro":"_field1_","desc":"IP&#x20;address","help":"IP&#x20;address","value":""},"2":{"macro":"_field2_","desc":"Username","help":"Username&#x20;to&#x20;access&#x20;to&#x20;database","value":""},"3":{"macro":"_field3_","desc":"Password","help":"Password&#x20;to&#x20;access&#x20;to&#x20;database","value":""},"4":{"macro":"_field4_","desc":"Query&#x20;string","help":"Query&#x20;string&#x20;of&#x20;global&#x20;status.&#x20;For&#x20;example&#x20;&#039;Aborted_connects&#039;&#x20;or&#x20;&#039;Innodb_rows_read&#039;","value":""}}', '-s&#x20;_field1_&#x20;-u&#x20;_field2_&#x20;-p&#x20;_field3_&#x20;-q&#x20;_field4_');
INSERT INTO tplugin (id, name, description, max_timeout, execute, plugin_type, macros, parameters) VALUES (8,'SNMP&#x20;remote','Plugin&#x20;that&#x20;gets&#x20;remotely,&#x20;using&#x20;SNMP,&#x20;values&#x20;such&#x20;as&#x20;the&#x20;percentage&#x20;of&#x20;disk&#x20;or&#x20;memory&#x20;used,&#x20;the&#x20;status&#x20;of&#x20;a&#x20;process&#x20;or&#x20;the&#x20;CPU&#x20;load',0,'perl&#x20;/usr/share/pandora_server/util/plugin/snmp_remote.pl',0,'{"1":{"macro":"_field1_","desc":"Target&#x20;IP","help":"","value":"_address_"},"2":{"macro":"_field2_","desc":"Community","help":"","value":"public"},"3":{"macro":"_field3_","desc":"Plug-in&#x20;Parameters","help":"Memory&#x20;use&#x20;&#40;%&#41;&#x0d;&#x0a;-m&#x20;memuse&#x0d;&#x0a;&#x0d;&#x0a;Disk&#x20;use&#x20;&#40;%&#41;&#x0d;&#x0a;-m&#x20;diskuse&#x20;-d&#x20;[disk&#x20;name]&#x0d;&#x0a;&#x0d;&#x0a;Status&#x20;of&#x20;a&#x20;process&#x20;&#40;0/1&#41;&#x0d;&#x0a;-m&#x20;process&#x20;-p&#x20;[process_name]&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Average&#x20;of&#x20;CPUs&#x20;Load&#x20;&#40;%&#41;&#x0d;&#x0a;-m&#x20;cpuload","value":""}}', '-H&#x20;_field1_&#x20;-c&#x20;_field2_&#x20;_field3_');
-- Update curr val of sequence
update_currval('tplugin', 'id');

View File

@ -3002,6 +3002,7 @@ sub pandora_exec_forced_alerts {
FROM talert_template_modules, talert_templates
WHERE talert_template_modules.id_alert_template = talert_templates.id
AND force_execution = 1');
foreach my $alert (@alerts) {
# Get the agent and module associated with the alert