2014-08-12 Junichi Satoh <junichi@rworks.jp>

* lib/PandoraFMS/Core.pm, lib/PandoraFMS/DataServer.pm: Fixed sql
	error with MySQL 5.6 and its default sql_mode.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10400 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2014-08-12 01:07:29 +00:00
parent 0edbe523d2
commit fb0ed522f2
3 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2014-08-12 Junichi Satoh <junichi@rworks.jp>
* lib/PandoraFMS/Core.pm, lib/PandoraFMS/DataServer.pm: Fixed sql
error with MySQL 5.6 and its default sql_mode.
2014-08-11 Hirofumi Kosaka <kosaka@rworks.jp>
* lib/PandoraFMS/Core.pm: Fixed modules would have ignored

View File

@ -2341,11 +2341,11 @@ sub pandora_create_module ($$$$$$$$$$) {
}
my $module_id = db_insert($dbh, 'id_agente_modulo',
'INSERT INTO tagente_modulo (id_agente, id_tipo_modulo, nombre, max, min, post_process, descripcion, module_interval, id_modulo)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1)',
'INSERT INTO tagente_modulo (id_agente, id_tipo_modulo, nombre, max, min, post_process, descripcion, module_interval, id_modulo, critical_instructions, warning_instructions, unknown_instructions, disabled_types_event, module_macros)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1, \'\', \'\', \'\', \'\', \'\')',
$agent_id, $module_type_id, safe_input($module_name), $max, $min, $post_process, $description, $interval);
db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try)
VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\')',
db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try, datos)
VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\', \'\')',
$module_id, $agent_id, $status, $status, $status);
# Update the module status count. When the module is created disabled dont do it
@ -2466,7 +2466,7 @@ sub pandora_create_module_from_hash ($$$) {
$status = 0;
}
db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try) VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\')', $module_id, $parameters->{'id_agente'}, $status, $status, $status);
db_do ($dbh, 'INSERT INTO tagente_estado (id_agente_modulo, id_agente, estado, last_status, last_known_status, last_try, datos) VALUES (?, ?, ?, ?, ?, \'1970-01-01 00:00:00\', \'\')', $module_id, $parameters->{'id_agente'}, $status, $status, $status);
# Update the module status count. When the module is created disabled dont do it
pandora_mark_agent_for_module_update ($dbh, $parameters->{'id_agente'});

View File

@ -556,6 +556,13 @@ sub process_module_data ($$$$$$$$$) {
# Allow , as a decimal separator
$module_conf->{'post_process'} =~ s/,/./ if (defined ($module_conf->{'post_process'}));
# avoid NULL columns
$module_conf->{'critical_instructions'} = '' unless defined ($module_conf->{'critical_instructions'});
$module_conf->{'warning_instructions'} = '' unless defined ($module_conf->{'warning_instructions'});
$module_conf->{'unknown_instructions'} = '' unless defined ($module_conf->{'unknown_instructions'});
$module_conf->{'disabled_types_event'} = '' unless defined ($module_conf->{'disabled_types_event'});
$module_conf->{'module_macros'} = '' unless defined ($module_conf->{'module_macros'});
# Get module data or create it if it does not exist
$ModuleSem->down ();