mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-15 01:31:37 +01:00
View uptime in index page
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<!--<th>#</th>-->
|
<!--<th>#</th>-->
|
||||||
<th>{{T_.name}}</th>
|
<th>{{T_.name}}</th>
|
||||||
<th>{{T_.status}}</th>
|
<th>{{T_.status_uptime}}</th>
|
||||||
<th>{{T_.last_check}}</th>
|
<th>{{T_.last_check}}</th>
|
||||||
<th>{{T_.last_err}}</th>
|
<th>{{T_.last_err}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
<span class='grey' data-tooltip='Type of check: {{check.nameCheck}}' data-tooltip-position='top'>{{T_.status_empty}}</span>
|
<span class='grey' data-tooltip='Type of check: {{check.nameCheck}}' data-tooltip-position='top'>{{T_.status_empty}}</span>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{#END IF/SWITCH#}
|
{#END IF/SWITCH#}
|
||||||
|
({{ check.uptime}}%)
|
||||||
</td>
|
</td>
|
||||||
{% if check.status is defined %}{#Only if records exists#}
|
{% if check.status is defined %}{#Only if records exists#}
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ define('T_ENGVERSION',1);
|
|||||||
$T_['statdif1'] = 'Status of different checks';
|
$T_['statdif1'] = 'Status of different checks';
|
||||||
$T_['name'] = 'Name';
|
$T_['name'] = 'Name';
|
||||||
$T_['status'] = 'Status';
|
$T_['status'] = 'Status';
|
||||||
|
$T_['status_uptime'] = 'Status (Uptime)';
|
||||||
$T_['failed'] = 'Failed';
|
$T_['failed'] = 'Failed';
|
||||||
$T_['last_check'] = 'Last check';
|
$T_['last_check'] = 'Last check';
|
||||||
$T_['last_err'] = 'Last error';
|
$T_['last_err'] = 'Last error';
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ define('T_VERSION',1);
|
|||||||
$T_['statdif1'] = 'Estado de los diferentes servicios';
|
$T_['statdif1'] = 'Estado de los diferentes servicios';
|
||||||
$T_['name'] = 'Nombre';
|
$T_['name'] = 'Nombre';
|
||||||
$T_['status'] = 'Estado';
|
$T_['status'] = 'Estado';
|
||||||
|
$T_['status_uptime'] = 'Estado (Uptime)';
|
||||||
$T_['failed'] = 'Erróneo';
|
$T_['failed'] = 'Erróneo';
|
||||||
$T_['last_check'] = 'Última comprobación';
|
$T_['last_check'] = 'Última comprobación';
|
||||||
$T_['last_err'] = 'Último error';
|
$T_['last_err'] = 'Último error';
|
||||||
|
|||||||
@@ -28,7 +28,11 @@ function checkStatus($db_conn,$ID_C){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkUptime($db_conn,$ID_C,$precision = 0){
|
function checkUptime($db_conn,$ID_C,$precision = 0){
|
||||||
$time = $precision;
|
if ($precision == 0){
|
||||||
|
$time = time()-30*24*3600; //Last month
|
||||||
|
}else{
|
||||||
|
$time = $precision;
|
||||||
|
}
|
||||||
if ($precision != 0){
|
if ($precision != 0){
|
||||||
$good = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM CHKHIST WHERE ID_C = '$ID_C' AND code == 0 AND `timestamp` > $time")[0];
|
$good = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM CHKHIST WHERE ID_C = '$ID_C' AND code == 0 AND `timestamp` > $time")[0];
|
||||||
$all = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM CHKHIST WHERE ID_C = '$ID_C' AND `timestamp` > $time")[0];
|
$all = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM CHKHIST WHERE ID_C = '$ID_C' AND `timestamp` > $time")[0];
|
||||||
@@ -37,7 +41,7 @@ function checkUptime($db_conn,$ID_C,$precision = 0){
|
|||||||
$all = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM CHKHIST WHERE ID_C = '$ID_C'")[0];
|
$all = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM CHKHIST WHERE ID_C = '$ID_C'")[0];
|
||||||
}
|
}
|
||||||
if ($all != 0){
|
if ($all != 0){
|
||||||
$uptime = ($good/$all)*100;
|
$uptime = round(($good/$all)*100,2);
|
||||||
return $uptime;
|
return $uptime;
|
||||||
}else{
|
}else{
|
||||||
return 100;
|
return 100;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ while ($onechk = dbw_fetch_array($db_conn,$results)){
|
|||||||
|
|
||||||
$ID_TC = $chks[$idchk]['ID_TC'];
|
$ID_TC = $chks[$idchk]['ID_TC'];
|
||||||
$chks[$idchk]['nameCheck'] = textTypeChk($T_,$ID_TC);
|
$chks[$idchk]['nameCheck'] = textTypeChk($T_,$ID_TC);
|
||||||
|
$chks[$idchk]['uptime'] = checkUptime($db_conn,$ID_C);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user