diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php
index b810dd9e..f6df279e 100644
--- a/src/includes/functions.inc.php
+++ b/src/includes/functions.inc.php
@@ -273,11 +273,6 @@ function psm_parse_msg($status, $type, $vars) {
}
$vars['date'] = date('Y-m-d H:i:s');
- $online_date = new DateTime($vars['last_online']);
- $offline_date = new DateTime($vars['last_offline']);
- $difference = $online_date->diff($offline_date);
- $vars['downtime'] = psm_format_interval($difference);
-
foreach($vars as $k => $v) {
$message = str_replace('%' . strtoupper($k) . '%', $v, $message);
}
diff --git a/src/lang/bg_BG.lang.php b/src/lang/bg_BG.lang.php
index fe165a04..ddd2712c 100644
--- a/src/lang/bg_BG.lang.php
+++ b/src/lang/bg_BG.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Ако този текст не е намерен в интернет страницата (когато имате добавен сайт), той ще бъде маркиран като Офлайн. Регулярните изрази са разрешени.',
'last_check' => 'Последна проверка',
'last_online' => 'Последно на линия',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Мониторинг',
'no_monitoring' => 'Не се наблюдава',
'email' => 'Имейл',
diff --git a/src/lang/cs_CZ.lang.php b/src/lang/cs_CZ.lang.php
index 030b7541..02c031f2 100644
--- a/src/lang/cs_CZ.lang.php
+++ b/src/lang/cs_CZ.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Pokud vzorek nebude na webu nalezen, bude server označen jako offline. Regulární výrazy jsou povoleny.',
'last_check' => 'Poslední kontrola',
'last_online' => 'Naposledy online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitoring',
'no_monitoring' => 'Žádné monitorované služby',
'email' => 'Email',
diff --git a/src/lang/da_DK.lang.php b/src/lang/da_DK.lang.php
index 89676f70..6c5d64eb 100644
--- a/src/lang/da_DK.lang.php
+++ b/src/lang/da_DK.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Hvis dette mønster ikke findes på hjemmesiden, vil serveren blive markeret offline. Regulære udtryk er tilladt.',
'last_check' => 'Sidst kontrolleret',
'last_online' => 'Sidst online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Overvågning',
'no_monitoring' => 'Ingen overvågning',
'email' => 'Email',
diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php
index e26e79a6..8dcb4267 100644
--- a/src/lang/de_DE.lang.php
+++ b/src/lang/de_DE.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Wenn das gesuchte Muster nicht in der Webseite ist, wird die Seite als offline markiert. Reguläre Ausdrücke sind erlaubt.',
'last_check' => 'Letzter Check',
'last_online' => 'Zuletzt online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitoring',
'no_monitoring' => 'Monitoring inaktiv',
'email' => 'E-Mail',
diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php
index 6ca86e87..afa1b006 100644
--- a/src/lang/en_US.lang.php
+++ b/src/lang/en_US.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'If this pattern is not found on the website, the server will be marked offline. Regular expressions are allowed.',
'last_check' => 'Last check',
'last_online' => 'Last online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitoring',
'no_monitoring' => 'No monitoring',
'email' => 'Email',
@@ -273,11 +274,11 @@ $sm_lang = array(
'off_email_body' => "Failed to connect to the following server:
Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%",
'off_pushover_title' => 'Server \'%LABEL%\' is DOWN',
'off_pushover_message' => "Failed to connect to the following server:
Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%",
- 'on_sms' => 'Server \'%LABEL%\' is RUNNING: ip=%IP%, port=%PORT%',
+ 'on_sms' => 'Server \'%LABEL%\' is RUNNING: ip=%IP%, port=%PORT%, t was down for %LAST_OFFLINE_DURATION%',
'on_email_subject' => 'IMPORTANT: Server \'%LABEL%\' is RUNNING',
- 'on_email_body' => "Server '%LABEL%' is running again, it was down for %DOWNTIME%:
Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%",
+ 'on_email_body' => "Server '%LABEL%' is running again, it was down for %LAST_OFFLINE_DURATION%:
Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%",
'on_pushover_title' => 'Server \'%LABEL%\' is RUNNING',
- 'on_pushover_message' => 'Server \'%LABEL%\' is running again, it was down for %DOWNTIME%:
Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%',
+ 'on_pushover_message' => 'Server \'%LABEL%\' is running again, it was down for %LAST_OFFLINE_DURATION%:
Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%',
),
'login' => array(
'welcome_usermenu' => 'Welcome, %user_name%',
diff --git a/src/lang/es_ES.lang.php b/src/lang/es_ES.lang.php
index 3efad786..e928b464 100644
--- a/src/lang/es_ES.lang.php
+++ b/src/lang/es_ES.lang.php
@@ -140,6 +140,7 @@ $sm_lang = array(
'pattern_description' => 'Si este patrón no se encuentra en el sitio web, el servidor estará marcada sin conexión. Se permiten expresiones regulares.',
'last_check' => 'Ultima verificación',
'last_online' => 'Última vez en línea',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitoreo',
'no_monitoring' => 'Sin monitoreo',
'email' => 'Email',
diff --git a/src/lang/fr_FR.lang.php b/src/lang/fr_FR.lang.php
index 59f12cda..377551f9 100644
--- a/src/lang/fr_FR.lang.php
+++ b/src/lang/fr_FR.lang.php
@@ -140,6 +140,7 @@ $sm_lang = array(
'pattern_description' => 'Si ce texte n\'est par retrouvé sur le site web, le serveur est marqué hors-service. Les expressions réguliaires sont autorisées.',
'last_check' => 'Dernière vérification',
'last_online' => 'Dernière fois OK',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Serveillé',
'no_monitoring' => 'Non serveillé',
'email' => 'Email',
diff --git a/src/lang/it_IT.lang.php b/src/lang/it_IT.lang.php
index ac5b7687..0c1d51dd 100644
--- a/src/lang/it_IT.lang.php
+++ b/src/lang/it_IT.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'If this pattern is not found on the website, the server will be marked offline. Regular expressions are allowed.',
'last_check' => 'Ultimo Controllo',
'last_online' => 'Ultima volta Online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Sotto Controllo',
'no_monitoring' => 'No monitoring',
'email' => 'Email',
diff --git a/src/lang/ko_KR.lang.php b/src/lang/ko_KR.lang.php
index 3db24bab..5f01c193 100644
--- a/src/lang/ko_KR.lang.php
+++ b/src/lang/ko_KR.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'If this pattern is not found on the website, the server will be marked offline. Regular expressions are allowed.',
'last_check' => '최근체크',
'last_online' => '최근접속',
+ 'last_offline' => 'Last offline',
'monitoring' => '확인중',
'no_monitoring' => 'No monitoring',
'email' => '메일 전송',
diff --git a/src/lang/nl_NL.lang.php b/src/lang/nl_NL.lang.php
index df8d25a1..666996f3 100644
--- a/src/lang/nl_NL.lang.php
+++ b/src/lang/nl_NL.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Als dit patroon niet gevonden wordt op de website, zal de server als offline gemarkeerd worden. Regular expressions zijn toegestaan.',
'last_check' => 'Laatst gecontroleerd',
'last_online' => 'Laatst online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitoring',
'no_monitoring' => 'No monitoring',
'email' => 'Email',
diff --git a/src/lang/pl_PL.lang.php b/src/lang/pl_PL.lang.php
index eb962b54..f6c2beb0 100644
--- a/src/lang/pl_PL.lang.php
+++ b/src/lang/pl_PL.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Jeśli wzorzec nie zostanie odnaleziony, status zostanie ustawiony na offline. Wyrażenia regularne są dozwolone.',
'last_check' => 'Ostatnie sprawdzenie',
'last_online' => 'Ostatnio online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitorowany',
'no_monitoring' => 'Brak monitoringu',
'email' => 'Email',
diff --git a/src/lang/pt_BR.lang.php b/src/lang/pt_BR.lang.php
index dccea065..54de7f10 100644
--- a/src/lang/pt_BR.lang.php
+++ b/src/lang/pt_BR.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Se esse padrão não for encontrado no site, o servidor será marcado offline. As expressões regulares são permitidas.',
'last_check' => 'Última verificação',
'last_online' => 'Última vez online',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitoramento',
'no_monitoring' => 'Sem monitoring',
'email' => 'Email',
diff --git a/src/lang/ru_RU.lang.php b/src/lang/ru_RU.lang.php
index 2d325bc0..ce6c1e40 100644
--- a/src/lang/ru_RU.lang.php
+++ b/src/lang/ru_RU.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Если текст по шаблону не найден на сайте, сервер будет помечен как Оффлайн. Регулярные выражения допустимы.',
'last_check' => 'Последняя проверка',
'last_online' => 'Был онлайн',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Мониторинг',
'no_monitoring' => 'Нет мониторинга',
'email' => 'E-mail',
diff --git a/src/lang/tr_TR.lang.php b/src/lang/tr_TR.lang.php
index c29420d6..64fc6e11 100644
--- a/src/lang/tr_TR.lang.php
+++ b/src/lang/tr_TR.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => 'Bu pattern web sitenizde bulunamaz ise, sunucu offline olarak işaretlenecek. Regular expression\'a izin verilmiştir.',
'last_check' => 'Son kontrol',
'last_online' => 'Son çevrimiçi zamanı',
+ 'last_offline' => 'Last offline',
'monitoring' => 'Monitoring',
'no_monitoring' => 'No monitoring',
'email' => 'E-posta',
diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php
index ec7d574e..ada654ee 100644
--- a/src/lang/zh_CN.lang.php
+++ b/src/lang/zh_CN.lang.php
@@ -139,6 +139,7 @@ $sm_lang = array(
'pattern_description' => '如果在网站上未找到对应匹配内容, 则标记该网站为离线. 支持正则表达式.',
'last_check' => '最后检查',
'last_online' => '最后在线',
+ 'last_offline' => 'Last offline',
'monitoring' => '监控中',
'no_monitoring' => 'No monitoring',
'email' => '邮件',
diff --git a/src/psm/Module/Server/Controller/AbstractServerController.class.php b/src/psm/Module/Server/Controller/AbstractServerController.class.php
index d5c773b2..db6cc264 100644
--- a/src/psm/Module/Server/Controller/AbstractServerController.class.php
+++ b/src/psm/Module/Server/Controller/AbstractServerController.class.php
@@ -75,7 +75,9 @@ abstract class AbstractServerController extends AbstractController {
`s`.`pushover`,
`s`.`warning_threshold`,
`s`.`warning_threshold_counter`,
- `s`.`timeout`
+ `s`.`timeout`,
+ `s`.`last_offline`,
+ `s`.`last_offline_duration`
FROM `".PSM_DB_PREFIX."servers` AS `s`
{$sql_join}
{$sql_where}
@@ -97,6 +99,13 @@ abstract class AbstractServerController extends AbstractController {
protected function formatServer($server) {
$server['rtime'] = round((float) $server['rtime'], 4);
$server['last_online'] = psm_timespan($server['last_online']);
+ $server['last_offline'] = psm_timespan($server['last_offline']);
+ if ($server['last_offline'] != psm_get_lang('system', 'never')) {
+ $server['last_offline_duration'] = "(".psm_timespan($server['last_offline_duration']).")";
+ }
+ else {
+ $server['last_offline_duration'] = "";
+ }
$server['last_check'] = psm_timespan($server['last_check']);
$server['active'] = psm_get_lang('system', $server['active']);
$server['email'] = psm_get_lang('system', $server['email']);
diff --git a/src/psm/Module/Server/Controller/ServerController.class.php b/src/psm/Module/Server/Controller/ServerController.class.php
index 7d635c47..12124733 100644
--- a/src/psm/Module/Server/Controller/ServerController.class.php
+++ b/src/psm/Module/Server/Controller/ServerController.class.php
@@ -399,6 +399,7 @@ class ServerController extends AbstractServerController {
'label_last_check' => psm_get_lang('servers', 'last_check'),
'label_rtime' => psm_get_lang('servers', 'latency'),
'label_last_online' => psm_get_lang('servers', 'last_online'),
+ 'label_last_offline' => psm_get_lang('servers', 'last_offline'),
'label_monitoring' => psm_get_lang('servers', 'monitoring'),
'label_email' => psm_get_lang('servers', 'email'),
'label_send_email' => psm_get_lang('servers', 'send_email'),
diff --git a/src/psm/Module/Server/Controller/StatusController.class.php b/src/psm/Module/Server/Controller/StatusController.class.php
index a98aef23..4a1b55c7 100644
--- a/src/psm/Module/Server/Controller/StatusController.class.php
+++ b/src/psm/Module/Server/Controller/StatusController.class.php
@@ -54,6 +54,7 @@ class StatusController extends AbstractServerController {
$layout_data = array(
'label_last_check' => psm_get_lang('servers', 'last_check'),
'label_last_online' => psm_get_lang('servers', 'last_online'),
+ 'label_last_offline' => psm_get_lang('servers', 'last_offline'),
'label_rtime' => psm_get_lang('servers', 'latency'),
'block_layout_active' => ($layout == 0) ? 'active' : '',
'list_layout_active' => ($layout != 0) ? 'active' : '',
@@ -74,6 +75,11 @@ class StatusController extends AbstractServerController {
}
$server['last_checked_nice'] = psm_timespan($server['last_check']);
$server['last_online_nice'] = psm_timespan($server['last_online']);
+ $server['last_offline_nice'] = psm_timespan($server['last_offline']);
+ $server['last_offline_duration_nice'] = "";
+ if ($server['last_offline_nice'] != psm_get_lang('system', 'never')) {
+ $server['last_offline_duration_nice'] = "(".psm_timespan($server['last_offline_duration']).")";
+ }
$server['url_view'] = psm_build_url(array('mod' => 'server', 'action' => 'view', 'id' => $server['server_id'], 'back_to' => 'server_status'));
if ($server['status'] == "off") {
diff --git a/src/psm/Util/Install/Installer.class.php b/src/psm/Util/Install/Installer.class.php
index 8760a819..a908b15f 100644
--- a/src/psm/Util/Install/Installer.class.php
+++ b/src/psm/Util/Install/Installer.class.php
@@ -126,7 +126,7 @@ class Installer {
$this->log('Populating database...');
$queries = array();
- $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`, `last_offline`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes', '0000-00-00 00:00:00'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes', '0000-00-00 00:00:00')";
+ $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes')";
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users_servers` (`user_id`,`server_id`) VALUES (1, 1), (1, 2);";
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
('language', 'en_US'),
@@ -226,7 +226,8 @@ class Installer {
`warning_threshold` mediumint(1) unsigned NOT NULL DEFAULT '1',
`warning_threshold_counter` mediumint(1) unsigned NOT NULL DEFAULT '0',
`timeout` smallint(1) unsigned NULL DEFAULT NULL,
- `last_offline` datetime NULL,
+ `last_offline` datetime NULL,
+ `last_offline_duration` varchar(255) NULL,
PRIMARY KEY (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'servers_uptime' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_uptime` (
@@ -302,7 +303,8 @@ class Installer {
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `last_online` `last_online` DATETIME NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `last_check` `last_check` DATETIME NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `pattern` VARCHAR( 255 ) NOT NULL AFTER `type`;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL AFTER `timeout`;";
+ $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline_duration` varchar(255) NULL;";
$this->execSQL($queries);
}
@@ -334,7 +336,8 @@ class Installer {
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `server_id` `server_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `warning_threshold` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '1';";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `warning_threshold_counter` MEDIUMINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL AFTER `timeout`;";
+ $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline_duration` varchar(255) NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` CHANGE `user_id` `user_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users`
@@ -414,7 +417,8 @@ class Installer {
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `timeout` smallint(1) unsigned NULL DEFAULT NULL;";
- $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL AFTER `timeout`;";
+ $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline` DATETIME NULL;";
+ $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `last_offline_duration` varchar(255) NULL;";
$queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
`user_id` int(11) unsigned NOT NULL,
diff --git a/src/psm/Util/Server/Updater/StatusNotifier.class.php b/src/psm/Util/Server/Updater/StatusNotifier.class.php
index 5b699e42..64a740b1 100644
--- a/src/psm/Util/Server/Updater/StatusNotifier.class.php
+++ b/src/psm/Util/Server/Updater/StatusNotifier.class.php
@@ -121,7 +121,7 @@ class StatusNotifier {
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
'server_id' => $server_id,
), array(
- 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover', 'last_online', 'last_offline',
+ 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover', 'last_online', 'last_offline', 'last_offline_duration',
));
if(empty($this->server)) {
return false;
diff --git a/src/psm/Util/Server/Updater/StatusUpdater.class.php b/src/psm/Util/Server/Updater/StatusUpdater.class.php
index 0c72c558..85739b21 100644
--- a/src/psm/Util/Server/Updater/StatusUpdater.class.php
+++ b/src/psm/Util/Server/Updater/StatusUpdater.class.php
@@ -82,7 +82,7 @@ class StatusUpdater {
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
'server_id' => $server_id,
), array(
- 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'active', 'warning_threshold', 'warning_threshold_counter', 'timeout',
+ 'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'active', 'warning_threshold', 'warning_threshold_counter', 'timeout', 'last_offline',
));
if(empty($this->server)) {
return false;
@@ -113,6 +113,12 @@ class StatusUpdater {
$save['status'] = 'on';
$save['last_online'] = date('Y-m-d H:i:s');
$save['warning_threshold_counter'] = 0;
+ if ($this->server['status'] == 'off') {
+ $online_date = new \DateTime($save['last_online']);
+ $offline_date = new \DateTime($this->server['last_offline']);
+ $difference = $online_date->diff($offline_date);
+ $save['last_offline_duration'] = trim(psm_format_interval($difference));
+ }
} else {
// server is offline, increase the error counter
$save['warning_threshold_counter'] = $this->server['warning_threshold_counter'] + 1;
diff --git a/src/templates/default/module/server/server/view.tpl.html b/src/templates/default/module/server/server/view.tpl.html
index 8b95c7f5..113fe598 100644
--- a/src/templates/default/module/server/server/view.tpl.html
+++ b/src/templates/default/module/server/server/view.tpl.html
@@ -49,6 +49,10 @@
{{ label_last_online }}: {{ server.last_online_nice }}
+{{ label_last_offline }}: {{ server.last_offline_nice }} {{ server.last_offline_duration_nice }}
{{ label_rtime }}: {{ server.rtime }}s