From a6e3b2308a117c96b4deeee7e3ffb14d748c5e50 Mon Sep 17 00:00:00 2001 From: rems117 Date: Tue, 1 Sep 2020 10:03:57 +0300 Subject: [PATCH] pinghosts edit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - убрано количество попыток при переходе из статуса offline в online - добавлено соответствующее сообщение в шаблоне страницы редактирования устройства - немного изменено логгирование --- modules/pinghosts/pinghosts.class.php | 13 +++++++------ templates/pinghosts/pinghosts_edit.html | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/pinghosts/pinghosts.class.php b/modules/pinghosts/pinghosts.class.php index 317c62f50..f4a42c703 100644 --- a/modules/pinghosts/pinghosts.class.php +++ b/modules/pinghosts/pinghosts.class.php @@ -233,25 +233,26 @@ function checkAllHosts($limit=1000) { $old_status=$host['STATUS']; - if ($host['COUNTER_REQUIRED']) { + if ($host['COUNTER_REQUIRED'] and $new_status!=1) { $old_status_expected=$host['STATUS_EXPECTED']; $host['STATUS_EXPECTED']=$new_status; if ($old_status_expected!=$host['STATUS_EXPECTED']) { $host['COUNTER_CURRENT']=0; - $host['LOG']=date('Y-m-d H:i:s').' tries counter reset (status: '.$host['STATUS_EXPECTED'].')'."\n".$host['LOG']; + $host['LOG']=date('Y-m-d H:i:s').' tries counter reset (status: '.str_replace('2', 'offline', $host['STATUS_EXPECTED']).')'."\n".$host['LOG']; } elseif ($host['STATUS']!=$host['STATUS_EXPECTED']) { $host['COUNTER_CURRENT']++; - $host['LOG']=date('Y-m-d H:i:s').' tries counter increased to '.$host['COUNTER_CURRENT'].' (status: '.$host['STATUS_EXPECTED'].')'."\n".$host['LOG']; + $host['LOG']=date('Y-m-d H:i:s').' tries counter increased to '.$host['COUNTER_CURRENT'].' (status: '.str_replace('2', 'offline', $host['STATUS_EXPECTED']).')'."\n".$host['LOG']; } if ($host['COUNTER_CURRENT']>=$host['COUNTER_REQUIRED']) { $host['STATUS']=$host['STATUS_EXPECTED']; $host['COUNTER_CURRENT']=0; } elseif ($old_status!=$new_status) { - $interval=min($online_interval, $offline_interval, 20); - $online_interval=$interval; - $offline_interval=$interval; + $online_interval=min($online_interval, 20); } } else { + if ($host['COUNTER_REQUIRED'] and $old_status==1 and $host['STATUS_EXPECTED']==2 and $new_status==1) { + $host['LOG']=date('Y-m-d H:i:s').' Host is still online'."\n".$host['LOG']; + } $host['STATUS']=$new_status; $host['STATUS_EXPECTED']=$host['STATUS']; $host['COUNTER_CURRENT']=0; diff --git a/templates/pinghosts/pinghosts_edit.html b/templates/pinghosts/pinghosts_edit.html index abd813a82..c937cea1d 100644 --- a/templates/pinghosts/pinghosts_edit.html +++ b/templates/pinghosts/pinghosts_edit.html @@ -143,10 +143,10 @@
- <#LANG_COUNTER_REQUIRED_COMMENT#> + <#LANG_COUNTER_REQUIRED_COMMENT#> (the interval between these attempts will be 20 sec if the set value is greater)