2012-11-26 Junichi Satoh <junichi@rworks.jp>

* lib/PandoraFMS/Core.pm: Fixed unintended executions and wrong event
	messages in planned downtime.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7182 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2012-11-26 07:27:25 +00:00
parent a48e81bc44
commit 1f3a911045
2 changed files with 20 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2012-11-26 Junichi Satoh <junichi@rworks.jp>
* lib/PandoraFMS/Core.pm: Fixed unintended executions and wrong event
messages in planned downtime.
2012-11-15 Sergio Martin <sergio.martin@artica.es> 2012-11-15 Sergio Martin <sergio.martin@artica.es>
* lib/PandoraFMS/Core.pm * lib/PandoraFMS/Core.pm

View File

@ -1162,7 +1162,7 @@ sub pandora_planned_downtime_disabled_once_stop($$) {
SET executed = 0 SET executed = 0
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, 'Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . $downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); pandora_event ($pa_config, 'Server ' . $pa_config->{'servername'} . ' stopped planned downtime: ' . $downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_unset_disabled_elements($pa_config, pandora_planned_downtime_unset_disabled_elements($pa_config,
$dbh, $downtime); $dbh, $downtime);
@ -1202,7 +1202,7 @@ sub pandora_planned_downtime_disabled_once_start($$) {
SET executed = 1 SET executed = 1
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_set_disabled_elements($pa_config, pandora_planned_downtime_set_disabled_elements($pa_config,
$dbh, $downtime); $dbh, $downtime);
@ -1398,7 +1398,7 @@ sub pandora_planned_downtime_quiet_once_stop($$) {
SET executed = 0 SET executed = 0
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); "Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_unset_quiet_elements($pa_config, pandora_planned_downtime_unset_quiet_elements($pa_config,
$dbh, $downtime->{'id'}); $dbh, $downtime->{'id'});
@ -1438,7 +1438,7 @@ sub pandora_planned_downtime_quiet_once_start($$) {
SET executed = 1 SET executed = 1
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
pandora_planned_downtime_set_quiet_elements($pa_config, pandora_planned_downtime_set_quiet_elements($pa_config,
$dbh, $downtime->{'id'}); $dbh, $downtime->{'id'});
@ -1473,7 +1473,9 @@ sub pandora_planned_downtime_monthly_start($$) {
FROM tplanned_downtime FROM tplanned_downtime
WHERE type_periodicity="monthly" WHERE type_periodicity="monthly"
AND executed = 0 AND executed = 0
AND periodically_day_from <= ?', $number_day_month); AND periodically_day_from <= ?
AND periodically_day_to >= ?',
$number_day_month, $number_day_month);
foreach my $downtime (@downtimes) { foreach my $downtime (@downtimes) {
#Convert to identical type. #Convert to identical type.
@ -1503,7 +1505,7 @@ sub pandora_planned_downtime_monthly_start($$) {
SET executed = 1 SET executed = 1
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} == "quiet") { if ($downtime->{'type_downtime'} == "quiet") {
pandora_planned_downtime_set_quiet_elements($pa_config, pandora_planned_downtime_set_quiet_elements($pa_config,
@ -1591,7 +1593,7 @@ sub pandora_planned_downtime_monthly_stop($$) {
SET executed = 0 SET executed = 0
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); "Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} == "quiet") { if ($downtime->{'type_downtime'} == "quiet") {
pandora_planned_downtime_unset_quiet_elements($pa_config, pandora_planned_downtime_unset_quiet_elements($pa_config,
@ -1677,8 +1679,10 @@ sub pandora_planned_downtime_weekly_start($$) {
# "%H:%M:%S"); # "%H:%M:%S");
# #
#if ($date_now_time >= $date_downtime) { #if ($date_now_time >= $date_downtime) {
if (($time gt $downtime->{'periodically_time_from'}) if ((($time gt $downtime->{'periodically_time_from'})
|| ($time eq $downtime->{'periodically_time_from'})) { || ($time eq $downtime->{'periodically_time_from'}))
&& (($time lt $downtime->{'periodically_time_to'})
|| ($time eq $downtime->{'periodically_time_to'}))) {
if (!defined($downtime->{'description'})) { if (!defined($downtime->{'description'})) {
$downtime->{'description'} = "N/A"; $downtime->{'description'} = "N/A";
} }
@ -1693,7 +1697,7 @@ sub pandora_planned_downtime_weekly_start($$) {
SET executed = 1 SET executed = 1
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); "Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} == "quiet") { if ($downtime->{'type_downtime'} == "quiet") {
pandora_planned_downtime_set_quiet_elements($pa_config, pandora_planned_downtime_set_quiet_elements($pa_config,
@ -1767,7 +1771,7 @@ sub pandora_planned_downtime_weekly_stop($$) {
SET executed = 0 SET executed = 0
WHERE id = ?', $downtime->{'id'}); WHERE id = ?', $downtime->{'id'});
pandora_event ($pa_config, pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".$downtime->{'description'}, 0, 0, 1, 0, 0, 'system', 0, $dbh); "Server ".$pa_config->{'servername'}." stopped planned downtime: ".$downtime->{'name'}, 0, 0, 1, 0, 0, 'system', 0, $dbh);
if ($downtime->{'type_downtime'} == "quiet") { if ($downtime->{'type_downtime'} == "quiet") {
pandora_planned_downtime_unset_quiet_elements($pa_config, pandora_planned_downtime_unset_quiet_elements($pa_config,