mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-18 19:21:35 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c0d3912413 | |||
| 635a223538 | |||
| 84cb21dcf3 | |||
| f9e219ebb1 | |||
| a478f8a587 |
@@ -1,3 +1,5 @@
|
||||
## Will not update more, we are writing a totally different CheckServer
|
||||
|
||||
# CheckServer, a light and great Check service for servers and pages
|
||||
|
||||
CheckServer is a PHP app that monitor (using crons) some parameters in servers, like http responses, pings to ports (http,ssh,...), databases, and views simple stadistics.
|
||||
@@ -43,10 +45,12 @@ a backup of your sqlite.db3 database before updating or data may lost.
|
||||
|
||||
## Changelog
|
||||
|
||||
### (WIP) Version 0.9.4
|
||||
### Version 0.9.4 - Lastest Legacy Version
|
||||
|
||||
-TODO: Fix JSON GET/POST Check (Only add part works)
|
||||
|
||||
-Code fixes
|
||||
|
||||
### Version 0.9.3 (Beta)
|
||||
|
||||
-New JSON GET/POST Check
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
{% if check.uptime != -1 %}{#Only if records exists#}
|
||||
<td>
|
||||
<span class='{{check.statusColor}}' data-tooltip='Type of check: {{check.nameCheck}}' data-tooltip-position='top'>{{check.statusText}}</span>
|
||||
<span class='{{check.statusColor}}' data-tooltip='Type of check: {{T_[check.nameCheck]}}' data-tooltip-position='top'>{{check.statusText}}</span> {# Use T_[Var] to merge var to array #}
|
||||
({{ check.uptime}}%)
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
//English (Use as a reference) - Maybe grammar can be fixed
|
||||
define('T_ENGVERSION',1);
|
||||
if (!defined('T_ENGVERSION')){
|
||||
define('T_ENGVERSION',1);
|
||||
}
|
||||
|
||||
//(indexpage.twig) In index, title
|
||||
$T_['statdif1'] = 'Status of different checks';
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
//Español (Oficial)
|
||||
define('T_VERSION',1);
|
||||
if (!defined('T_VERSION')){
|
||||
define('T_VERSION',1);
|
||||
}
|
||||
|
||||
//(indexpage.twig) In index, title
|
||||
$T_['statdif1'] = 'Estado de los diferentes servicios';
|
||||
|
||||
@@ -39,7 +39,6 @@ function DATABASE_CONN($ID_C,$URL){
|
||||
}
|
||||
}
|
||||
|
||||
//WIP, doesnt compare right!
|
||||
function JSON_API($ID_C,$URL,$params,$exceptedRes){
|
||||
$type = explode('|',$params)[0];
|
||||
$JSONParams = explode('|',$params)[1];
|
||||
@@ -48,10 +47,10 @@ function JSON_API($ID_C,$URL,$params,$exceptedRes){
|
||||
if ($type == 'GET'){
|
||||
curl_setopt($ch, CURLOPT_URL, $URL . $JSONParams);
|
||||
}else if ($type == 'POST'){
|
||||
curl_setopt($ch, CURLOPT_URL, $URL);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $JSONParams);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_URL, $URL);
|
||||
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 4); //timeout in seconds
|
||||
@@ -60,9 +59,7 @@ function JSON_API($ID_C,$URL,$params,$exceptedRes){
|
||||
|
||||
$json_ret = json_decode($body,true);
|
||||
$json_param = json_decode($exceptedRes,true);
|
||||
$comp_ret =serialize($json_ret);
|
||||
$comp_param =serialize($json_param);
|
||||
if ($comp_ret == $comp_param){
|
||||
if ($json_ret == $json_param){
|
||||
return 0;
|
||||
}else{
|
||||
return 1;
|
||||
|
||||
@@ -65,7 +65,7 @@ function ping($host,$port = '80') {
|
||||
|
||||
/** Returns web root (ie. http://jkanetwork.com) */
|
||||
function webRoot(){
|
||||
$root = $_SERVER['HTTPS'] ? "https://" : "http://"; //Variable = condicion ? Verdadero : Falso
|
||||
$root = isset($_SERVER['HTTPS']) ? "https://" : "http://"; //Variable = condicion ? Verdadero : Falso
|
||||
return $root . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ while ($onechk = dbw_fetch_array($db_conn,$results)){
|
||||
$chks[$idchk]['dateLastErr'] = date('d/m H:i',$lastErr);
|
||||
}
|
||||
|
||||
$chks[$idchk]['nameCheck'] = textTypeChk($ID_TC);
|
||||
$chks[$idchk]['nameCheck'] = arrayTypeChk()[$ID_TC]; //To send array name and not the word
|
||||
|
||||
if ($onechk['manStatus'] != ''){
|
||||
$chks[$idchk]['uptime'] = 255;//255 = Maintenance I suppose, not implemented
|
||||
@@ -84,5 +84,5 @@ while ($incident = dbw_fetch_array($db_conn,$incidents)){
|
||||
->text($incident['text']);
|
||||
$incs[$ID_N]['ID_N'] = $incident['ID_N'];
|
||||
}
|
||||
renderPage('indexpage.twig',array('you' => $you,'checks' => $chks, 'news' => $incs)); //Render
|
||||
renderPage('indexpage.twig',array('checks' => $chks, 'news' => $incs)); //Render
|
||||
?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
define('VERSION','0.9.3');
|
||||
define('VERSION','0.9.4');
|
||||
//define('INSTALLER_MODE','1');
|
||||
require_once 'lib/loadTwig.php';
|
||||
|
||||
|
||||
2
load.php
2
load.php
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require_once 'functions.php'; //Preloads functions
|
||||
require_once 'lib/dbwrapper.php';
|
||||
define('VERSION','0.9.3');
|
||||
define('VERSION','0.9.4');
|
||||
session_start(); //Session in all page
|
||||
//Preload file
|
||||
//This function loads all things needed, with optional db things if needed
|
||||
|
||||
@@ -320,7 +320,7 @@ switch($page){
|
||||
'ID_C' => $fail['ID_C'],
|
||||
'name' => nameFromIDC($fail['ID_C']),
|
||||
'groupName' => nameGroupFromIDG(IDGFromIDC($fail['ID_C'])),
|
||||
'typeCheck' => textTypeChk($T_,$fail['ID_TC']),
|
||||
/* 'typeCheck' => textTypeChk($fail['ID_TC']), Doesnt work yet */
|
||||
'errorText' => $fail['errorText'],
|
||||
'date' => date('j/n/Y',$fail['timestamp']),
|
||||
'hour' => date('H:i',$fail['timestamp'])
|
||||
|
||||
10
updater.php
10
updater.php
@@ -42,10 +42,12 @@ CREATE TABLE "CHECKS" (
|
||||
dbw_query($db_conn,"INSERT INTO SYS VALUES ('maintenance','1')"); //New system opt
|
||||
|
||||
case '0.9.3':
|
||||
dbw_query($db_conn,"UPDATE SYS SET value='0.9.3' WHERE option='version'");
|
||||
echo "<p>0.9.3->0.9.4</p>";
|
||||
case '0.9.4':
|
||||
dbw_query($db_conn,"UPDATE SYS SET value='0.9.4' WHERE option='version'");
|
||||
dbw_query($db_conn,"UPDATE SYS SET value='0' WHERE option='maintenance'");
|
||||
|
||||
echo "0.9.3-Lastest";
|
||||
echo "<p>0.9.4-Lastest</p>";
|
||||
echo "<p>Updated to lastest. Close this and go to index</p>";
|
||||
echo "<p>Remember to delete updater.php and install.php for security!</p>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user