I guess nobody just wants to see last 30 days of SLA. Typically the SLA is viewed monthly basis, which means on today (11th feb) the interesting SLA figure is "last month" (1st jan - 31st jan).
This patch does it, unfortunately only en_gb locale:
Add to: include/locales/en_gb.inc.php
Change srv_status.php
- it adds last_month which uses conditional assignment to fetch last month. I could not get strtotime ("last month first day midnight") to work properly.
- in theory you could remove 1 second from $period_end but I didn't see it worthwhile of it (adding -1
..
Good thing would be adding dates of which the SLA figure is drawn. The method of generating pages is too complicated for me to add such stuff. What I am thinking is:
SLA period: $period_start - $period-end
(naturally above epoch values converted to human readable timestamps)
This patch does it, unfortunately only en_gb locale:
Add to: include/locales/en_gb.inc.php
Code:
'S_LAST_MONTH'=> 'Last month',
- it adds last_month which uses conditional assignment to fetch last month. I could not get strtotime ("last month first day midnight") to work properly.
- in theory you could remove 1 second from $period_end but I didn't see it worthwhile of it (adding -1
..Code:
$periods = array(
'today' => S_TODAY,
'week' => S_THIS_WEEK,
'month' => S_THIS_MONTH,
'year' => S_THIS_YEAR,
24 => S_LAST_24_HOURS,
24*7 => S_LAST_7_DAYS,
24*30 => S_LAST_30_DAYS,
'last_month' => S_LAST_MONTH,
24*365 => S_LAST_365_DAYS,
);
$period = get_request('period', 7*24);
$period_end = time();
switch($period){
case 'today':
$period_start = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
break;
case 'week':
$period_start = strtotime('last sunday');
break;
case 'month':
$period_start = mktime(0, 0, 0, date('n'), 1, date('Y'));
break;
case 'last_month':
$period_end = mktime(0, 0, 0, date('n'), 1, date('Y'));
$period_start = mktime(0, 0, 0, (date('n')-1)<1?12:(date('n')-1),1, (date('n')-1)<1?(date('Y')-1):date('Y'));
break;
case 'year':
$period_start = mktime(0, 0, 0, 1, 1, date('Y'));
break;
case 24:
case 24*7:
case 24*30:
case 24*365:
SLA period: $period_start - $period-end
(naturally above epoch values converted to human readable timestamps)
Comment