mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-21 12:33:47 +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, 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.
|
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
|
## Changelog
|
||||||
|
|
||||||
### (WIP) Version 0.9.4
|
### Version 0.9.4 - Lastest Legacy Version
|
||||||
|
|
||||||
-TODO: Fix JSON GET/POST Check (Only add part works)
|
-TODO: Fix JSON GET/POST Check (Only add part works)
|
||||||
|
|
||||||
|
-Code fixes
|
||||||
|
|
||||||
### Version 0.9.3 (Beta)
|
### Version 0.9.3 (Beta)
|
||||||
|
|
||||||
-New JSON GET/POST Check
|
-New JSON GET/POST Check
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
{% if check.uptime != -1 %}{#Only if records exists#}
|
{% if check.uptime != -1 %}{#Only if records exists#}
|
||||||
<td>
|
<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}}%)
|
({{ check.uptime}}%)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
//English (Use as a reference) - Maybe grammar can be fixed
|
//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
|
//(indexpage.twig) In index, title
|
||||||
$T_['statdif1'] = 'Status of different checks';
|
$T_['statdif1'] = 'Status of different checks';
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
//Español (Oficial)
|
//Español (Oficial)
|
||||||
define('T_VERSION',1);
|
if (!defined('T_VERSION')){
|
||||||
|
define('T_VERSION',1);
|
||||||
|
}
|
||||||
|
|
||||||
//(indexpage.twig) In index, title
|
//(indexpage.twig) In index, title
|
||||||
$T_['statdif1'] = 'Estado de los diferentes servicios';
|
$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){
|
function JSON_API($ID_C,$URL,$params,$exceptedRes){
|
||||||
$type = explode('|',$params)[0];
|
$type = explode('|',$params)[0];
|
||||||
$JSONParams = explode('|',$params)[1];
|
$JSONParams = explode('|',$params)[1];
|
||||||
@@ -48,10 +47,10 @@ function JSON_API($ID_C,$URL,$params,$exceptedRes){
|
|||||||
if ($type == 'GET'){
|
if ($type == 'GET'){
|
||||||
curl_setopt($ch, CURLOPT_URL, $URL . $JSONParams);
|
curl_setopt($ch, CURLOPT_URL, $URL . $JSONParams);
|
||||||
}else if ($type == 'POST'){
|
}else if ($type == 'POST'){
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $URL);
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $JSONParams);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $JSONParams);
|
||||||
}
|
}
|
||||||
curl_setopt($ch, CURLOPT_URL, $URL);
|
|
||||||
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 4); //timeout in seconds
|
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_ret = json_decode($body,true);
|
||||||
$json_param = json_decode($exceptedRes,true);
|
$json_param = json_decode($exceptedRes,true);
|
||||||
$comp_ret =serialize($json_ret);
|
if ($json_ret == $json_param){
|
||||||
$comp_param =serialize($json_param);
|
|
||||||
if ($comp_ret == $comp_param){
|
|
||||||
return 0;
|
return 0;
|
||||||
}else{
|
}else{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ function ping($host,$port = '80') {
|
|||||||
|
|
||||||
/** Returns web root (ie. http://jkanetwork.com) */
|
/** Returns web root (ie. http://jkanetwork.com) */
|
||||||
function webRoot(){
|
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']);
|
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]['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'] != ''){
|
if ($onechk['manStatus'] != ''){
|
||||||
$chks[$idchk]['uptime'] = 255;//255 = Maintenance I suppose, not implemented
|
$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']);
|
->text($incident['text']);
|
||||||
$incs[$ID_N]['ID_N'] = $incident['ID_N'];
|
$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
|
<?php
|
||||||
define('VERSION','0.9.3');
|
define('VERSION','0.9.4');
|
||||||
//define('INSTALLER_MODE','1');
|
//define('INSTALLER_MODE','1');
|
||||||
require_once 'lib/loadTwig.php';
|
require_once 'lib/loadTwig.php';
|
||||||
|
|
||||||
|
|||||||
2
load.php
2
load.php
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'functions.php'; //Preloads functions
|
require_once 'functions.php'; //Preloads functions
|
||||||
require_once 'lib/dbwrapper.php';
|
require_once 'lib/dbwrapper.php';
|
||||||
define('VERSION','0.9.3');
|
define('VERSION','0.9.4');
|
||||||
session_start(); //Session in all page
|
session_start(); //Session in all page
|
||||||
//Preload file
|
//Preload file
|
||||||
//This function loads all things needed, with optional db things if needed
|
//This function loads all things needed, with optional db things if needed
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ switch($page){
|
|||||||
'ID_C' => $fail['ID_C'],
|
'ID_C' => $fail['ID_C'],
|
||||||
'name' => nameFromIDC($fail['ID_C']),
|
'name' => nameFromIDC($fail['ID_C']),
|
||||||
'groupName' => nameGroupFromIDG(IDGFromIDC($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'],
|
'errorText' => $fail['errorText'],
|
||||||
'date' => date('j/n/Y',$fail['timestamp']),
|
'date' => date('j/n/Y',$fail['timestamp']),
|
||||||
'hour' => date('H:i',$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
|
dbw_query($db_conn,"INSERT INTO SYS VALUES ('maintenance','1')"); //New system opt
|
||||||
|
|
||||||
case '0.9.3':
|
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'");
|
dbw_query($db_conn,"UPDATE SYS SET value='0' WHERE option='maintenance'");
|
||||||
|
echo "<p>0.9.4-Lastest</p>";
|
||||||
echo "0.9.3-Lastest";
|
|
||||||
echo "<p>Updated to lastest. Close this and go to index</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>";
|
echo "<p>Remember to delete updater.php and install.php for security!</p>";
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user