mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-14 09:11:34 +01:00
Start again
This commit is contained in:
91
README.md
91
README.md
@@ -1,84 +1,45 @@
|
||||
## Will not update more, we are writing a totally different CheckServer
|
||||
## For < 1.0 version (Legacy sqlite3 and simpler version), go here: https://gitlab.com/JKANetwork/CheckServer/tree/v0.9.4
|
||||
|
||||
# CheckServer, a light and great Check service for servers and pages
|
||||
# CheckServer (New)
|
||||
|
||||
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.
|
||||
without dependencies and installable only coping repository and ajusting some params. It uses SQLite3 and php only.
|
||||
CheckServer is a PHP app that monitor (using crons) some parameters in servers, ping to it, services, and views simple stadistics.
|
||||
It only needs PHP, MySQL, and for talking with Windows machines, Linux wmi-client package (I'm open to change with a PHP library that works)
|
||||
|
||||
Also can show stadistics for all sites
|
||||
Also has a index stadistics page for guests (Not logued)
|
||||
|
||||
Real using index 'demo' can be viewed in https://status.jkanetwork.com/
|
||||
|
||||
## Disclaimer
|
||||
# Requirements
|
||||
- Linux (In Windows you can't see Windows machines, wmi mismatch from Linux)
|
||||
- PHP 7.0+
|
||||
- wmi-client and shell_exec package if you want to control Windows machines
|
||||
- MySQL
|
||||
- Cron
|
||||
|
||||
This is an beta, opensource, and a human made program. **There may be bugs and problems**, and
|
||||
although we can update and fix things, JKANetwork is **not** responsable for derivated problems.
|
||||
# Bugs
|
||||
- Ping needs root because socket use in some distros, can be used in cron
|
||||
|
||||
You can see the master code and tell us any improvment or bug. Plase see indications for installing if you want
|
||||
to install without problems. Master is bleeding edge, use tags for versions and not having problems.
|
||||
# Install
|
||||
Download last version from https://gitlab.com/JKANetwork/CheckServer/tags (not git master, reason
|
||||
below. Think of tags as releases), unzip it and copy all to the folder in your hosting.
|
||||
|
||||
## Requirements
|
||||
Go to browser, /install.php and follow the installer
|
||||
|
||||
-Modern PHP (5.6+) with SQLite3 enabled
|
||||
|
||||
-Cron support
|
||||
|
||||
## Install
|
||||
|
||||
For installing, only download last version from https://gitlab.com/JKANetwork/CheckServer/tags (not git master, reason
|
||||
below. **Think of tags as releases**), decompress it and copy all to the folder in your hosting.
|
||||
|
||||
Please **do not download and use master git**,it is not recommended, because is for devel and things like installer sql can not work right. Use the tags. **Think of tags as releases**
|
||||
|
||||
Navigate to your host and installer will start.
|
||||
|
||||
For finishing it, you have to add a cron in your system for running checks. The check has to run using php the file cronchk.php. Example for Linux, in /etc/cron.d/checkserver:
|
||||
For finishing it, you have to add a cron in your system for running checks. The check has to run using php the file cron.php. Example for Linux, in /etc/cron.d/checkserver:
|
||||
```
|
||||
*/5 * * * * root cd /srv/http/checkserver/ && /usr/bin/php -f cronchk.php >/dev/null 2>&1
|
||||
*/5 * * * * root cd /srv/http/checkserver/cron/ && /usr/bin/php -f cron.php >/dev/null 2>&1
|
||||
```
|
||||
|
||||
## Update
|
||||
|
||||
Decompress folder over your installation folder, and run "updater.php",
|
||||
it will update and say if something goes wrong. Its a good idea to make
|
||||
a backup of your sqlite.db3 database before updating or data may lost.
|
||||
# TODO
|
||||
|
||||
## Changelog
|
||||
Allow http response views
|
||||
|
||||
### Version 0.9.4 - Lastest Legacy Version
|
||||
At future, read sensors in routers/switchs/SNMP
|
||||
|
||||
-TODO: Fix JSON GET/POST Check (Only add part works)
|
||||
# Changelog
|
||||
|
||||
-Code fixes
|
||||
1.0.0 - First public version (Beta quality)
|
||||
|
||||
### Version 0.9.3 (Beta)
|
||||
-Completly reworked code
|
||||
|
||||
-New JSON GET/POST Check
|
||||
|
||||
-Bugfix in cronchk!
|
||||
|
||||
-A bit cleaner code
|
||||
|
||||
### Version 0.9.2 (Beta)
|
||||
|
||||
-A bit more info in admin page (Checks->Errors/History info)
|
||||
|
||||
-Fix duplicate entries for failed checks (Less false failed tests)
|
||||
|
||||
-More optimizations when lot of pages/tests
|
||||
|
||||
-Fix dates and some texts in index
|
||||
|
||||
-Updater fixed, 0.9.1 not working right
|
||||
|
||||
### Version 0.9.1 (Beta)
|
||||
|
||||
-See uptime percent
|
||||
|
||||
-Optimized index webpage, times went down to half when have a lot of pages
|
||||
|
||||
### Version 0.9 (Beta)
|
||||
|
||||
-First public version
|
||||
|
||||
-Supports ping at different ports, httpcode returns (default or custom), and MySQL/sqlite/PgSQL status. Also you can post news to index, and have a (invisible) visit counter of visits in your webpages.
|
||||
-You can't update to this from previous versions, you have to reinstall it
|
||||
384
admin.php
Normal file
384
admin.php
Normal file
@@ -0,0 +1,384 @@
|
||||
<?php
|
||||
if (!file_exists(__DIR__ .'/config/config.php')){
|
||||
header('location: install.php');
|
||||
}
|
||||
require_once 'functions.php';
|
||||
if (!isset($_SESSION['user'])){
|
||||
header('Location: index.php');
|
||||
}
|
||||
|
||||
|
||||
if ($_POST){ //Aquí limpieza de los campos POST y GET
|
||||
foreach ($_POST as $key => $value){
|
||||
$_POST[$key] = cleanData($_POST[$key]);
|
||||
}
|
||||
}
|
||||
if ($_GET){ //Aquí limpieza de los campos POST y GET
|
||||
foreach ($_GET as $key => $value){
|
||||
$_GET[$key] = cleanData($_GET[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$namepage = isset($_GET['page']) ? $_GET['page'] : "index";
|
||||
|
||||
switch ($namepage){
|
||||
case 'savenewserver':
|
||||
//Here, checks
|
||||
if ($_POST['name']){ //Input checking
|
||||
list($name,$ip,$so,$description) = array($_POST['name'],$_POST['IP'],$_POST['so'],$_POST['description']);
|
||||
|
||||
$db_conn = dbconn(); //Connect
|
||||
|
||||
|
||||
//Check if server exists
|
||||
$count = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM SERVERS WHERE IP='$ip'")[0];
|
||||
if ($count){
|
||||
sendmsg('error','Este servidor ya existe!');
|
||||
}else{
|
||||
$result = dbw_query($db_conn,"INSERT INTO SERVERS (`Name`,IP,SO,`Description`) VALUES ('$name','$ip','$so','$description')");
|
||||
|
||||
if ($result){ //If query ran
|
||||
$ID_SERV = dbw_last_id($db_conn);
|
||||
sendmsg('ok','Servidor añadido con éxito');
|
||||
if ($_POST['ssh']){
|
||||
$sshport = (int)$_POST['ssh'];
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET SSHPort = '$sshport' WHERE ID_SERV='$ID_SERV'");
|
||||
}
|
||||
|
||||
if ($_POST['userserv'] != "" && $_POST['passw'] != ""){
|
||||
$user = addslashes ($_POST['userserv']);
|
||||
$IV = randomString(16); //For secure encoding
|
||||
$password = encodePassword($_POST['passw'],$IV);
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET `User`='$user', `Password` = '$password',`IV`='$IV' WHERE ID_SERV='$ID_SERV'");
|
||||
exec("php -f ".dirname(__FILE__).'/cron/cron.php '.$ID_SERV); //Retrieve data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//break; //For add another.?
|
||||
|
||||
case 'newserver':
|
||||
$db_conn = dbconn();
|
||||
$sql = dbw_query ($db_conn,"SELECT * FROM GROUPS");
|
||||
while ($line = dbw_fetch_array($db_conn,$sql)){
|
||||
$groups[] = $line;
|
||||
}
|
||||
if (!isset($groups)){
|
||||
$groups = array();
|
||||
}
|
||||
renderPage('a_newserver.twig',array('mode' => 'new'));
|
||||
|
||||
break;
|
||||
|
||||
case 'deleteserver':
|
||||
$ID_SERV = (int)$_GET['id_serv'];
|
||||
if ($ID_SERV == 0){
|
||||
sendmsg('error', 'Parametros incorrectos');
|
||||
}else{
|
||||
if (getPerm('PE_admin')){
|
||||
$db_conn = dbconn();
|
||||
dbw_query($db_conn,"DELETE FROM ALERTS WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query($db_conn,"DELETE FROM MAIL WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query($db_conn,"DELETE FROM S_HDDSTAT WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query($db_conn,"DELETE FROM S_HISTPING WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query($db_conn,"DELETE FROM S_HISTRAM WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query($db_conn,"DELETE FROM S_HISTSERVICES WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query($db_conn,"DELETE FROM S_SERVICES WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query($db_conn,"DELETE FROM SERVERS WHERE ID_SERV='$ID_SERV'");
|
||||
sendmsg('ok','Servidor eliminado con éxito');
|
||||
}else{
|
||||
sendmsg('error', 'No tienes permisos');
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: admin.php');
|
||||
|
||||
break;
|
||||
|
||||
case 'saveeditserver':
|
||||
//Here, checks
|
||||
if (isset($_GET['id_serv'],$_POST['name'])){ //Input checking
|
||||
list($ID_SERV,$name,$ip,$description) = array((int)$_GET['id_serv'],$_POST['name'],$_POST['IP'],$_POST['description']);
|
||||
|
||||
|
||||
$db_conn = dbconn(); //Connect
|
||||
|
||||
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET `Name`='$name',`IP`='$ip', `Description`='$description' WHERE ID_SERV='$ID_SERV'");
|
||||
if ($_POST['ssh']){
|
||||
$sshport = (int)$_POST['ssh'];
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET SSHPort = '$sshport' WHERE ID_SERV='$ID_SERV'");
|
||||
}
|
||||
if ($_POST['userserv'] != "" && $_POST['passw'] != ""){
|
||||
$user = addslashes ($_POST['userserv']);
|
||||
$IV = randomString(16);
|
||||
$password = encodePassword($_POST['passw'],$IV);
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET `User`='$user', `Password` = '$password',`IV`='$IV' WHERE ID_SERV='$ID_SERV'");
|
||||
|
||||
}
|
||||
sendmsg('ok','Servidor editado');
|
||||
}else{
|
||||
sendmsg('error','Te faltaban campos por poner o son incorrectos');
|
||||
}
|
||||
header('Location: admin.php?page=servers&id_serv='.$ID_SERV); //Go to server page
|
||||
|
||||
break;
|
||||
|
||||
case 'editserver':
|
||||
$db_conn = dbconn();
|
||||
$server = serverData((int)$_GET['id_serv']);
|
||||
renderPage('a_newserver.twig',array('mode' => 'edit','server' => $server));
|
||||
|
||||
break;
|
||||
|
||||
case 'users':
|
||||
$db_conn = dbconn();
|
||||
|
||||
if (isset($_POST['pass1']) && ($_POST['pass1'] == $_POST['pass2']) ){ //Si se quiere cambiar la contraseña propia
|
||||
$ID_U = $_SESSION['user']['ID_U'];
|
||||
$password = hash("sha256",$ID_U.$_POST['pass1']); //Password with salt (id_u)
|
||||
dbw_query($db_conn,"UPDATE USERS SET `Password`='$password' WHERE ID_U='$ID_U'");
|
||||
sendmsg('ok','Contraseña cambiada correctamente.');
|
||||
}
|
||||
else if (isset($_POST['name']) && $_POST['password']){ //Si rellenó el formulario de nuevo usuario
|
||||
$name = $_POST['name'];
|
||||
$checkuser = dbw_query($db_conn,"SELECT * FROM USERS WHERE `Name`='$name'");
|
||||
$checkuser = dbw_num_rows($db_conn,$checkuser);
|
||||
if ($checkuser){
|
||||
sendmsg('error','El usuario ya existe');
|
||||
}else{
|
||||
dbw_query($db_conn,"INSERT INTO USERS (`Name`,`Password`,`Enabled`) VALUES('$name','x','1')");
|
||||
$id_u = dbw_last_id($db_conn);
|
||||
$password = hash("sha256",$id_u.$_POST['password']); //Password with salt (id_u)
|
||||
dbw_query($db_conn,"UPDATE USERS SET `Password`='$password' WHERE ID_U='$id_u'");
|
||||
sendmsg('error','Usuario creado correctamente.');
|
||||
}
|
||||
}else if (isset($_GET['delete'])){
|
||||
$deleteid = (int)$_GET['delete'];
|
||||
if(getPerm('PE_admin')){ //Solo puede borrar el administrador
|
||||
dbw_query($db_conn,"DELETE FROM USERS WHERE ID_U='$deleteid'");
|
||||
sendmsg('ok','Usuario borrado correctamente');
|
||||
}else{
|
||||
sendmsg('error','Sin permisos para borrar usuarios');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Datos de usuarios
|
||||
if (getPerm('PE_admin')){
|
||||
$sql = dbw_query($db_conn,"SELECT * FROM USERS");
|
||||
while ($line = dbw_fetch_array($db_conn,$sql)){
|
||||
$users[] = $line;
|
||||
}
|
||||
}else{ //No tiene permiso más que para verse a si mismo
|
||||
sendmsg('info','Solo podrás ver tu usuario ya que no eres administrador');
|
||||
$users[] = $_SESSION['user'];
|
||||
}
|
||||
|
||||
renderPage('a_users.twig',array("users" => $users));
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'servers':
|
||||
$db_conn = dbconn();
|
||||
$ID_SERV = (int)$_GET['id_serv'];
|
||||
|
||||
if ($ID_SERV == 0){ //Not valid
|
||||
renderPage('err_404.twig');
|
||||
die();
|
||||
}
|
||||
|
||||
$server = serverData($ID_SERV); //Load server data
|
||||
if ($server == NULL){ //Not valid
|
||||
renderPage('err_404.twig');
|
||||
die();
|
||||
}
|
||||
|
||||
/*list($pas,$ivv) = dbw_query_fetch_array($db_conn,"SELECT `Password`,IV FROM SERVERS WHERE ID_SERV='$ID_SERV'");
|
||||
sendmsg('debug',decodePassword($pas,$ivv));*/
|
||||
|
||||
|
||||
if (isset($_GET['do'],$_GET['name']) && $_GET['do'] =='deletesvc'){
|
||||
$name = $_GET['name'];
|
||||
dbw_query($db_conn,"DELETE FROM S_HISTSERVICES WHERE ID_SERV='$ID_SERV' AND `Name`='$name'");
|
||||
dbw_query($db_conn,"DELETE FROM S_SERVICES WHERE ID_SERV='$ID_SERV' AND `Name`='$name'");
|
||||
$typeS = 'SERVICE.'.$name;
|
||||
dbw_query($db_conn,"DELETE FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type`='$type' AND `Param`='$service'");
|
||||
dbw_query($db_conn,"DELETE FROM MAIL WHERE ID_SERV='$ID_SERV' AND `Type`='$typeS'");
|
||||
}else if (isset($_POST['groupsel']) && $_GET['do'] == 'changegrp'){
|
||||
sendmsg('ok','Grupos cambiados');
|
||||
dbw_query($db_conn,"DELETE FROM S_INGROUP WHERE ID_SERV='$ID_SERV'");
|
||||
$groupsel = $_POST['groupsel'];
|
||||
foreach ($groupsel as $grpid=>$value) {
|
||||
dbw_query($db_conn,"INSERT INTO S_INGROUP (ID_G,ID_SERV) VALUES('$value','$ID_SERV')");
|
||||
}
|
||||
}else if (isset($_GET['name'],$_GET['do']) && $_GET['do'] == 'togglesvc'){
|
||||
|
||||
$namesrv = $_GET['name'];
|
||||
toggle_server_svc($ID_SERV,$namesrv);
|
||||
sendmsg('ok','Hecho. Por favor, refresca los datos del servidor en unos segundos');
|
||||
|
||||
}else if ($ID_SERV != 0 && isset($_POST['name'], $_POST['descr'])){ //If form of new service was filled
|
||||
$name = $_POST['name'];
|
||||
$descr = $_POST['descr'];
|
||||
|
||||
$count = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_SERVICES WHERE ID_SERV='$ID_SERV' AND `Name`='$name'")[0];
|
||||
if ($count){
|
||||
sendmsg('error','Ya hay un servicio con ese nombre');
|
||||
}else{
|
||||
dbw_query($db_conn,"INSERT INTO S_SERVICES(ID_SERV,`Name`,`Type`,`Description`) VALUES ('$ID_SERV','$name','SERVICE','$descr')");
|
||||
sendmsg('ok','Servicio añadido con éxito');
|
||||
}
|
||||
}
|
||||
|
||||
//Load services
|
||||
$servicessql = dbw_query($db_conn,"SELECT * FROM S_SERVICES WHERE ID_SERV = '$ID_SERV'");
|
||||
|
||||
if (dbw_num_rows($db_conn,$servicessql) == 0){
|
||||
$services = array(); //Empty, no services
|
||||
}
|
||||
while ($line = dbw_fetch_array($db_conn,$servicessql)){
|
||||
|
||||
$all = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_HISTSERVICES WHERE ID_SERV='$ID_SERV' AND `Name`='$line[Name]'")[0];
|
||||
if ($all){
|
||||
$on = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_HISTSERVICES WHERE ID_SERV='$ID_SERV' AND `Name`='$line[Name]' AND `Status`=1")[0];
|
||||
$uptimepercent = round(($on / $all) * 100,2);
|
||||
}else{ //Si no hay histórico
|
||||
$uptimepercent = "NODATA";
|
||||
$line['Status'] = "NULL";
|
||||
|
||||
}
|
||||
$services[] = array (
|
||||
'ID_SERV' => $line['ID_SERV'],
|
||||
'Enabled' => $line['Enabled'],
|
||||
'Name' => $line['Name'],
|
||||
'Status' => $line['Status'],
|
||||
'Description' => $line['Description'],
|
||||
'UptimePercent' => $uptimepercent
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//Load ram history
|
||||
$ramsql = dbw_query($db_conn,"SELECT * FROM S_HISTRAM WHERE ID_SERV = '$ID_SERV' ORDER BY `Timestamp` DESC LIMIT 30");
|
||||
|
||||
if (dbw_num_rows($db_conn,$ramsql) == 0){
|
||||
$histram = array(); //Empty, no services
|
||||
}
|
||||
while ($line = dbw_fetch_array($db_conn,$ramsql)){
|
||||
|
||||
$histram[] = array (
|
||||
'ID_SERV' => $line['ID_SERV'],
|
||||
'Timestamp' => timestampToHuman($line['Timestamp']),
|
||||
'Freeram' => bytesToHuman($line['Freeram'],0,1),
|
||||
'Detram' => bytesToHuman($line['Detram'],0,1)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//Load group names
|
||||
$groups = array();
|
||||
$sql = dbw_query($db_conn,"SELECT ID_G,`Name` FROM GROUPS");
|
||||
while ($line = dbw_fetch_array($db_conn,$sql)){
|
||||
$groups[] = array (
|
||||
'ID_G' => $line['ID_G'],
|
||||
'Name' => $line['Name']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
renderPage('a_server.twig',array("server" => $server,"services" => $services, "histram" => $histram, 'groups' => $groups));
|
||||
break;
|
||||
|
||||
case 'settings':
|
||||
|
||||
if (getPerm('PE_admin')){
|
||||
if ($_POST){
|
||||
$hdd = (int)$_POST['alerthdd'];
|
||||
$ram = (int)$_POST['alertram'];
|
||||
$autodelete = (int)$_POST['autodelete'];
|
||||
dbw_query(dbconn(),"UPDATE SYS SET `Value`='$hdd' WHERE `Option`='HDDALERT'");
|
||||
dbw_query(dbconn(),"UPDATE SYS SET `Value`='$ram' WHERE `Option`='RAMALERT'");
|
||||
dbw_query(dbconn(),"UPDATE SYS SET `Value`='$autodelete' WHERE `Option`='AUTODELETE'");
|
||||
}
|
||||
list($sys['HDDALERT'],$sys['RAMALERT'],$sys['AUTODELETE']) = array(percalertfor('HDD'),percalertfor('RAM'),getsysopt('AUTODELETE') );
|
||||
renderPage('a_settings.twig',array('sys' => $sys));
|
||||
}else{ //No tiene permiso más que para verse a si mismo
|
||||
sendmsg('error','No eres administrador');
|
||||
renderPage('err_403.twig');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'groups':
|
||||
$db_conn = dbconn();
|
||||
|
||||
if (isset($_GET['do'], $_GET['id_g']) && $_GET['do'] == 'deletegrp'){
|
||||
$ID_G = (int)$_GET['id_g'];
|
||||
dbw_query($db_conn,"DELETE FROM GROUPS WHERE ID_G='$ID_G'");
|
||||
}else if (isset($_GET['do'], $_GET['id_g'],$_POST['name'.$_GET['id_g']]) && $_GET['do'] == 'changename' && $_POST['name'.$_GET['id_g']] != ""){
|
||||
$ID_G = (int)$_GET['id_g'];
|
||||
$name = $_POST['name'.$ID_G];
|
||||
dbw_query($db_conn,"UPDATE GROUPS SET `Name`='$name' WHERE ID_G='$ID_G'");
|
||||
}
|
||||
|
||||
if (isset($_POST) && isset($_POST['newgrp'])){
|
||||
dbw_query($db_conn,"INSERT INTO GROUPS (`Name`) VALUES('$_POST[newgrp]')");
|
||||
}
|
||||
|
||||
//Load group names
|
||||
$groups = array();
|
||||
$sql = dbw_query($db_conn,"SELECT ID_G,`Name` FROM GROUPS");
|
||||
while ($line = dbw_fetch_array($db_conn,$sql)){
|
||||
$groups[] = array (
|
||||
'ID_G' => $line['ID_G'],
|
||||
'Name' => $line['Name']
|
||||
);
|
||||
}
|
||||
|
||||
renderPage('a_groups.twig', array('groups' => $groups));
|
||||
break;
|
||||
|
||||
//"Home"
|
||||
case 'index':
|
||||
default:
|
||||
$db_conn = dbconn();
|
||||
|
||||
//Calculemos estadísticas
|
||||
$servs = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM SERVERS")[0];
|
||||
|
||||
//Sacar datos de cada servidor
|
||||
$serverssql = dbw_query($db_conn,"SELECT ID_SERV FROM SERVERS"); //Todos los ID_SERV
|
||||
$numrows['all'] = dbw_num_rows($db_conn,$serverssql);
|
||||
$numrows['on'] = 0;
|
||||
$numrows['enabled'] = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM SERVERS WHERE `Enabled`=1")[0];
|
||||
|
||||
$SEnabled = 0;
|
||||
$STotal = 0;
|
||||
$SActive = 0;
|
||||
|
||||
while ($id = dbw_fetch_array($db_conn,$serverssql)){
|
||||
$server = serverData($id['ID_SERV']);
|
||||
if ($server['Online']){$numrows['on']++;}
|
||||
$servers[$id['ID_SERV']] = $server; //Insert data array
|
||||
|
||||
$STotal += $server['STotal'];
|
||||
$SEnabled += $server['SEnabled'];
|
||||
$SActive += $server['SActive'];
|
||||
}
|
||||
$numrows['off'] = $numrows['all'] - $numrows['on'];
|
||||
|
||||
$numrows['allsensors'] = $STotal + $numrows['all'];
|
||||
$numrows['activesensors'] = $SActive + $numrows['on'];
|
||||
|
||||
if (!isset($servers)){
|
||||
$servers = NULL;
|
||||
}
|
||||
renderPage('a_index.twig',array('servers' => $servers,'numrows' => $numrows));
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
69
ajaxfunc.php
Normal file
69
ajaxfunc.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
//File for doing some Ajax operations as toggle perms of things of servers
|
||||
if (file_exists(__DIR__ .'/config/config.php')){
|
||||
require_once __DIR__ .'/config/config.php';
|
||||
}
|
||||
require_once __DIR__ .'/functions.php';
|
||||
|
||||
switch ($_POST['do']){
|
||||
case 'toggleperm':
|
||||
$perm = $_POST['perm'];
|
||||
$ID_U = (int)trim($_POST['ID_U']);
|
||||
if (getPerm('PE_admin') || ($perm == 'SendMail' && $ID_U = $_SESSION['user']['ID_U'])){ //Solo el propio usuario puede cambiar la casilla de recibir correo aparte.
|
||||
|
||||
$resp = dbw_query_fetch_array(dbconn(),"SELECT ".$perm." FROM USERS WHERE ID_U='$ID_U'")[0];
|
||||
if ($resp){ //Si está, quitarle, y viceversa
|
||||
dbw_query(dbconn(),"UPDATE USERS SET ".$perm."=0 WHERE ID_U='$ID_U'");
|
||||
}else{
|
||||
dbw_query(dbconn(),"UPDATE USERS SET ".$perm."=1 WHERE ID_U='$ID_U'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'togglesvc':
|
||||
if (getPerm('PE_editserv')){
|
||||
$name = $_POST['name'];
|
||||
$ID_SERV = (int)$_POST['ID_SERV'];
|
||||
$resp = dbw_query_fetch_array(dbconn(),"SELECT * FROM S_SERVICES WHERE ID_SERV='$ID_SERV' AND `Name`='$name'");
|
||||
if ($resp['Enabled']){ //Si está, quitarle, y viceversa
|
||||
dbw_query(dbconn(),"UPDATE S_SERVICES SET `Enabled`=0 WHERE ID_SERV='$ID_SERV' AND `Name`='$name'");
|
||||
}else{
|
||||
dbw_query(dbconn(),"UPDATE S_SERVICES SET `Enabled`=1 WHERE ID_SERV='$ID_SERV' AND `Name`='$name'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'togglesrv':
|
||||
if (getPerm('PE_editserv')){
|
||||
$ID_SERV = (int)$_POST['ID_SERV'];
|
||||
$resp = dbw_query_fetch_array(dbconn(),"SELECT * FROM SERVERS WHERE ID_SERV='$ID_SERV'");
|
||||
if ($resp['Enabled']){ //Si está, quitarle, y viceversa
|
||||
dbw_query(dbconn(),"UPDATE SERVERS SET `Enabled`=0 WHERE ID_SERV='$ID_SERV'");
|
||||
dbw_query(dbconn(),"DELETE FROM P_ALERTS WHERE ID_SERV='$ID_SERV'");
|
||||
}else{
|
||||
dbw_query(dbconn(),"UPDATE SERVERS SET `Enabled`=1 WHERE ID_SERV='$ID_SERV'");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'updatesrv':
|
||||
if (getPerm('PE_editserv')){
|
||||
$ID_SERV = (int)$_POST['ID_SERV'];
|
||||
/*$resp = dbw_query_fetch_array(dbconn(),"SELECT * FROM SERVERS WHERE ID_SERV='$ID_SERV'");
|
||||
if ($resp['Enabled']){ //Si está, quitarle, y viceversa
|
||||
dbw_query(dbconn(),"UPDATE SERVERS SET `Enabled`=0 WHERE ID_SERV='$ID_SERV'");
|
||||
}else{
|
||||
dbw_query(dbconn(),"UPDATE SERVERS SET `Enabled`=1 WHERE ID_SERV='$ID_SERV'");
|
||||
}*/
|
||||
exec("php -f ".__DIR__ .'/cron/cron.php '.$ID_SERV);
|
||||
|
||||
sendmsg('debug','updatesrv');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'deloldlogs':
|
||||
if (getPerm('PE_admin')){
|
||||
$time = time() - (15 * 24 * 60 * 60);
|
||||
dbw_query(dbconn(),"DELETE FROM S_HISTRAM WHERE `Timestamp` < '$time'");
|
||||
dbw_query(dbconn(),"DELETE FROM S_HISTPING WHERE `Timestamp` < '$time'");
|
||||
dbw_query(dbconn(),"DELETE FROM S_HISTSERVICES WHERE `Timestamp` < '$time'");
|
||||
dbw_query(dbconn(),"DELETE FROM S_HDDSTAT WHERE `Timestamp` < '$time'");
|
||||
}
|
||||
}
|
||||
7
assets/css/bootstrap.min.css
vendored
7
assets/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
4223
assets/css/custom.css
Normal file
4223
assets/css/custom.css
Normal file
File diff suppressed because it is too large
Load Diff
135
assets/css/maps/jquery-jvectormap-2.0.3.css
Normal file
135
assets/css/maps/jquery-jvectormap-2.0.3.css
Normal file
@@ -0,0 +1,135 @@
|
||||
svg {
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.jvectormap-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.jvectormap-tip {
|
||||
position: absolute;
|
||||
display: none;
|
||||
border: solid 1px #CDCDCD;
|
||||
border-radius: 3px;
|
||||
background: #292929;
|
||||
color: white;
|
||||
font-family: sans-serif, Verdana;
|
||||
font-size: smaller;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.jvectormap-zoomin, .jvectormap-zoomout, .jvectormap-goback {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
border-radius: 3px;
|
||||
background: #292929;
|
||||
padding: 3px;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
line-height: 10px;
|
||||
text-align: center;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.jvectormap-zoomin, .jvectormap-zoomout {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.jvectormap-zoomin {
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.jvectormap-zoomout {
|
||||
top: 30px;
|
||||
}
|
||||
|
||||
.jvectormap-goback {
|
||||
bottom: 10px;
|
||||
z-index: 1000;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.jvectormap-spinner {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: center no-repeat url(data:image/gif;base64,R0lGODlhIAAgAPMAAP///wAAAMbGxoSEhLa2tpqamjY2NlZWVtjY2OTk5Ly8vB4eHgQEBAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAIAAgAAAE5xDISWlhperN52JLhSSdRgwVo1ICQZRUsiwHpTJT4iowNS8vyW2icCF6k8HMMBkCEDskxTBDAZwuAkkqIfxIQyhBQBFvAQSDITM5VDW6XNE4KagNh6Bgwe60smQUB3d4Rz1ZBApnFASDd0hihh12BkE9kjAJVlycXIg7CQIFA6SlnJ87paqbSKiKoqusnbMdmDC2tXQlkUhziYtyWTxIfy6BE8WJt5YJvpJivxNaGmLHT0VnOgSYf0dZXS7APdpB309RnHOG5gDqXGLDaC457D1zZ/V/nmOM82XiHRLYKhKP1oZmADdEAAAh+QQJCgAAACwAAAAAIAAgAAAE6hDISWlZpOrNp1lGNRSdRpDUolIGw5RUYhhHukqFu8DsrEyqnWThGvAmhVlteBvojpTDDBUEIFwMFBRAmBkSgOrBFZogCASwBDEY/CZSg7GSE0gSCjQBMVG023xWBhklAnoEdhQEfyNqMIcKjhRsjEdnezB+A4k8gTwJhFuiW4dokXiloUepBAp5qaKpp6+Ho7aWW54wl7obvEe0kRuoplCGepwSx2jJvqHEmGt6whJpGpfJCHmOoNHKaHx61WiSR92E4lbFoq+B6QDtuetcaBPnW6+O7wDHpIiK9SaVK5GgV543tzjgGcghAgAh+QQJCgAAACwAAAAAIAAgAAAE7hDISSkxpOrN5zFHNWRdhSiVoVLHspRUMoyUakyEe8PTPCATW9A14E0UvuAKMNAZKYUZCiBMuBakSQKG8G2FzUWox2AUtAQFcBKlVQoLgQReZhQlCIJesQXI5B0CBnUMOxMCenoCfTCEWBsJColTMANldx15BGs8B5wlCZ9Po6OJkwmRpnqkqnuSrayqfKmqpLajoiW5HJq7FL1Gr2mMMcKUMIiJgIemy7xZtJsTmsM4xHiKv5KMCXqfyUCJEonXPN2rAOIAmsfB3uPoAK++G+w48edZPK+M6hLJpQg484enXIdQFSS1u6UhksENEQAAIfkECQoAAAAsAAAAACAAIAAABOcQyEmpGKLqzWcZRVUQnZYg1aBSh2GUVEIQ2aQOE+G+cD4ntpWkZQj1JIiZIogDFFyHI0UxQwFugMSOFIPJftfVAEoZLBbcLEFhlQiqGp1Vd140AUklUN3eCA51C1EWMzMCezCBBmkxVIVHBWd3HHl9JQOIJSdSnJ0TDKChCwUJjoWMPaGqDKannasMo6WnM562R5YluZRwur0wpgqZE7NKUm+FNRPIhjBJxKZteWuIBMN4zRMIVIhffcgojwCF117i4nlLnY5ztRLsnOk+aV+oJY7V7m76PdkS4trKcdg0Zc0tTcKkRAAAIfkECQoAAAAsAAAAACAAIAAABO4QyEkpKqjqzScpRaVkXZWQEximw1BSCUEIlDohrft6cpKCk5xid5MNJTaAIkekKGQkWyKHkvhKsR7ARmitkAYDYRIbUQRQjWBwJRzChi9CRlBcY1UN4g0/VNB0AlcvcAYHRyZPdEQFYV8ccwR5HWxEJ02YmRMLnJ1xCYp0Y5idpQuhopmmC2KgojKasUQDk5BNAwwMOh2RtRq5uQuPZKGIJQIGwAwGf6I0JXMpC8C7kXWDBINFMxS4DKMAWVWAGYsAdNqW5uaRxkSKJOZKaU3tPOBZ4DuK2LATgJhkPJMgTwKCdFjyPHEnKxFCDhEAACH5BAkKAAAALAAAAAAgACAAAATzEMhJaVKp6s2nIkolIJ2WkBShpkVRWqqQrhLSEu9MZJKK9y1ZrqYK9WiClmvoUaF8gIQSNeF1Er4MNFn4SRSDARWroAIETg1iVwuHjYB1kYc1mwruwXKC9gmsJXliGxc+XiUCby9ydh1sOSdMkpMTBpaXBzsfhoc5l58Gm5yToAaZhaOUqjkDgCWNHAULCwOLaTmzswadEqggQwgHuQsHIoZCHQMMQgQGubVEcxOPFAcMDAYUA85eWARmfSRQCdcMe0zeP1AAygwLlJtPNAAL19DARdPzBOWSm1brJBi45soRAWQAAkrQIykShQ9wVhHCwCQCACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiRMDjI0Fd30/iI2UA5GSS5UDj2l6NoqgOgN4gksEBgYFf0FDqKgHnyZ9OX8HrgYHdHpcHQULXAS2qKpENRg7eAMLC7kTBaixUYFkKAzWAAnLC7FLVxLWDBLKCwaKTULgEwbLA4hJtOkSBNqITT3xEgfLpBtzE/jiuL04RGEBgwWhShRgQExHBAAh+QQJCgAAACwAAAAAIAAgAAAE7xDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfZiCqGk5dTESJeaOAlClzsJsqwiJwiqnFrb2nS9kmIcgEsjQydLiIlHehhpejaIjzh9eomSjZR+ipslWIRLAgMDOR2DOqKogTB9pCUJBagDBXR6XB0EBkIIsaRsGGMMAxoDBgYHTKJiUYEGDAzHC9EACcUGkIgFzgwZ0QsSBcXHiQvOwgDdEwfFs0sDzt4S6BK4xYjkDOzn0unFeBzOBijIm1Dgmg5YFQwsCMjp1oJ8LyIAACH5BAkKAAAALAAAAAAgACAAAATwEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GGl6NoiPOH16iZKNlH6KmyWFOggHhEEvAwwMA0N9GBsEC6amhnVcEwavDAazGwIDaH1ipaYLBUTCGgQDA8NdHz0FpqgTBwsLqAbWAAnIA4FWKdMLGdYGEgraigbT0OITBcg5QwPT4xLrROZL6AuQAPUS7bxLpoWidY0JtxLHKhwwMJBTHgPKdEQAACH5BAkKAAAALAAAAAAgACAAAATrEMhJaVKp6s2nIkqFZF2VIBWhUsJaTokqUCoBq+E71SRQeyqUToLA7VxF0JDyIQh/MVVPMt1ECZlfcjZJ9mIKoaTl1MRIl5o4CUKXOwmyrCInCKqcWtvadL2SYhyASyNDJ0uIiUd6GAULDJCRiXo1CpGXDJOUjY+Yip9DhToJA4RBLwMLCwVDfRgbBAaqqoZ1XBMHswsHtxtFaH1iqaoGNgAIxRpbFAgfPQSqpbgGBqUD1wBXeCYp1AYZ19JJOYgH1KwA4UBvQwXUBxPqVD9L3sbp2BNk2xvvFPJd+MFCN6HAAIKgNggY0KtEBAAh+QQJCgAAACwAAAAAIAAgAAAE6BDISWlSqerNpyJKhWRdlSAVoVLCWk6JKlAqAavhO9UkUHsqlE6CwO1cRdCQ8iEIfzFVTzLdRAmZX3I2SfYIDMaAFdTESJeaEDAIMxYFqrOUaNW4E4ObYcCXaiBVEgULe0NJaxxtYksjh2NLkZISgDgJhHthkpU4mW6blRiYmZOlh4JWkDqILwUGBnE6TYEbCgevr0N1gH4At7gHiRpFaLNrrq8HNgAJA70AWxQIH1+vsYMDAzZQPC9VCNkDWUhGkuE5PxJNwiUK4UfLzOlD4WvzAHaoG9nxPi5d+jYUqfAhhykOFwJWiAAAIfkECQoAAAAsAAAAACAAIAAABPAQyElpUqnqzaciSoVkXVUMFaFSwlpOCcMYlErAavhOMnNLNo8KsZsMZItJEIDIFSkLGQoQTNhIsFehRww2CQLKF0tYGKYSg+ygsZIuNqJksKgbfgIGepNo2cIUB3V1B3IvNiBYNQaDSTtfhhx0CwVPI0UJe0+bm4g5VgcGoqOcnjmjqDSdnhgEoamcsZuXO1aWQy8KAwOAuTYYGwi7w5h+Kr0SJ8MFihpNbx+4Erq7BYBuzsdiH1jCAzoSfl0rVirNbRXlBBlLX+BP0XJLAPGzTkAuAOqb0WT5AH7OcdCm5B8TgRwSRKIHQtaLCwg1RAAAOwAAAAAAAAAAAA==);
|
||||
}
|
||||
|
||||
.jvectormap-legend-title {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-h {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-v {
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.jvectormap-legend {
|
||||
background: black;
|
||||
color: white;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-h .jvectormap-legend {
|
||||
float: left;
|
||||
margin: 0 10px 10px 0;
|
||||
padding: 3px 3px 1px 3px;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-h .jvectormap-legend .jvectormap-legend-tick {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-v .jvectormap-legend {
|
||||
margin: 10px 10px 0 0;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-h .jvectormap-legend-tick {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-h .jvectormap-legend-tick-sample {
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-v .jvectormap-legend-tick-sample {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.jvectormap-legend-tick-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-h .jvectormap-legend-tick-text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jvectormap-legend-cnt-v .jvectormap-legend-tick-text {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
line-height: 20px;
|
||||
padding-left: 3px;
|
||||
}
|
||||
1755
assets/css/panel.css
1755
assets/css/panel.css
File diff suppressed because it is too large
Load Diff
@@ -1,95 +0,0 @@
|
||||
/* Styles added to template */
|
||||
|
||||
/* Patch for card-block */
|
||||
.card-block {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.mhcenter {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Colours */
|
||||
.green{
|
||||
color:green;
|
||||
}
|
||||
.blue{
|
||||
color:#2727d8;
|
||||
}
|
||||
.grey{
|
||||
color:#73737b;
|
||||
}
|
||||
.orange{
|
||||
color:#d48c08;
|
||||
}
|
||||
.red{
|
||||
color:#c21c1c;
|
||||
}
|
||||
.black {
|
||||
color:black;
|
||||
}
|
||||
|
||||
a.nochange{
|
||||
color:inherit;
|
||||
text-decoration:inherit;
|
||||
}
|
||||
|
||||
th.thgrp {
|
||||
font-size: 18px;
|
||||
background-color: #636363;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/** Tooltip */
|
||||
/** Source: http://stackoverflow.com/questions/1055581/how-do-i-add-a-tool-tip-to-a-span-element */
|
||||
[data-tooltip] {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
cursor: help;
|
||||
padding: 4px;
|
||||
}
|
||||
/* Tooltip styling */
|
||||
[data-tooltip]:before {
|
||||
content: attr(data-tooltip);
|
||||
display: none;
|
||||
position: absolute;
|
||||
background: #000;
|
||||
color: #fff;
|
||||
padding: 4px 8px;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
min-width: 130px;
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
}
|
||||
/* Dynamic horizontal centering */
|
||||
[data-tooltip]:before{
|
||||
left: 50%;
|
||||
-ms-transform: translateX(-50%);
|
||||
-moz-transform: translateX(-50%);
|
||||
-webkit-transform: translateX(-50%);
|
||||
transform: translateX(-50%);
|
||||
bottom: 100%;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
/* Tooltip arrow styling/placement */
|
||||
[data-tooltip]:after {
|
||||
content: '';
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
left: 50%;
|
||||
margin-left: -6px;
|
||||
bottom: 100%;
|
||||
border-width: 6px 6px 0;
|
||||
border-top-color: #000;
|
||||
}
|
||||
[data-tooltip]:hover:before,
|
||||
[data-tooltip]:hover:after {
|
||||
display: block;
|
||||
z-index: 50;
|
||||
}
|
||||
Binary file not shown.
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Generated by Fontastic.me</metadata>
|
||||
<defs>
|
||||
<font id="checkserver" horiz-adv-x="512">
|
||||
<font-face font-family="checkserver" units-per-em="512" ascent="480" descent="-32"/>
|
||||
<missing-glyph horiz-adv-x="512" />
|
||||
|
||||
<glyph glyph-name="question-circle" unicode="a" d="M293 119l0 55c0 2-1 5-3 6-2 2-4 3-7 3l-54 0c-3 0-5-1-7-3-2-1-3-4-3-6l0-55c0-3 1-5 3-7 2-1 4-2 7-2l54 0c3 0 5 1 7 2 2 2 3 4 3 7z m73 192c0 17-6 32-16 46-11 15-24 26-40 34-16 7-32 11-48 11-47 0-82-20-106-61-3-4-2-8 2-12l38-28c1-1 3-2 5-2 3 0 6 1 7 4 10 13 19 21 25 26 6 4 15 7 24 7 10 0 18-3 25-8 7-5 11-10 11-17 0-7-2-13-6-17-4-4-10-9-20-13-12-5-23-13-33-25-10-11-15-23-15-35l0-11c0-2 1-5 3-6 2-2 4-3 7-3l54 0c3 0 5 1 7 3 2 1 3 4 3 6 0 4 2 9 6 14 4 6 9 11 15 15 6 3 11 6 14 8 4 2 8 5 13 10 6 4 10 9 13 13 3 5 6 11 8 18 3 7 4 14 4 23z m109-55c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
||||
<glyph glyph-name="home-house-streamline" unicode="b" d="M437 224c-6 0-10-5-10-11l0-192-107 0 0 139-128 0 0-139-107 0 0 203c0 6-4 11-10 11-6 0-11-5-11-11l0-224 149 0 0 139 86 0 0-139 149 0 0 213c0 6-5 11-11 11z m72 18l-253 242-253-242c-4-4-4-10 0-15 4-4 11-4 15 0l238 228 238-228c2-2 5-3 7-3 3 0 6 1 8 3 4 5 4 11 0 15z m-168 185l64 0 0-64c0-6 5-11 11-11 6 0 11 5 11 11l0 85-86 0c-6 0-10-5-10-11 0-6 4-10 10-10z"/>
|
||||
<glyph glyph-name="edit-modify-streamline" unicode="c" d="M384 267c-6 0-11-5-11-11l0-235-352 0 0 427 288 0c6 0 11 5 11 11 0 6-5 10-11 10l-309 0 0-469 395 0 0 256c0 6-5 11-11 11z m126 224c-6 13-18 21-31 21-8 0-16-3-22-10l-30-30c0 0 0 0 0 0 0 0 0 0 0 0l-174-173c0-1-1-2-2-3l-30-60c-2-5-1-10 2-13 2-2 5-3 8-3 1 0 3 0 5 1l60 30c1 1 2 2 3 2l203 204c10 10 13 22 8 34z m-225-221l-30-15 15 30 164 165 16-16z m202 202l-22-22-15 15 22 22c2 3 5 4 7 4 5 0 9-4 11-8 2-4 1-7-3-11z"/>
|
||||
<glyph glyph-name="settings-streamline-1" unicode="d" d="M480 309l-40 0c-4 14-9 27-16 40l28 28c6 6 9 14 9 22 0 9-3 17-9 23l-30 30c-12 12-33 12-45 0l-28-28c-13 7-26 12-40 16l0 40c0 18-14 32-32 32l-42 0c-18 0-32-14-32-32l0-40c-14-4-27-9-40-16l-28 28c-12 12-33 12-45 0l-30-30c-13-13-13-33 0-45l28-28c-7-13-12-26-16-40l-40 0c-9 0-17-3-23-9-6-6-9-14-9-23l0-42c0-18 14-32 32-32l40 0c4-14 9-27 16-40l-28-28c-6-6-10-14-10-22 0-9 4-17 10-23l30-30c12-12 33-12 45 0l28 28c13-7 26-12 40-16l0-40c0-18 14-32 32-32l42 0c18 0 32 14 32 32l0 40c14 4 27 9 40 16l28-28c12-12 33-12 45 0l30 30c13 13 13 33 0 45l-28 28c7 13 12 26 16 40l40 0c9 0 17 3 23 9 6 6 9 14 9 23l0 42c0 18-14 32-32 32z m11-74c0-3-1-6-3-8-2-2-5-3-8-3l-48 0c-5 0-9-3-10-8-4-17-11-34-20-49-3-4-2-9 1-13l34-34c4-4 4-11 0-15l-30-30c-4-4-11-4-15 0l-34 34c-4 3-9 4-13 1-15-9-32-16-49-20-5-1-8-5-8-10l0-48c0-6-5-11-11-11l-42 0c-6 0-11 5-11 11l0 48c0 5-3 9-8 10-17 4-34 11-49 20-1 2-3 2-5 2-3 0-6-1-8-3l-34-34c-4-4-11-4-15 0l-30 30c-2 2-3 5-3 8 0 2 1 5 3 7l34 34c3 4 4 9 1 13-9 15-16 32-20 49-1 5-5 8-10 8l-48 0c-6 0-11 5-11 11l0 42c0 3 1 6 3 8 2 2 5 3 8 3l48 0c5 0 9 3 10 8 4 17 11 34 20 49 3 4 2 9-1 13l-34 34c-4 4-4 11 0 15l30 30c4 4 11 4 15 0l34-34c4-3 9-4 13-1 15 9 32 16 49 20 5 1 8 5 8 10l0 48c0 6 5 11 11 11l42 0c6 0 11-5 11-11l0-48c0-5 3-9 8-10 17-4 34-11 49-20 4-3 9-2 13 1l34 34c4 4 11 4 15 0l30-30c2-2 3-5 3-8 0-2-1-5-3-7l-34-34c-3-4-4-9-1-13 9-15 16-32 20-49 1-5 5-8 10-8l48 0c6 0 11-5 11-11z m-235 128c-59 0-107-48-107-107 0-59 48-107 107-107 59 0 107 48 107 107 0 59-48 107-107 107z m0-192c-47 0-85 38-85 85 0 47 38 85 85 85 47 0 85-38 85-85 0-47-38-85-85-85z"/>
|
||||
<glyph glyph-name="folder-o" unicode="e" d="M457 137l0 201c0 8-3 14-8 20-5 5-12 8-19 8l-201 0c-8 0-15 2-20 8-5 5-8 12-8 19l0 18c0 8-3 15-8 20-5 5-12 8-19 8l-92 0c-7 0-14-3-19-8-5-5-8-12-8-20l0-274c0-7 3-14 8-19 5-6 12-8 19-8l348 0c7 0 14 2 19 8 5 5 8 12 8 19z m37 201l0-201c0-17-7-32-19-45-13-13-28-19-45-19l-348 0c-17 0-32 6-45 19-12 13-19 28-19 45l0 274c0 18 7 33 19 46 13 12 28 18 45 18l92 0c17 0 32-6 45-18 12-13 19-28 19-46l0-9 192 0c17 0 32-6 45-19 12-12 19-27 19-45z"/>
|
||||
<glyph glyph-name="folder-open-o" unicode="f" d="M491 246c0 7-5 10-16 10l-310 0c-8 0-16-2-25-6-9-4-15-9-20-15l-84-104c-4-4-5-8-5-11 0-7 5-10 15-10l311 0c7 0 15 2 24 6 9 4 16 9 20 15l84 104c4 4 6 8 6 11z m-326 47l219 0 0 45c0 8-3 14-8 20-5 5-12 8-19 8l-165 0c-8 0-14 2-19 8-6 5-8 12-8 19l0 18c0 8-3 15-8 20-6 5-12 8-20 8l-91 0c-8 0-14-3-20-8-5-5-8-12-8-20l0-243 73 90c9 10 20 18 34 25 13 6 27 10 40 10z m362-47c0-12-4-23-13-34l-84-104c-8-10-20-18-33-25-14-7-28-10-40-10l-311 0c-18 0-33 6-45 19-13 13-19 28-19 45l0 274c0 18 6 33 19 46 12 12 27 18 45 18l91 0c18 0 33-6 45-18 13-13 19-28 19-46l0-9 156 0c17 0 32-6 45-19 12-12 19-27 19-45l0-45 54 0c11 0 20-3 29-7 8-5 15-12 19-21 3-6 4-12 4-19z"/>
|
||||
<glyph glyph-name="sign-out" unicode="g" d="M201 101c0-1 0-3 0-6 1-3 1-6 1-8-1-2-1-4-1-6-1-3-2-5-3-6-2-1-4-2-6-2l-91 0c-23 0-42 8-59 24-16 16-24 36-24 58l0 202c0 22 8 42 24 58 17 16 36 24 59 24l91 0c2 0 5-1 6-3 2-2 3-4 3-6 0-1 0-3 0-6 1-3 1-6 1-8-1-2-1-4-1-6-1-3-2-5-3-6-2-1-4-2-6-2l-91 0c-13 0-24-4-33-13-9-9-13-20-13-32l0-202c0-12 4-23 13-32 9-9 20-13 33-13l89 0 3-1 3 0 3-2 2-3z m265 155c0-5-2-9-5-13l-156-155c-3-4-7-6-12-6-5 0-10 2-13 6-4 3-6 8-6 13l0 82-128 0c-5 0-9 2-13 5-3 4-5 8-5 13l0 110c0 5 2 9 5 13 4 3 8 5 13 5l128 0 0 82c0 5 2 10 6 13 3 4 8 6 13 6 5 0 9-2 12-6l156-155c3-4 5-8 5-13z"/>
|
||||
<glyph glyph-name="times" unicode="h" d="M426 134c0-7-3-14-8-19l-39-39c-5-5-12-8-20-8-7 0-14 3-19 8l-84 84-84-84c-5-5-12-8-19-8-8 0-15 3-20 8l-39 39c-5 5-8 12-8 19 0 8 3 14 8 20l84 84-84 84c-5 5-8 12-8 19 0 8 3 14 8 20l39 38c5 6 12 8 20 8 7 0 14-2 19-8l84-84 84 84c5 6 12 8 19 8 8 0 15-2 20-8l39-38c5-6 8-12 8-20 0-7-3-14-8-19l-84-84 84-84c5-6 8-12 8-20z"/>
|
||||
<glyph glyph-name="sign-in" unicode="i" d="M375 256c0-5-2-9-6-13l-155-155c-4-4-8-6-13-6-5 0-9 2-13 6-3 3-5 8-5 13l0 82-128 0c-5 0-9 2-13 5-4 4-5 8-5 13l0 110c0 5 1 9 5 13 4 3 8 5 13 5l128 0 0 82c0 5 2 10 5 13 4 4 8 6 13 6 5 0 9-2 13-6l155-155c4-4 6-8 6-13z m100 101l0-202c0-22-8-42-24-58-16-16-35-24-58-24l-91 0c-3 0-5 1-7 3-2 2-2 4-2 6 0 1-1 3-1 6 0 3 0 6 0 8 0 2 1 4 1 6 0 3 1 5 3 6 1 1 3 2 6 2l91 0c13 0 23 4 32 13 9 9 14 20 14 32l0 202c0 12-5 23-14 32-9 9-19 13-32 13l-89 0-3 1-4 0-2 2-2 3 0 3c0 1-1 3-1 6 0 3 0 6 0 8 0 2 1 4 1 6 0 3 1 5 3 6 1 1 3 2 6 2l91 0c23 0 42-8 58-24 16-16 24-36 24-58z"/>
|
||||
<glyph glyph-name="file-submodule" unicode="j" d="M448 256c-16 0-96 0-96 0 0 16-16 32-32 32-16 0-48 0-64 0-16 0-32-16-32-32 0-16 0-160 0-160l256 0c0 0 0 112 0 128 0 16-16 32-32 32z m-128-32l-64 0c0 0 0 8 0 16 0 7 8 16 16 16 9 0 24 0 32 0 8 0 16-8 16-16 0-9 0-16 0-16z m128 160c-16 0-168 0-176 0-8 0-16 8-16 16 0 7 0 0 0 16 0 16-16 32-32 32-16 0-144 0-160 0-16 0-32-16-32-32 0-16 0-320 0-320l160 0c0 0 0 176 0 192 0 16 16 32 32 32 16 0 112 0 128 0 16 0 32-16 32-32l96 0c0-16 0 48 0 64 0 16-16 32-32 32z m-224 0l-160 0c0 0 0 8 0 16 0 8 8 16 16 16 8 0 120 0 128 0 8 0 16-9 16-16 0-8 0-16 0-16z"/>
|
||||
<glyph glyph-name="exclamation-triangle" unicode="k" d="M293 119l0 54c0 3-1 5-3 7-2 2-4 3-7 3l-54 0c-3 0-5-1-7-3-2-2-3-4-3-7l0-54c0-3 1-5 3-7 2-1 4-2 7-2l54 0c3 0 5 1 7 2 2 2 3 4 3 7z m-1 107l5 131c0 2-1 4-3 6-2 2-4 3-7 3l-62 0c-3 0-5-1-7-3-2-2-3-4-3-6l5-131c0-2 1-3 3-5 1-1 4-2 6-2l53 0c3 0 5 1 7 2 2 2 3 3 3 5z m-4 267l219-402c7-12 7-24 0-36-3-6-8-10-13-14-6-3-12-4-19-4l-438 0c-7 0-13 1-19 4-5 4-10 8-13 14-7 12-7 24 0 36l219 402c3 6 8 10 13 14 6 3 12 5 19 5 7 0 13-2 19-5 5-4 10-8 13-14z"/>
|
||||
<glyph glyph-name="eye" unicode="l" d="M475 238c-29 45-65 78-108 101 11-20 17-42 17-65 0-35-13-65-38-90-25-25-55-38-90-38-35 0-65 13-90 38-25 25-38 55-38 90 0 23 6 45 17 65-43-23-79-56-108-101 25-39 57-70 95-94 38-23 79-34 124-34 45 0 86 11 124 34 38 24 70 55 95 94z m-205 109c0 4-2 7-4 10-3 3-6 4-10 4-24 0-44-8-61-25-17-17-26-38-26-62 0-4 1-7 4-9 3-3 6-4 10-4 4 0 7 1 10 4 2 2 4 5 4 9 0 17 5 31 17 42 12 12 26 18 42 18 4 0 7 1 10 4 2 2 4 6 4 9z m242-109c0-7-2-13-6-20-26-44-62-79-107-105-45-27-93-40-143-40-50 0-98 13-143 40-45 26-81 61-107 105-4 7-6 13-6 20 0 6 2 13 6 19 26 44 62 79 107 106 45 26 93 39 143 39 50 0 98-13 143-39 45-27 81-62 107-106 4-6 6-13 6-19z"/>
|
||||
<glyph glyph-name="browser-streamline-window" unicode="m" d="M459 448l-406 0c-29 0-53-24-53-53l0-299c0-29 24-53 53-53l406 0c29 0 53 24 53 53l0 299c0 29-24 53-53 53z m-406-21l406 0c17 0 32-15 32-32l0-54-470 0 0 54c0 17 15 32 32 32z m406-363l-406 0c-17 0-32 14-32 32l0 224 470 0 0-224c0-18-15-32-32-32z m-352 320c0-12-10-21-22-21-11 0-21 9-21 21 0 12 10 21 21 21 12 0 22-9 22-21z m64 0c0-12-10-21-22-21-11 0-21 9-21 21 0 12 10 21 21 21 12 0 22-9 22-21z m64 0c0-12-10-21-22-21-11 0-21 9-21 21 0 12 10 21 21 21 12 0 22-9 22-21z"/>
|
||||
<glyph glyph-name="coffee-streamline" unicode="n" d="M373 0l-256 0c-5 0-10 4-10 10l-22 341c0 3 1 6 3 8 2 2 5 4 8 4l299 0c3 0 5-2 7-4 2-2 3-5 3-8l-21-341c0-6-5-10-11-10z m-246 21l236 0 20 320-276 0z m289 320l-341 0c-6 0-11 5-11 11l0 85c0 6 5 11 11 11l341 0c6 0 11-5 11-11l0-85c0-6-5-11-11-11z m-331 22l320 0 0 64-320 0z m310 64c0 0 0 0 0 0l-299 0c-3 0-7 1-9 4-2 3-2 6-1 10l21 64c2 4 6 7 10 7l256 0c5 0 9-3 10-7l21-62c1-2 2-4 2-6 0-6-5-10-11-10z m-284 21l269 0-14 43-241 0z m278-192l-288 0c-6 0-10 5-10 11 0 6 4 10 10 10l288 0c6 0 11-4 11-10 0-6-5-11-11-11z m-280-107l272 0 0-21-272 0z m168 43l-64 0c-6 0-10 5-10 11 0 6 4 10 10 10l64 0c6 0 11-4 11-10 0-6-5-11-11-11z"/>
|
||||
<glyph glyph-name="notebook-streamline" unicode="o" d="M331 427l-150 0 0-107 150 0z m-22-86l-106 0 0 64 106 0z m139 118l-11 0 0 53-384 0 0-85-21 0 0-22 21 0 0-42-21 0 0-22 21 0 0-42-21 0 0-22 21 0 0-42-21 0 0-22 21 0 0-42-21 0 0-22 21 0 0-42-21 0 0-22 21 0 0-85 384 0 0 96 11 0c24 0 43 19 43 43l0 277c0 24-19 43-43 43z m0-22c12 0 21-9 21-21l0-43-32 0 0 64z m-11-149l0 64 32 0 0-64z m32-21l0-64-32 0 0 64z m-53-246l-341 0 0 64 21 0 0 22-21 0 0 42 21 0 0 22-21 0 0 42 21 0 0 22-21 0 0 42 21 0 0 22-21 0 0 42 21 0 0 22-21 0 0 42 21 0 0 22-21 0 0 64 341 0z m32 96l-11 0 0 64 32 0 0-42c0-12-9-22-21-22z"/>
|
||||
<glyph glyph-name="receipt-shopping-streamline" unicode="p" d="M256 395l43 0c6 0 10 4 10 10 0 6-4 11-10 11l-43 0c-6 0-11-5-11-11 0-6 5-10 11-10z m139-22l-118 0c-6 0-10-4-10-10 0-6 4-11 10-11l118 0c6 0 10 5 10 11 0 6-4 10-10 10z m-150-64l139 0c6 0 11 5 11 11 0 6-5 11-11 11l-139 0c-6 0-10-5-10-11 0-6 4-11 10-11z m150-21l-150 0c-6 0-10-5-10-11 0-6 4-10 10-10l150 0c6 0 10 4 10 10 0 6-4 11-10 11z m-22-64c6 0 11 5 11 11 0 6-5 10-11 10l-128 0c-6 0-10-4-10-10 0-6 4-11 10-11z m11-21l-149 0c-6 0-11-5-11-11 0-6 5-11 11-11l149 0c6 0 11 5 11 11 0 6-5 11-11 11z m96 309l-266 0c-25 0-32-28-33-43 0-2 2-192-19-309l-98 0c-9 0-17-3-23-9-12-12-12-34-12-58 0-21 1-44-10-55-4-4-10-6-19-6l0-21 266 0c15 0 26 4 35 12 8 8 11 19 14 30l79 0c9 0 18 4 25 12 45 46 51 250 50 351l43 0 0 11c0 32-4 85-32 85z m-194-474c-5-4-11-6-20-6l-225 0c10 17 10 40 10 61 0 18-1 37 6 43 1 1 2 3 7 3l236 0c-5-13-5-29-5-46 1-21 1-44-9-55z m31 55c0 18 0 37 6 43 1 1 3 3 7 3 4 0 8-1 10-3 4-4 4-14 4-24-1-12-1-26 5-37l-32 0c0 6 0 12 0 18z m87-13c-5-5-9-5-10-5-11 0-19 2-23 6-6 6-6 19-6 31 0 14 0 29-10 39-6 6-14 9-25 9l-146 0c21 119 19 301 19 309 0 0 1 22 11 22l238 0c-3-8-4-16-5-22 3-93 0-345-43-389z m65 357c0 16 0 27 0 32 0 0 1 20 10 22l0 0c6-4 10-28 11-54z"/>
|
||||
<glyph glyph-name="bubble-comment-streamline-talk" unicode="q" d="M480 469l-448 0c-18 0-32-14-32-32l0-277c0-18 14-32 32-32l32 0 0-100 100 100 316 0c18 0 32 14 32 32l0 277c0 18-14 32-32 32z m11-309c0-6-5-11-11-11l-324 0-71-70 0 70-53 0c-6 0-11 5-11 11l0 277c0 6 5 11 11 11l448 0c6 0 11-5 11-11z m-299 139c0-12-10-22-21-22-12 0-22 10-22 22 0 11 10 21 22 21 11 0 21-10 21-21z m171 0c0-12-10-22-22-22-11 0-21 10-21 22 0 11 10 21 21 21 12 0 22-10 22-21z m-86 0c0-12-9-22-21-22-12 0-21 10-21 22 0 11 9 21 21 21 12 0 21-10 21-21z"/>
|
||||
<glyph glyph-name="man-people-streamline-user" unicode="r" d="M461 143l-130 36 0 38c38 29 64 78 64 135 0 88-62 160-139 160-76 0-138-72-138-160 0-56 25-106 63-134l0-39-131-36c-30-11-50-39-50-71l0-72 512 0 0 72c0 32-20 60-51 71z m-205 348c51 0 94-39 110-93-4-4-10-6-18-6-21 1-50 19-61 40l-10 17-9-18c-9-18-25-28-46-32-28-5-58 5-71 11 18 48 59 81 105 81z m-116-139c0 13 1 26 4 38 20-10 52-17 82-12 22 4 39 14 52 30 18-21 46-36 70-37 0 0 1 0 2 0 8 0 15 2 21 5 2-8 2-16 2-24 0-76-52-139-117-139-64 0-116 63-116 139z m350-331l-468 0 0 51c0 23 14 43 34 50l147 41 0 42c16-9 34-13 53-13 19 0 37 4 53 12l0-41 146-41c21-7 35-27 35-50z"/>
|
||||
</font></defs></svg>
|
||||
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Binary file not shown.
@@ -1,184 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Font Reference - CheckServer</title>
|
||||
<link href="http://fonts.googleapis.com/css?family=Dosis:400,500,700" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<style type="text/css">html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-family:inherit;font-size:100%;vertical-align:baseline}body{line-height:1;color:#000;background:#fff}ol,ul{list-style:none}table{border-collapse:separate;border-spacing:0;vertical-align:middle}caption,th,td{text-align:left;font-weight:normal;vertical-align:middle}a img{border:none}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{font-family:'Dosis','Tahoma',sans-serif}.container{margin:15px auto;width:80%}h1{margin:40px 0 20px;font-weight:700;font-size:38px;line-height:32px;color:#fb565e}h2{font-size:18px;padding:0 0 21px 5px;margin:45px 0 0 0;text-transform:uppercase;font-weight:500}.small{font-size:14px;color:#a5adb4;}.small a{color:#a5adb4;}.small a:hover{color:#fb565e}.glyphs.character-mapping{margin:0 0 20px 0;padding:20px 0 20px 30px;color:rgba(0,0,0,0.5);border:1px solid #d8e0e5;-webkit-border-radius:3px;border-radius:3px;}.glyphs.character-mapping li{margin:0 30px 20px 0;display:inline-block;width:90px}.glyphs.character-mapping .icon{margin:10px 0 10px 15px;padding:15px;position:relative;width:55px;height:55px;color:#162a36 !important;overflow:hidden;-webkit-border-radius:3px;border-radius:3px;font-size:32px;}.glyphs.character-mapping .icon svg{fill:#000}.glyphs.character-mapping input{margin:0;padding:5px 0;line-height:12px;font-size:12px;display:block;width:100%;border:1px solid #d8e0e5;-webkit-border-radius:5px;border-radius:5px;text-align:center;outline:0;}.glyphs.character-mapping input:focus{border:1px solid #fbde4a;-webkit-box-shadow:inset 0 0 3px #fbde4a;box-shadow:inset 0 0 3px #fbde4a}.glyphs.character-mapping input:hover{-webkit-box-shadow:inset 0 0 3px #fbde4a;box-shadow:inset 0 0 3px #fbde4a}.glyphs.css-mapping{margin:0 0 60px 0;padding:30px 0 20px 30px;color:rgba(0,0,0,0.5);border:1px solid #d8e0e5;-webkit-border-radius:3px;border-radius:3px;}.glyphs.css-mapping li{margin:0 30px 20px 0;padding:0;display:inline-block;overflow:hidden}.glyphs.css-mapping .icon{margin:0;margin-right:10px;padding:13px;height:50px;width:50px;color:#162a36 !important;overflow:hidden;float:left;font-size:24px}.glyphs.css-mapping input{margin:0;margin-top:5px;padding:8px;line-height:16px;font-size:16px;display:block;width:150px;height:40px;border:1px solid #d8e0e5;-webkit-border-radius:5px;border-radius:5px;background:#fff;outline:0;float:right;}.glyphs.css-mapping input:focus{border:1px solid #fbde4a;-webkit-box-shadow:inset 0 0 3px #fbde4a;box-shadow:inset 0 0 3px #fbde4a}.glyphs.css-mapping input:hover{-webkit-box-shadow:inset 0 0 3px #fbde4a;box-shadow:inset 0 0 3px #fbde4a}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>CheckServer</h1>
|
||||
<p class="small">This font was created with<a href="http://fontastic.me/">Fontastic</a></p>
|
||||
<h2>CSS mapping</h2>
|
||||
<ul class="glyphs css-mapping">
|
||||
<li>
|
||||
<div class="icon icon-question-circle"></div>
|
||||
<input type="text" readonly="readonly" value="question-circle">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-home-house-streamline"></div>
|
||||
<input type="text" readonly="readonly" value="home-house-streamline">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-edit-modify-streamline"></div>
|
||||
<input type="text" readonly="readonly" value="edit-modify-streamline">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-settings-streamline-1"></div>
|
||||
<input type="text" readonly="readonly" value="settings-streamline-1">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-folder-o"></div>
|
||||
<input type="text" readonly="readonly" value="folder-o">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-folder-open-o"></div>
|
||||
<input type="text" readonly="readonly" value="folder-open-o">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-sign-out"></div>
|
||||
<input type="text" readonly="readonly" value="sign-out">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-times"></div>
|
||||
<input type="text" readonly="readonly" value="times">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-sign-in"></div>
|
||||
<input type="text" readonly="readonly" value="sign-in">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-file-submodule"></div>
|
||||
<input type="text" readonly="readonly" value="file-submodule">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-exclamation-triangle"></div>
|
||||
<input type="text" readonly="readonly" value="exclamation-triangle">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-eye"></div>
|
||||
<input type="text" readonly="readonly" value="eye">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-browser-streamline-window"></div>
|
||||
<input type="text" readonly="readonly" value="browser-streamline-window">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-coffee-streamline"></div>
|
||||
<input type="text" readonly="readonly" value="coffee-streamline">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-notebook-streamline"></div>
|
||||
<input type="text" readonly="readonly" value="notebook-streamline">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-receipt-shopping-streamline"></div>
|
||||
<input type="text" readonly="readonly" value="receipt-shopping-streamline">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-bubble-comment-streamline-talk"></div>
|
||||
<input type="text" readonly="readonly" value="bubble-comment-streamline-talk">
|
||||
</li>
|
||||
<li>
|
||||
<div class="icon icon-man-people-streamline-user"></div>
|
||||
<input type="text" readonly="readonly" value="man-people-streamline-user">
|
||||
</li>
|
||||
</ul>
|
||||
<h2>Character mapping</h2>
|
||||
<ul class="glyphs character-mapping">
|
||||
<li>
|
||||
<div data-icon="a" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="a">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="b" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="b">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="c" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="c">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="d" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="d">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="e" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="e">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="f" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="f">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="g" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="g">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="h" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="h">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="i" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="i">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="j" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="j">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="k" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="k">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="l" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="l">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="m" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="m">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="n" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="n">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="o" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="o">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="p" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="p">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="q" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="q">
|
||||
</li>
|
||||
<li>
|
||||
<div data-icon="r" class="icon"></div>
|
||||
<input type="text" readonly="readonly" value="r">
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<script>(function() {
|
||||
var glyphs, i, len, ref;
|
||||
|
||||
ref = document.getElementsByClassName('glyphs');
|
||||
for (i = 0, len = ref.length; i < len; i++) {
|
||||
glyphs = ref[i];
|
||||
glyphs.addEventListener('click', function(event) {
|
||||
if (event.target.tagName === 'INPUT') {
|
||||
return event.target.select();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,480 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noindex, noarchive">
|
||||
<title>Transfonter demo</title>
|
||||
<link href="stylesheet.css" rel="stylesheet">
|
||||
<style>
|
||||
/*
|
||||
http://meyerweb.com/eric/tools/css/reset/
|
||||
v2.0 | 20110126
|
||||
License: none (public domain)
|
||||
*/
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
menu, nav, output, ruby, section, summary,
|
||||
time, mark, audio, video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure,
|
||||
footer, header, hgroup, menu, nav, section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol, ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote, q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before, blockquote:after,
|
||||
q:before, q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
/* common styles */
|
||||
body {
|
||||
background: #f1f1f1;
|
||||
color: #000;
|
||||
}
|
||||
.page {
|
||||
background: #fff;
|
||||
width: 920px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 20px 0 20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.font-container {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
margin-bottom: 40px;
|
||||
line-height: 1.3;
|
||||
white-space: nowrap;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
h1 {
|
||||
position: relative;
|
||||
background: #444;
|
||||
font-size: 32px;
|
||||
color: #fff;
|
||||
padding: 10px 20px;
|
||||
margin: 0 -20px 12px -20px;
|
||||
}
|
||||
.letters {
|
||||
font-size: 25px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.s10:before {
|
||||
content: '10px';
|
||||
}
|
||||
.s11:before {
|
||||
content: '11px';
|
||||
}
|
||||
.s12:before {
|
||||
content: '12px';
|
||||
}
|
||||
.s14:before {
|
||||
content: '14px';
|
||||
}
|
||||
.s18:before {
|
||||
content: '18px';
|
||||
}
|
||||
.s24:before {
|
||||
content: '24px';
|
||||
}
|
||||
.s30:before {
|
||||
content: '30px';
|
||||
}
|
||||
.s36:before {
|
||||
content: '36px';
|
||||
}
|
||||
.s48:before {
|
||||
content: '48px';
|
||||
}
|
||||
.s60:before {
|
||||
content: '60px';
|
||||
}
|
||||
.s72:before {
|
||||
content: '72px';
|
||||
}
|
||||
.s10:before, .s11:before, .s12:before, .s14:before,
|
||||
.s18:before, .s24:before, .s30:before, .s36:before,
|
||||
.s48:before, .s60:before, .s72:before {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 10px;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
color: #999;
|
||||
padding-right: 6px;
|
||||
}
|
||||
pre {
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: 9px;
|
||||
margin: 0 0 10px;
|
||||
font-family: Monaco, Menlo, Consolas, "Courier New", monospace !important;
|
||||
font-size: 13px;
|
||||
line-height: 1.428571429;
|
||||
color: #333;
|
||||
font-weight: normal !important;
|
||||
font-style: normal !important;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #ccc;
|
||||
overflow-x: auto;
|
||||
border-radius: 4px;
|
||||
}
|
||||
pre:after {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
content: 'Usage';
|
||||
line-height: 1;
|
||||
padding: 5px 8px;
|
||||
font-size: 12px;
|
||||
color: #767676;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-right: none;
|
||||
border-top: none;
|
||||
border-radius: 0 4px 0 4px;
|
||||
z-index: 10;
|
||||
}
|
||||
/* responsive */
|
||||
@media (max-width: 959px) {
|
||||
.page {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: normal; font-style: italic;">
|
||||
<h1>Roboto Italic</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 300; font-style: italic;">
|
||||
<h1>Roboto Light Italic</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 900; font-style: normal;">
|
||||
<h1>Roboto Black</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: normal; font-style: normal;">
|
||||
<h1>Roboto</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: bold; font-style: normal;">
|
||||
<h1>Roboto Bold</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 500; font-style: italic;">
|
||||
<h1>Roboto Medium Italic</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 100; font-style: normal;">
|
||||
<h1>Roboto Thin</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 100;
|
||||
font-style: normal;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 100; font-style: italic;">
|
||||
<h1>Roboto Thin Italic</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 100;
|
||||
font-style: italic;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 900; font-style: italic;">
|
||||
<h1>Roboto Black Italic</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 900;
|
||||
font-style: italic;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: bold; font-style: italic;">
|
||||
<h1>Roboto Bold Italic</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 500; font-style: normal;">
|
||||
<h1>Roboto Medium</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo" style="font-family: 'Roboto'; font-weight: 300; font-style: normal;">
|
||||
<h1>Roboto Light</h1>
|
||||
<pre>.your-style {
|
||||
font-family: 'Roboto';
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
}</pre>
|
||||
<div class="font-container">
|
||||
<p class="letters">
|
||||
abcdefghijklmnopqrstuvwxyz <br />
|
||||
ABCDEFGHIJKLMNOPQRSTUVWXYZ <br /> 0123456789.:,;()*!?'@#<>$%&^+-=~
|
||||
</p>
|
||||
<p class="s10" style="font-size: 10px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s11" style="font-size: 11px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s12" style="font-size: 12px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s14" style="font-size: 14px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s18" style="font-size: 18px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s24" style="font-size: 24px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s30" style="font-size: 30px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s36" style="font-size: 36px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s48" style="font-size: 48px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s60" style="font-size: 60px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
<p class="s72" style="font-size: 72px;">The quick brown fox jumps over the lazy dog.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,74 +0,0 @@
|
||||
/* This stylesheet generated by Transfonter (https://transfonter.org) on October 22, 2017 9:57 PM */
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-Italic.woff2') format('woff2'),
|
||||
url('Roboto-Italic.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-LightItalic.woff2') format('woff2'),
|
||||
url('Roboto-LightItalic.woff') format('woff');
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-Regular.woff2') format('woff2'),
|
||||
url('Roboto-Regular.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-Bold.woff2') format('woff2'),
|
||||
url('Roboto-Bold.woff') format('woff');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-MediumItalic.woff2') format('woff2'),
|
||||
url('Roboto-MediumItalic.woff') format('woff');
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-BlackItalic.woff2') format('woff2'),
|
||||
url('Roboto-BlackItalic.woff') format('woff');
|
||||
font-weight: 900;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-BoldItalic.woff2') format('woff2'),
|
||||
url('Roboto-BoldItalic.woff') format('woff');
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-Medium.woff2') format('woff2'),
|
||||
url('Roboto-Medium.woff') format('woff');
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Roboto';
|
||||
src: url('Roboto-Light.woff2') format('woff2'),
|
||||
url('Roboto-Light.woff') format('woff');
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
@font-face {
|
||||
font-family: "checkserver";
|
||||
src:url("fonts/checkserver.eot");
|
||||
src:url("fonts/checkserver.eot?#iefix") format("embedded-opentype"),
|
||||
url("fonts/checkserver.woff") format("woff"),
|
||||
url("fonts/checkserver.ttf") format("truetype"),
|
||||
url("fonts/checkserver.svg#checkserver") format("svg");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
[data-icon]:before {
|
||||
font-family: "checkserver" !important;
|
||||
content: attr(data-icon);
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
font-variant: normal !important;
|
||||
text-transform: none !important;
|
||||
speak: none;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
[class^="icon-"]:before,
|
||||
[class*=" icon-"]:before {
|
||||
font-family: "checkserver" !important;
|
||||
font-style: normal !important;
|
||||
font-weight: normal !important;
|
||||
font-variant: normal !important;
|
||||
text-transform: none !important;
|
||||
speak: none;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-question-circle:before {
|
||||
content: "\61";
|
||||
}
|
||||
.icon-home-house-streamline:before {
|
||||
content: "\62";
|
||||
}
|
||||
.icon-edit-modify-streamline:before {
|
||||
content: "\63";
|
||||
}
|
||||
.icon-settings-streamline-1:before {
|
||||
content: "\64";
|
||||
}
|
||||
.icon-folder-o:before {
|
||||
content: "\65";
|
||||
}
|
||||
.icon-folder-open-o:before {
|
||||
content: "\66";
|
||||
}
|
||||
.icon-sign-out:before {
|
||||
content: "\67";
|
||||
}
|
||||
.icon-times:before {
|
||||
content: "\68";
|
||||
}
|
||||
.icon-sign-in:before {
|
||||
content: "\69";
|
||||
}
|
||||
.icon-file-submodule:before {
|
||||
content: "\6a";
|
||||
}
|
||||
.icon-exclamation-triangle:before {
|
||||
content: "\6b";
|
||||
}
|
||||
.icon-eye:before {
|
||||
content: "\6c";
|
||||
}
|
||||
.icon-browser-streamline-window:before {
|
||||
content: "\6d";
|
||||
}
|
||||
.icon-coffee-streamline:before {
|
||||
content: "\6e";
|
||||
}
|
||||
.icon-notebook-streamline:before {
|
||||
content: "\6f";
|
||||
}
|
||||
.icon-receipt-shopping-streamline:before {
|
||||
content: "\70";
|
||||
}
|
||||
.icon-bubble-comment-streamline-talk:before {
|
||||
content: "\71";
|
||||
}
|
||||
.icon-man-people-streamline-user:before {
|
||||
content: "\72";
|
||||
}
|
||||
68
assets/html/a_footer.twig
Normal file
68
assets/html/a_footer.twig
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
<div id="custom_notifications" class="custom-notifications dsp_none">
|
||||
<ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
<div id="notif-group" class="tabbed_notifications"></div>
|
||||
</div>
|
||||
|
||||
<!-- footer content -->
|
||||
|
||||
<footer>
|
||||
<div class="pull-right">
|
||||
Gentelella - Bootstrap Admin Template by <a href="https://colorlib.com">Colorlib</a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</footer>
|
||||
<!-- /footer content -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="custom_notifications" class="custom-notifications dsp_none">
|
||||
<ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
<div id="notif-group" class="tabbed_notifications"></div>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="vendors/fastclick/lib/fastclick.js"></script>
|
||||
|
||||
|
||||
<!-- gauge.js -->
|
||||
<script src="vendors/gauge.js/dist/gauge.min.js"></script>
|
||||
<!-- bootstrap-progressbar -->
|
||||
<script src="vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
|
||||
<!-- Skycons -->
|
||||
<script src="vendors/skycons/skycons.js"></script>
|
||||
<!-- DateJS -->
|
||||
<script src="vendors/DateJS/build/date.js"></script>
|
||||
<!-- bootstrap-daterangepicker -->
|
||||
<script src="vendors/moment/min/moment.min.js"></script>
|
||||
<script src="vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
|
||||
<!-- Datatables -->
|
||||
<script src="vendors/datatables.net/js/jquery.dataTables.min.js"></script>
|
||||
<script src="vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
|
||||
<script src="vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
|
||||
<script src="vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
|
||||
<script src="vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
|
||||
<script src="vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
|
||||
<script src="vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
|
||||
<script src="vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
|
||||
<script src="vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
|
||||
<script src="vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
|
||||
<script src="vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
|
||||
<script src="vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
|
||||
|
||||
<!-- PNotify -->
|
||||
<!--<script src="vendors/pnotify/dist/pnotify.js"></script>
|
||||
<script src="vendors/pnotify/dist/pnotify.buttons.js"></script>-->
|
||||
<!-- Custom Theme Scripts -->
|
||||
<script src="assets/js/custom.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
115
assets/html/a_groups.twig
Normal file
115
assets/html/a_groups.twig
Normal file
@@ -0,0 +1,115 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Opciones grupos.</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
|
||||
<form method="POST" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="newgrp">Añadir grupo: </span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="newgrp" name="newgrp" required="required" class="form-control col-md-7 col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Añadir</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<h3 class="text-muted font-13 m-b-30">
|
||||
Tabla de grupos</code>
|
||||
</h3>
|
||||
<table id="datatable" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th># </th>
|
||||
<th>Grupo </th>
|
||||
<th>Acciones </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for group in groups %}
|
||||
<tr>
|
||||
<td>{{group.ID_G}}</td>
|
||||
<td>{{group.Name}}</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-modal-changename_{{group.ID_G}}">Editar nombre</button>
|
||||
<button type="button" class="btn btn-danger" data-toggle="modal" data-target=".bs-modal-delete_{{group.ID_G}}">Borrar</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% for group in groups %}
|
||||
<div class="modal fade bs-modal-changename_{{group.ID_G}}" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=groups&id_g={{group.ID_G}}&do=changename" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Cambiando el nombre de {{group.Name}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Nuevo nombre: <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="name{{group.ID_G}}" name="name{{group.ID_G}}" required="required" class="form-control col-md-7 col-xs-12" value="{{group.Name}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<button type="submit" class="btn btn-danger">Cambiar nombre</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade bs-modal-delete_{{group.ID_G}}" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=groups&id_g={{group.ID_G}}&do=deletegrp" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">¿Borrar el grupo {{group.Name}}?</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<button type="submit" class="btn btn-danger">Borrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
216
assets/html/a_header.twig
Normal file
216
assets/html/a_header.twig
Normal file
@@ -0,0 +1,216 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<!-- Meta, title, CSS, favicons, etc. -->
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="assets/images/favicon.ico" type="image/ico" />
|
||||
|
||||
<title>Panel de administración</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Font Awesome -->
|
||||
<link href="vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
|
||||
<!-- NProgress -->
|
||||
<link href="vendors/nprogress/nprogress.css" rel="stylesheet">
|
||||
|
||||
<!-- bootstrap-progressbar -->
|
||||
<link href="vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
|
||||
<!-- bootstrap-daterangepicker -->
|
||||
<link href="vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
|
||||
|
||||
<!-- Datatables-->
|
||||
<link href="vendors/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
|
||||
<link href="vendors/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
|
||||
<link href="vendors/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
|
||||
<link href="vendors/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
|
||||
<link href="vendors/datatables.net-scroller-bs/css/scroller.bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Custom Theme Style -->
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="vendors/jquery/dist/jquery.min.js"></script>
|
||||
<!-- Chart.js -->
|
||||
<script src="vendors/Chart.js/dist/Chart.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="nav-md">
|
||||
<div class="container body">
|
||||
<div class="main_container">
|
||||
<div class="col-md-3 left_col">
|
||||
<div class="left_col scroll-view">
|
||||
<div class="navbar nav_title" style="border: 0;">
|
||||
<a href="admin.php" class="site_title"><i class="fa fa-server"></i> <span>CheckServer</span></a>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<!-- menu profile quick info -->
|
||||
<div class="profile clearfix">
|
||||
<div class="profile_pic">
|
||||
<!--<img src="images/img.jpg" alt="..." class="img-circle profile_img">-->
|
||||
</div>
|
||||
<div class="profile_info">
|
||||
<span>Bienvenido, {{user.Name}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /menu profile quick info -->
|
||||
|
||||
<br />
|
||||
|
||||
<!-- sidebar menu -->
|
||||
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
|
||||
<div class="menu_section">
|
||||
<h3>General</h3>
|
||||
<ul class="nav side-menu">
|
||||
<li>
|
||||
<a><i class="fa fa-home"></i> Inicio <span class="fa fa-chevron-down"></span></a>
|
||||
<ul class="nav child_menu">
|
||||
<li {% if namepage == 'index' or namepage == 'servers' %}class="current-page" {% endif %}><a href="admin.php">Vista general</a></li>
|
||||
<li><a href="admin.php">Vista Servidores</a></li>
|
||||
<!--<li><a href="index3.html">Vista Switchs</a></li>-->
|
||||
</ul>
|
||||
</li>
|
||||
<li><a><i class="fa fa-edit"></i> Gestiones <span class="fa fa-chevron-down"></span></a>
|
||||
<ul class="nav child_menu">
|
||||
<li {% if namepage == 'newserver' or namepage =='savenewserver' %}class="current-page" {% endif %}><a href="admin.php?page=newserver">Nuevo servidor</a></li>
|
||||
<li {% if namepage == 'users' %}class="current-page" {% endif %}><a href="admin.php?page=users">Usuarios</a></li>
|
||||
<li {% if namepage == 'groups' %}class="current-page" {% endif %}><a href="admin.php?page=groups">Grupos</a></li>
|
||||
<li {% if namepage == 'settings' %}class="current-page" {% endif %}><a href="admin.php?page=settings">Opciones</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /sidebar menu -->
|
||||
|
||||
<!-- /menu footer buttons -->
|
||||
<div class="sidebar-footer hidden-small">
|
||||
<a data-toggle="tooltip" data-placement="top" title="Configuración" href="admin.php?page=settings">
|
||||
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
|
||||
</a>
|
||||
<a data-toggle="tooltip" data-placement="top" title="Pantalla completa">
|
||||
<span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>
|
||||
</a>
|
||||
<a data-toggle="tooltip" data-placement="top" title="Lock" href="index.php?logout=1">
|
||||
<span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span>
|
||||
</a>
|
||||
<a data-toggle="tooltip" data-placement="top" title="Cerrar sesión" href="index.php?logout=1">
|
||||
<span class="glyphicon glyphicon-off" aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
<!-- /menu footer buttons -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- top navigation -->
|
||||
<div class="top_nav">
|
||||
<div class="nav_menu">
|
||||
<nav>
|
||||
<div class="nav toggle">
|
||||
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
|
||||
</div>
|
||||
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="">
|
||||
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<!--<img src="images/img.jpg" alt="">-->{{user.Name}}
|
||||
<span class=" fa fa-angle-down"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-usermenu pull-right">
|
||||
<!--<li><a href="javascript:;"> Profile</a></li>-->
|
||||
<li>
|
||||
<a href="javascript:;">
|
||||
<span>Opciones</span>
|
||||
</a>
|
||||
</li>
|
||||
<li><a href="index.php?logout=1"><i class="fa fa-sign-out pull-right"></i> Salir</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li role="presentation" class="dropdown">
|
||||
<a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-envelope-o"></i>
|
||||
<span class="badge bg-red">{{alerts|length}}</span>
|
||||
</a>
|
||||
<ul id="menu1" class="dropdown-menu list-unstyled msg_list" role="menu">
|
||||
{% for alert in alerts %}
|
||||
<li>
|
||||
<a href="admin.php?page=servers&id_serv={{alert.ID_SERV}}">
|
||||
<!--<span class="image"><img src="images/img.jpg" alt="Profile Image" /></span>-->
|
||||
<span>
|
||||
<span>{{alert.ServName}}</span>
|
||||
<span class="time">{{alert.Timestamp}}</span>
|
||||
</span>
|
||||
<span class="message">
|
||||
{{alert.Text}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /top navigation -->
|
||||
|
||||
<!-- page content -->
|
||||
<div class="right_col" role="main">
|
||||
|
||||
|
||||
{% if msg_e %}
|
||||
{% for string in msg_e %}
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="alert alert-warning alert-dismissible fade in" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{{string}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if msg %}
|
||||
{% for string in msg %}
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="alert alert-success alert-dismissible fade in" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{{string}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if msg_i %}
|
||||
{% for string in msg_i %}
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="alert alert-info alert-dismissible fade in" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{{string}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
108
assets/html/a_index.twig
Normal file
108
assets/html/a_index.twig
Normal file
@@ -0,0 +1,108 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
|
||||
<!-- top tiles -->
|
||||
<div class="row tile_count">
|
||||
<div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Servidores</span>
|
||||
<div class="count">{{numrows.all}}</div>
|
||||
<span class="count_bottom"><i class="green">{{numrows.enabled}} </i> Monitorizando</span>
|
||||
</div>
|
||||
<div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-clock-o"></i> Servidores encendidos</span>
|
||||
<div class="count">{{numrows.on}}</div>
|
||||
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>{{numrows.off}} </i> Apagados</span>
|
||||
</div>
|
||||
<div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
|
||||
<span class="count_top"><i class="fa fa-user"></i> Sensores</span>
|
||||
<div class="count">{{numrows.allsensors}}</div>
|
||||
<span class="count_bottom"><i class="green">{{numrows.activesensors}} </i> Activos</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /top tiles -->
|
||||
|
||||
<!-- Table -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Servidores <small>Estado rápido de los servidores</small> {% if user.PE_editserv == 1 or user.PE_admin == 1 %} <a class="btn btn-success" href="?page=newserver">Añadir servidor</a> {% endif %}</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<p class="text-muted font-13 m-b-30">
|
||||
Tabla de servidores</code>
|
||||
</p>
|
||||
<table id="datatable" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Servidor </th>
|
||||
<th>Grupo(s) </th>
|
||||
<th>Sistema Operativo </th>
|
||||
<th>RAM libre </th>
|
||||
<th class="column-title" style="display: table-cell;">Espacio libre (%) </th>
|
||||
<th>Servicios</th>
|
||||
<th>Uptime </th>
|
||||
<th>Ping </th>
|
||||
<th><span class="nobr">Action</span>
|
||||
</th>
|
||||
<th class="bulk-actions" colspan="7" style="display: none;">
|
||||
<a class="antoo" style="color:#fff; font-weight:500;">Bulk Actions ( <span class="action-cnt">1 Records Selected</span> ) <i class="fa fa-chevron-down"></i></a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for server in servers %}
|
||||
<tr {% if server.BadCreds == 1 and server.Enabled == 1 %}class="bgcolor-badinfo" data-toggle="tooltip" data-placement="top" title="Credenciales no válidas o faltantes."
|
||||
{% elseif server.BadCreds == 2 and server.Enabled == 1 %}
|
||||
class="bgcolor-badinfo" data-toggle="tooltip" data-placement="top" title="El servidor tiene problemas con WMI (Error 0x80041045)"
|
||||
{%else%}
|
||||
{% if server.Enabled == 1 %} {%if server.Online == 1 %}class="bgcolor-ok" {%endif%}{% elseif server.Enabled == 0 %}class="bgcolor-secondary"{%endif%}
|
||||
|
||||
{%endif%}
|
||||
>
|
||||
<td data-toggle="tooltip" data-placement="top" title="{{server.Description}}">{{server.Name}} ({{server.IP}}) {% if server.Online == 0 and server.Enabled == 1 %}<br/><i>Offline</i>{%endif%}{% if server.Enabled == 0 %}<br/><i>Deshabilitado</i>{%endif%}</td>
|
||||
<td>
|
||||
{% for ingrp in server.InGroups %}
|
||||
{{ingrp.Name}}
|
||||
{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
|
||||
</td>
|
||||
<td>{% if server.Version != "" %} {{server.Version}} {%else%}{{server.SO}}{%endif%} </td>
|
||||
<td class=" ">
|
||||
{{server.Freeram}}
|
||||
</td>
|
||||
<td {% if server.AlertHDD > 0 %} class="bg-danger" {% endif %}>
|
||||
{{server.HDDFastStats | raw}}
|
||||
</td>
|
||||
|
||||
<td {% if server.SInactive > 0 %} class="bgcolor-warn" {%endif%}>
|
||||
Monitorizando: {{server.SEnabled}}
|
||||
{% if server.SEnabled > 0 %}<br>Funcionando: {{server.SActive}} {% endif %}
|
||||
{% if server.SInactive > 0 %}<br>Parados: {{server.SInactive}} {% endif %}
|
||||
{% if server.SDisabled > 0 %}<br>Monitorización en pausa: {{server.SDisabled}} {% endif %}
|
||||
</td>
|
||||
<td>{{server.Uptime}}</td>
|
||||
{% if server.Enabled == 1 %}
|
||||
<td {% if server.Ping > -1 %}class="bgcolor-ok"{%else%}class="bgcolor-warn"{%endif%}>{{server.Ping}}ms</td>
|
||||
{% else %}
|
||||
<td></td>
|
||||
{% endif %}
|
||||
<td class=" last"><a class="btn btn-success" href="admin.php?page=servers&id_serv={{server.ID_SERV}}">Ver</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
138
assets/html/a_newserver.twig
Normal file
138
assets/html/a_newserver.twig
Normal file
@@ -0,0 +1,138 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
{% if mode != 'edit' %}
|
||||
<h2>Añadir nuevo servidor</h2>
|
||||
{% else %}
|
||||
<h2>Editar servidor {{server.Name}}</h2>
|
||||
{% endif %}
|
||||
<ul class="nav navbar-right panel_toolbox">
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<br />
|
||||
<form id="demo-form2" method="POST" action="?page={% if mode == 'edit' %}saveeditserver{% else %}savenewserver{% endif %}&id_serv={{server.ID_SERV}}" data-parsley-validate class="form-horizontal form-label-left">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Nombre del servidor <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="name" name="name" required="required" class="form-control col-md-7 col-xs-12" value="{{server.Name}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="IP">IP del servidor <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="IP" name="IP" required="required" class="form-control col-md-7 col-xs-12" value="{{server.IP}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="description">Descripción <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="description" name="description" required="required" class="form-control col-md-7 col-xs-12" value="{{server.Description}}"/>
|
||||
</div>
|
||||
</div>
|
||||
{% if mode != 'edit' %}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12">Sistema operativo</label>
|
||||
<div class="col-md-9 col-sm-9 col-xs-12">
|
||||
<div id="so" class="btn-group" data-toggle="buttons">
|
||||
<label class="btn btn-default {%if server.SO == 'WINDOWS' %} active {%endif%}" data-toggle-class="btn-primary" data-toggle-passive-class="btn-default" data-toggle="tooltip" data-placement="top" title="Trabaja con WMI para recoger datos. Soporte bueno desde Windows 2003/XP">
|
||||
<input type="radio" name="so" value="WINDOWS" {%if server.SO == 'WINDOWS' %} checked="checked" {%endif%}> Windows
|
||||
</label>
|
||||
{#<label class="btn btn-default {%if server.SO == 'LINUX_SYSTEMD' %} active {%endif%}" data-toggle-class="btn-primary" data-toggle-passive-class="btn-default" data-toggle="tooltip" data-placement="top" title="Sistemas Linux que usen Systemd como Ubuntu 14.04+, Debian 8+...">
|
||||
<input type="radio" name="so" value="LINUX_SYSTEMD" {%if server.SO == 'LINUX_SYSTEMD' %} checked="checked" {%endif%}> Linux (Systemd)
|
||||
</label>
|
||||
<label class="btn btn-default {%if server.SO == 'LINUX_SERVICE' %} active {%endif%}" data-toggle-class="btn-primary" data-toggle-passive-class="btn-default" data-toggle="tooltip" data-placement="top" title="Sistemas Linux que usen el comando service. Puede ser Centos o Ubuntu anterior a 14.04">
|
||||
<input type="radio" name="so" value="LINUX_SERVICE" {%if server.SO == 'LINUX_SERVICE' %} checked="checked" {%endif%}> Linux (Service)
|
||||
</label>#}
|
||||
<label class="btn btn-default {%if server.SO == 'LINUX' %} active {%endif%}" data-toggle-class="btn-primary" data-toggle-passive-class="btn-default" data-toggle="tooltip" data-placement="top" title="Sistemas Linux. Soporta Systemd y service, y como fallback por procesos">
|
||||
<input type="radio" name="so" value="LINUX" {%if server.SO == 'LINUX' %} checked="checked" {%endif%}> Linux
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if mode == 'edit' %}
|
||||
<p>Cambio de usuario y password si se escribe una</p>
|
||||
{% else %}
|
||||
<p>Usuario y contraseña son necesarias para monitorizar sus datos y servicios, no así para el ping</p>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="userserv">Usuario (Opcional)<br/><small>Dominio\Usuario</small>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="userserv" name="userserv" class="form-control col-md-7 col-xs-12" autocomplete="off" value="{{server.User}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="passw">Contraseña (Opcional)
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="password" id="passw" name="passw" class="form-control col-md-7 col-xs-12" autocomplete="off" value="{{server.Password}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('userserv').value='';
|
||||
document.getElementById('passw').value='';
|
||||
</script>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="ssh">Puerto SSH (Linux)<br/><small>Solo si no es el 22</small>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="ssh" name="ssh" class="form-control col-md-7 col-xs-12" value="{{server.ssh}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ln_solid"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
|
||||
<button class="btn btn-warning" onClick="history.back();" type="button">Cancelar</button>
|
||||
<!--<button class="btn btn-primary" type="reset">Poner en blanco</button>-->
|
||||
<button type="submit" class="btn btn-success">{% if mode == 'edit' %}Guardar{% else %}Añadir{% endif %}</button>
|
||||
{% if mode == 'edit' %}
|
||||
<button onClick="return false;" class="btn btn-danger" data-toggle="modal" data-target=".bs-modal-deletesrv">Borrar servidor</button>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{# Modal de borrado de servidor #}
|
||||
{% if mode == 'edit' %}
|
||||
<div class="modal fade bs-modal-deletesrv" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=deleteserver&id_serv={{server.ID_SERV}}" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Borrar servidor</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Se procederá a borrar el servidor {{server.Name}}, es irreversible</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-error">Borrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
384
assets/html/a_server.twig
Normal file
384
assets/html/a_server.twig
Normal file
@@ -0,0 +1,384 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
<!-- Table -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Servidor: {{server.Name}} <small><i>{{server.IP}}</i></small> </h2>
|
||||
<div class="clearfix"></div>
|
||||
<p>{{server.Version}}</p>
|
||||
<div class="clearfix"></div>
|
||||
{% if server.Online == 0 %}<h2 class="text-danger">Offline</h2>{%endif%}
|
||||
{% if server.BadCreds == 1 %}<h4 class="text-warning">Credenciales no válidas o inexistentes</h4>{%endif%}
|
||||
{% if server.BadCreds == 2 %}<h4 class="text-warning">El servidor tiene problemas con WMI (Error 0x80041045)</h4>{%endif%}
|
||||
<div class="clearfix"></div>
|
||||
{% if server.Description != "" %}
|
||||
<p>Descripción: {{server.Description}}</p>
|
||||
<div class="clearfix"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<p class="text-muted font-13 m-b-30">
|
||||
<p>
|
||||
<button type="button" class="btn btn-secondary" onClick="togglesrv({{server.ID_SERV}});" >{% if server.Enabled == 1 %}Deshabilitar monitorización{% else %}Habilitar monitorización{% endif %}</button>
|
||||
<button type="button" class="btn btn-info" onClick="updatesrv({{server.ID_SERV}});" >Refrescar información</button>
|
||||
<a class="btn btn-success" href="?page=editserver&id_serv={{server.ID_SERV}}">Editar datos</a>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-modal-changegrp">Editar grupos</button>
|
||||
</p>
|
||||
|
||||
Uptime: {{server.Uptime}}
|
||||
<br>
|
||||
Discos duros:
|
||||
<p><div style="margin-left:1em;">{{server.HDDFastStats | raw}}</div></p>
|
||||
{% if server.Detram > 0 %}
|
||||
<p>Ram: {{server.Usedram}} / {{server.Detram}}
|
||||
{%else%}
|
||||
<p>Ram libre: {{server.Freeram}}
|
||||
{%endif%}
|
||||
<br>Último Ping: {{server.Ping}}ms
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Servicios</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<p><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-modal-createsvc">Nuevo servicio</button></p>
|
||||
{% if server.SO == 'LINUX' %}<p>No se pueden reiniciar los servicios en los Linux que no funcionen con "service" o "systemd"</p>{%endif%}
|
||||
<table id="datatable" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Servicio </th>
|
||||
<th>Descripción </th>
|
||||
<th>Estado </th>
|
||||
<th>Acción </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for service in services %}
|
||||
<tr {% if service.Status == 1 %}style="background-color: #eaffde;"{%else%}style="background-color: #ffe6e6;"{%endif%} >
|
||||
<td class=" ">{{service.Name}} {% if service.Enabled == 0 %}<br/><i>Deshabilitado</i>{% endif %}</td>
|
||||
<td class=" ">{{service.Description}} </td>
|
||||
<td class=" ">
|
||||
{% if service.Status == "NODATA" %}<i>Sin datos</i>
|
||||
{% else %}
|
||||
{% if service.Status == '1' %}Operativo{% else %}No funcionando {% endif %}
|
||||
{% endif %} </td>
|
||||
<td class=" last">
|
||||
<button type="button" class="btn btn-primary" id="btn-{{service.ID_SERV}}-{{service.Name}}" data-toggle="modal" data-target=".bs-modal-toggle-{{service.ID_SERV}}-{{service.Name}}" >{% if service.Status == 0 %}Arrancar{% else %}Apagar{% endif %}</button>
|
||||
|
||||
<button type="button" class="btn btn-warning" data-toggle="modal" data-target=".bs-modal-deletesvc-{{service.ID_SERV}}-{{service.Name}}">Borrar servicio</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<div class="modal fade bs-modal-toggle-{{service.ID_SERV}}-{{service.Name}}" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=servers&id_serv={{service.ID_SERV}}&do=togglesvc&name={{service.Name}}" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">{% if service.Status == 0 %}Arrancar{% else %}Apagar{% endif %} servicio {{service.Name}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>¿Estas seguro de {% if service.Status == 0 %}Arrancar{% else %}Apagar{% endif %} el servicio {{service.Name}}?
|
||||
<br>Importante: Recuerda que se necesita una cuenta de administrador para reiniciar servicios
|
||||
<br>Puede tardar un par de minutos en reflejarse aquí. Refresca con el botón para verlo más rapidamente
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">{% if service.Status == 0 %}Arrancar{% else %}Apagar{% endif %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade bs-modal-deletesvc-{{service.ID_SERV}}-{{service.Name}}" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=servers&id_serv={{service.ID_SERV}}&do=deletesvc&name={{service.Name}}" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Borrar servicio</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Se procederá a borrar el servicio {{service.Name}}, es irreversible</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-error">Borrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Stadistics HDD -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Estadísticas de discos duros</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<form method="POST" action="?page=servers&id_serv={{server.ID_SERV}}">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="backto">Ver resumen de los últimos:<br/></label>
|
||||
<div class="col-md-1 col-sm-1 col-xs-1">
|
||||
<input type="number" id="backto" name="backto" required="required" class="form-control col-md-3 col-xs-3" min="1" value="5">
|
||||
</div>
|
||||
días<button type="submit" class="btn btn-primary">Ver</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% for key,value in server.HDDData %}
|
||||
{% set maxspace = 0%}
|
||||
<p>{{key}}</p>
|
||||
<canvas id="canvashdd_{{loop.index0}}" style="display: block; height: 100px;" height="100"></canvas>
|
||||
<script>
|
||||
var ctxh_{{loop.index0}} = document.getElementById("canvashdd_{{loop.index0}}");
|
||||
var lineCharth_{{loop.index0}} = new Chart(ctxh_{{loop.index0}}, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [
|
||||
{% for subdata in value %}
|
||||
{% set lasttimestamp = subdata.Timestamp %}
|
||||
"{{subdata.HumanTimestamp}}"
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
datasets: [{
|
||||
label: "{{key}} (GB)",
|
||||
backgroundColor: "rgba(38, 185, 154, 0.31)",
|
||||
borderColor: "rgba(38, 185, 154, 0.7)",
|
||||
pointBorderColor: "rgba(38, 185, 154, 0.7)",
|
||||
pointBackgroundColor: "rgba(38, 185, 154, 0.7)",
|
||||
pointHoverBackgroundColor: "#fff",
|
||||
pointHoverBorderColor: "rgba(220,220,220,1)",
|
||||
pointBorderWidth: 1,
|
||||
data: [
|
||||
{% for subdata in value %}
|
||||
{{subdata.Space - subdata.Freespace }}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% if maxspace < subdata.Space %}{% set maxspace = subdata.Space %}{% endif %}
|
||||
{% endfor %}
|
||||
]
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true,
|
||||
max: {{maxspace}},
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Estadísticas de RAM</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<p>Histórico de RAM en uso (en MB)</p>
|
||||
<canvas id="canvas_ram" style="display: block; height: 100px;" height="100"></canvas>
|
||||
<script>
|
||||
var ctx = document.getElementById("canvas_ram");
|
||||
var lineChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [
|
||||
{% for ram in histram|reverse %}
|
||||
"{{ram.Timestamp}}"
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
datasets: [{
|
||||
label: "RAM",
|
||||
backgroundColor: "rgba(38, 185, 154, 0.31)",
|
||||
borderColor: "rgba(38, 185, 154, 0.7)",
|
||||
pointBorderColor: "rgba(38, 185, 154, 0.7)",
|
||||
pointBackgroundColor: "rgba(38, 185, 154, 0.7)",
|
||||
pointHoverBackgroundColor: "#fff",
|
||||
pointHoverBorderColor: "rgba(220,220,220,1)",
|
||||
pointBorderWidth: 1,
|
||||
data: [
|
||||
{% for ram in histram|reverse %}
|
||||
{{ram.Detram - ram.Freeram}}
|
||||
{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
]
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true,
|
||||
max: {{server.Detram |split('M')[0]|split('G')[0] }},
|
||||
}
|
||||
}]
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="modal fade bs-modal-createsvc" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=servers&id_serv={{server.ID_SERV}}" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Crear servicio <small>Se crea un servicio habilitado para monitorizar</small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Nombre intero del servicio <span class="required">*</span><br/><small>En windows es el nombre corto<br/>En linux es el nombre del <i>demonio</i></small>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="name" name="name" required="required" class="form-control col-md-7 col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="descr">Descripción del servicio <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="descr" name="descr" required="required" class="form-control col-md-7 col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<button type="submit" class="btn btn-primary">Añadir</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade bs-modal-changegrp" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=servers&id_serv={{server.ID_SERV}}&do=changegrp" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Cambiar los grupos para el servidor {{server.Name}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Grupos: </small>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
{% for group in groups %}
|
||||
<input type="checkbox" name="groupsel[]" value="{{group.ID_G}}" {% if group.ID_G in server.listinidg|keys %}checked="checked"{% endif %}> {{group.Name}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<button type="submit" class="btn btn-primary">Editar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function togglesrv(ID_SERV){ //Enable or disable monitoring
|
||||
conexion = new XMLHttpRequest();
|
||||
// Preparar la funcion de respuesta
|
||||
conexion.onreadystatechange = function() { /* Mostrar */
|
||||
if(conexion.readyState == 4 && conexion.status == 200) {
|
||||
location.reload(true);
|
||||
console.log(textdata.data);
|
||||
}
|
||||
}
|
||||
// Realizar peticion HTTP
|
||||
conexion.open('POST', 'ajaxfunc.php');
|
||||
conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
conexion.send("do=togglesrv&ID_SERV="+ID_SERV);
|
||||
}
|
||||
|
||||
function updatesrv(ID_SERV){
|
||||
conexion = new XMLHttpRequest();
|
||||
// Preparar la funcion de respuesta
|
||||
conexion.onreadystatechange = function() { /* Mostrar */
|
||||
if(conexion.readyState == 4 && conexion.status == 200) {
|
||||
alert("En curso, recargue la pagina");
|
||||
window.location.href = "admin.php?page=servers&id_serv={{server.ID_SERV}}";
|
||||
}
|
||||
}
|
||||
// Realizar peticion HTTP
|
||||
conexion.open('POST', 'ajaxfunc.php');
|
||||
conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
conexion.send("do=updatesrv&ID_SERV="+ID_SERV);
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
106
assets/html/a_settings.twig
Normal file
106
assets/html/a_settings.twig
Normal file
@@ -0,0 +1,106 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Opciones de alertas y logs. <small><i>0 deshabilita la alerta</i></small> </h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
|
||||
<form method="POST" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="alerthdd">Porcentaje mínimo de espacio libre en HDD <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="number" id="alerthdd" name="alerthdd" required="required" min="0" max="99" class="form-control col-md-7 col-xs-12" value="{{sys.HDDALERT}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="alertram">Porcentaje libre mínimo de RAM <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="number" id="alertram" name="alertram" required="required" min="0" max="99" class="form-control col-md-7 col-xs-12" value="{{sys.RAMALERT}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="autodelete">Limpieza de datos automática que tengan más de <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="number" id="autodelete" name="autodelete" required="required" min="1" max="180" class="form-control col-md-7 col-xs-12" value="{{sys.AUTODELETE}}"> días
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Enviar</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function dellogs(){
|
||||
conexion = new XMLHttpRequest();
|
||||
// Preparar la funcion de respuesta
|
||||
conexion.onreadystatechange = function() { /* Mostrar */
|
||||
if(conexion.readyState == 4 && conexion.status == 200) {
|
||||
console.log("Eliminados");
|
||||
alert("Eliminados");
|
||||
}
|
||||
}
|
||||
// Realizar peticion HTTP
|
||||
conexion.open('POST', 'ajaxfunc.php');
|
||||
conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
conexion.send("do=dellogs");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Modal nuevo usuario -->
|
||||
<div class="modal fade bs-modal-createuser" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Crear usuario <small>Se crearán con permisos básicos que luego se pueden editar</small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Nombre del usuario <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="name" name="name" required="required" class="form-control col-md-7 col-xs-12">{{POST.name}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="password">Contraseña <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="password" id="password" name="password" required="required" class="form-control col-md-7 col-xs-12">{{POST.IP}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Crear</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
209
assets/html/a_users.twig
Normal file
209
assets/html/a_users.twig
Normal file
@@ -0,0 +1,209 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
|
||||
|
||||
<!-- Table -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Usuarios </h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<p><button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-modal-createuser">Crear usuario</button></p>
|
||||
<p class="text-muted font-13 m-b-30">
|
||||
Tabla de usuarios
|
||||
</p>
|
||||
|
||||
|
||||
<table id="datatable" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th># </th>
|
||||
<th>Usuario</th>
|
||||
<th>Habilitado</th>
|
||||
<th>Editar servidores</th>
|
||||
<th>Recibir email de incidencias</th>
|
||||
<th>Admin</th>
|
||||
<th>Editar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for userp in users %}
|
||||
<tr {% if userp.Enabled == 1 %}style="background-color: #eaffde;"{%else%}style="background-color: #ffe6e6;"{% endif %} >
|
||||
<td class=" "><b>{{userp.ID_U}}</b></td>
|
||||
<td class=" ">{{userp.Name}} {% if userp.Enabled == 0 %}<br/><i>Disabled</i>{%endif%}</td>
|
||||
<td class=" ">
|
||||
<input onClick="permajax('{{userp.ID_U}}','Enabled');" type="checkbox" {%if userp.Enabled == 1 %} checked="checked" {% endif %} {%if userp.ID_U == user.ID_U %} onclick="return false;" onkeydown="return false;" {% endif %}>
|
||||
</td>
|
||||
<td class=" ">
|
||||
<input onClick="permajax('{{userp.ID_U}}','PE_editserv');" type="checkbox" {%if userp.PE_editserv == 1 %} checked="checked" {% endif %} {%if userp.ID_U == user.ID_U %} onclick="return false;" onkeydown="return false;" {% endif %}>
|
||||
</td>
|
||||
<td class=" ">
|
||||
<input onClick="permajax('{{userp.ID_U}}','SendMail');" type="checkbox" {%if userp.SendMail == 1 %} checked="checked" {% endif %}>
|
||||
</td>
|
||||
<td class=" ">
|
||||
<input onClick="permajax('{{userp.ID_U}}','PE_admin');" type="checkbox" {%if userp.PE_admin == 1 %} checked="checked" {% endif %} {%if userp.ID_U == user.ID_U %} onclick="return false;" onkeydown="return false;" {% endif %}>
|
||||
</td>
|
||||
<td class=" last">
|
||||
{% if userp.ID_U == user.ID_U %} {# Change password if is your user #}
|
||||
<button type="button" class="btn btn-info" data-toggle="modal" data-target=".bs-modal-changepass-{{userp.ID_U}}">Cambiar tu contraseña</button>
|
||||
<!-- Modal cambiar password -->
|
||||
<div class="modal fade bs-modal-changepass-{{userp.ID_U}}" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Cambiar contraseña para el usuario {{userp.Name}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="pass1">Nueva contraseña <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="password" id="pass1" name="pass1" required="required" class="form-control col-md-7 col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="pass2">Repita la contraseña <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="password" id="pass2" name="pass2" required="required" class="form-control col-md-7 col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<button type="submit" class="btn btn-primary">Cambiar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{% elseif user.PE_admin == 1 %}
|
||||
<button type="button" class="btn btn-warning" data-toggle="modal" data-target=".bs-modal-deleteuser-{{userp.ID_U}}">Borrar usuario</button>
|
||||
<!-- Modal borrar usuario -->
|
||||
<div class="modal fade bs-modal-deleteuser-{{userp.ID_U}}" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" action="?page=users&delete={{userp.ID_U}}" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Borrar usuario <small>No se puede recuperar un usuario que se borre</small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<p>No hay vuelta atrás, si aceptas se borrará el usuario {{userp.Name}}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<button type="submit" class="btn btn-primary">Borrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function permajax(ID_U,perm){
|
||||
conexion = new XMLHttpRequest();
|
||||
// Preparar la funcion de respuesta
|
||||
conexion.onreadystatechange = function() { /* Mostrar */
|
||||
if(conexion.readyState == 4 && conexion.status == 200) {
|
||||
console.log("OK")
|
||||
}
|
||||
}
|
||||
// Realizar peticion HTTP
|
||||
conexion.open('POST', 'ajaxfunc.php');
|
||||
conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
conexion.send("do=toggleperm&ID_U="+ID_U+"&perm="+perm);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Modal nuevo usuario -->
|
||||
<div class="modal fade bs-modal-createuser" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Crear usuario <small>Se crearán con permisos básicos que luego se pueden editar</small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Nombre del usuario <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="name" name="name" required="required" class="form-control col-md-7 col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="password">Contraseña <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="password" id="password" name="password" required="required" class="form-control col-md-7 col-xs-12">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">Crear</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal borrar usuario -->
|
||||
<div class="modal fade bs-modal-deleteuser" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form method="POST" data-parsley-validate class="form-horizontal form-label-left">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Borrar usuario <small>No se puede recuperar un usuario que se borre</small></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<p>No hay vuelta atrás, si aceptas se borrará el usuario</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
<button type="submit" class="btn btn-primary">Borrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
28
assets/html/err_403.twig
Normal file
28
assets/html/err_403.twig
Normal file
@@ -0,0 +1,28 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
|
||||
|
||||
<!-- Table -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Acceso denegado </h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<p><a onClick="window.history.back();" class="btn btn-primary">Volver Atrás</a></p>
|
||||
<p class="text-muted font-13 m-b-30">
|
||||
Acceso denegado
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
28
assets/html/err_404.twig
Normal file
28
assets/html/err_404.twig
Normal file
@@ -0,0 +1,28 @@
|
||||
{% include 'a_header.twig' %}
|
||||
|
||||
|
||||
|
||||
<!-- Table -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Página no válida </h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<p><a onClick="window.history.back();" class="btn btn-primary">Volver Atrás</a></p>
|
||||
<p class="text-muted font-13 m-b-30">
|
||||
Esta página no es válida, vuelva atrás.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
@@ -1,13 +0,0 @@
|
||||
<footer class="main-footer">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<p>JKA Network © 2018. Versión {{version}}</p>
|
||||
</div>
|
||||
<div class="col-sm-6 text-right">
|
||||
<p>Design by <a href="https://bootstrapious.com" class="external">Bootstrapious</a></p>
|
||||
<!-- Please do not remove the backlink to us unless you support further theme's development at https://bootstrapious.com/donate. It is part of the license conditions. Thank you for understanding :)-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -1,42 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Credits to https://bootstrapious.com/p/bootstrap-4-dashboard -->
|
||||
<meta charset="utf-8">
|
||||
<title>CheckServer - Estado de los servicios</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/css/panel.css" id="theme-stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/patchpanel.css" id="theme-stylesheet">
|
||||
<link rel="stylesheet" href="assets/fonts/roboto/stylesheet.css">
|
||||
<!-- Fonts CSS-->
|
||||
<link rel="stylesheet" href="assets/fonts/styles.css">
|
||||
|
||||
<script src="assets/js/Chart.min.js"></script> <!-- For charts -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="page forms-page" style="width:100%;">
|
||||
<!-- navbar-->
|
||||
<header class="header">
|
||||
<nav class="navbar">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-holder d-flex align-items-center justify-content-between">
|
||||
<div class="navbar-header"><a href="index.php" class="navbar-brand">
|
||||
<div class="brand-text hidden-sm-down"><span>CheckServer</span></div></a></div>
|
||||
<ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
|
||||
<li class="nav-item"><a href="login.php" class="nav-link logout">Entrar<i class="icon-sign-in"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="breadcrumb-holder">
|
||||
<div class="container-fluid">
|
||||
<ul class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="index.html">Inicio</a></li>
|
||||
<li class="breadcrumb-item active">Estado</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
109
assets/html/index.twig
Normal file
109
assets/html/index.twig
Normal file
@@ -0,0 +1,109 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<!-- Meta, title, CSS, favicons, etc. -->
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="assets/images/favicon.ico" type="image/ico" />
|
||||
|
||||
<title>Panel de administración</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Font Awesome -->
|
||||
<link href="vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
|
||||
<!-- NProgress -->
|
||||
<link href="vendors/nprogress/nprogress.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom Theme Style -->
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="vendors/jquery/dist/jquery.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<!-- Basic top navigation -->
|
||||
<div class="top_nav">
|
||||
<div class="nav_menu">
|
||||
<nav>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{% if user.Name %}
|
||||
<li class=""><a href="index.php?logout=1"><i class="fa fa-sign-out"></i> Cerrar sesión</a></li>
|
||||
<li class=""><a href="admin.php"><i class="fa fa-database"></i> Administración</a></li>
|
||||
<li class=""><a href="#"> Bienvenido, {{user.Name}}</a></li>
|
||||
{% else %}
|
||||
<li class=""><a href="login.php"><i class="fa fa-sign-out"></i> Iniciar sesión</a></li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Basic top navigation -->
|
||||
|
||||
|
||||
<body class="nav-md">
|
||||
<div class="container body">
|
||||
|
||||
<!-- Table -->
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>CheckServer. Página de estado <small>Estado rápido de los servidores</small> </h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<table id="datatable" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Servidor </th>
|
||||
<th>Servicios</th>
|
||||
<th>Uptime </th>
|
||||
<th>Encendido </th>
|
||||
<th>Ultimo fallo </th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for server in servers %}
|
||||
<tr
|
||||
{% if server.Enabled == 1 %} {%if server.Online == 1 %}class="bgcolor-ok" {%endif%}{% elseif server.Enabled == 0 %}class="bgcolor-secondary"{% endif %}>
|
||||
|
||||
<td data-toggle="tooltip" data-placement="top" {#title="{{server.Description}}"#} >{{server.Name}} {% if server.Online == 0 and server.Enabled == 1 %}<br/><i>Offline</i>{%endif%}{% if server.Enabled == 0 %}<br/><i>Deshabilitado</i>{%endif%}</td>
|
||||
|
||||
<td {% if server.SInactive > 0 %} class="bgcolor-warn" {% endif %}>
|
||||
Monitorizando: {{server.SEnabled}}
|
||||
{% if server.SEnabled > 0 %}<br>Funcionando: {{server.SActive}} {% endif %}
|
||||
{% if server.SInactive > 0 %}<br>Parados: {{server.SInactive}} {% endif %}
|
||||
{% if server.SDisabled > 0 %}<br>Monitorización en pausa: {{server.SDisabled}} {% endif %}
|
||||
</td>
|
||||
<td>{% if server.BadCreds == 0 %} {{server.Uptime}} {% endif %}</td>
|
||||
{% if server.Enabled == 1 %}
|
||||
<td {% if server.Ping > -1 %}class="bgcolor-ok">On {% else %}class="bgcolor-warn">Off{% endif %}</td>
|
||||
{% else %}
|
||||
<td></td>
|
||||
{% endif %}
|
||||
|
||||
<td></td> {#TODO: Know last error #}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- /page content -->
|
||||
|
||||
{% include 'a_footer.twig' %}
|
||||
@@ -1,135 +0,0 @@
|
||||
{% include 'header.twig' %}
|
||||
<!-- Pages -->
|
||||
<section>
|
||||
<div class="col-lg-10 mhcenter">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">{{T_.statdif1}}</h2>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th>#</th>-->
|
||||
<th>{{T_.name}}</th>
|
||||
<th>{{T_.status_uptime}}</th>
|
||||
<th>{{T_.last_check}}</th>
|
||||
<th>{{T_.last_err}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for check in checks %}
|
||||
{% if check.ID_G != beforegroup %}
|
||||
<tr>
|
||||
<th colspan="4" class="thgrp">{{check.nameGroup}}</th>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% set beforegroup = check.ID_G %}
|
||||
<tr>
|
||||
<td>{{check.name}}</td>
|
||||
|
||||
|
||||
{# "Switch" type #}
|
||||
{% if check.ID_TC != 3 %} {# Every except Visits that is different #}
|
||||
|
||||
{% if check.uptime != -1 %}{#Only if records exists#}
|
||||
<td>
|
||||
<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>
|
||||
{{check.dateLastChk}} -
|
||||
{% if check.failedLastChk == 0 %}
|
||||
<span style="color:green">{{T_.status_right}}</span>
|
||||
{% else %}
|
||||
<span style="color:red">{{T_.failed}}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{%else%} {#If not records yet#}
|
||||
<td colspan="2">Dame tiempo para recopilar estadísticas</td>
|
||||
{%endif%}
|
||||
<td>
|
||||
{%if check.dateLastErr is not null%}
|
||||
{{check.dateLastErr}}
|
||||
{%else%}
|
||||
{{T_.no_errs}}
|
||||
{%endif%}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% if check.ID_TC == 3 %}
|
||||
<td colspan="3">
|
||||
<div style="width:170px;height:90px;">
|
||||
<canvas id="visits{{ check.ID_C }}"></canvas>
|
||||
</div>
|
||||
<script>
|
||||
var visits{{ check.ID_C }} = document.getElementById("visits{{ check.ID_C }}").getContext("2d");
|
||||
var Chart{{ check.ID_C }} = new Chart(visits{{ check.ID_C }}, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [{{ check.dateArray | raw}}],
|
||||
datasets: [
|
||||
{
|
||||
label: "Visitas",
|
||||
backgroundColor: "rgba(100,176,243,1)", // Color del sombreado de la grafica en ese lugar
|
||||
borderColor: "#4ba4f3", // Colores de la linea y punteado
|
||||
pointBorderColor: "#4ba4f3",
|
||||
pointBackgroundColor: "#fff",
|
||||
data: [{{ check.visitsArray }}],
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
legend: {display: false},
|
||||
scales:{
|
||||
yAxes:[{ticks:{beginAtZero: true}}]
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
{# Fin Switch #}
|
||||
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div style="margin-top: 3em;"></div>
|
||||
|
||||
<!-- Noticias -->
|
||||
<section>
|
||||
<div class="col-lg-10" style="margin: 0 auto;">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">Noticias sobre los servicios</h2>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
{# {% if user.nick != "" %}
|
||||
<h3>Añadir incidencia: (Usa Markdown)</h3>
|
||||
<form action="index.php?do=addincident" method="POST">
|
||||
<textarea name="text" style="width:90%;height:150px;"></textarea>
|
||||
<br/><button type="submit">Enviar</button>
|
||||
</form>
|
||||
{% endif %} #}
|
||||
{% for onenews in news %}
|
||||
<h3>Day {{ onenews.day }}</h3>
|
||||
<div class="incident">
|
||||
{{ onenews.text | raw }}
|
||||
|
||||
{% if user.nick != "" %}
|
||||
<hr/>
|
||||
<button type="submit" onclick="window.location.href='?do=delincident&ID_Inc={{ incident.ID_Inc }}">Delete</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% include 'footer.twig' %}
|
||||
227
assets/html/install.twig
Executable file → Normal file
227
assets/html/install.twig
Executable file → Normal file
@@ -1,122 +1,129 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Credits to https://bootstrapious.com/p/bootstrap-4-dashboard -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<!-- Meta, title, CSS, favicons, etc. -->
|
||||
<meta charset="utf-8">
|
||||
<title>CheckServer - Installer</title>
|
||||
<meta name="description" content="">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/css/panel.css" id="theme-stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/patchpanel.css" id="theme-stylesheet">
|
||||
<link rel="stylesheet" href="assets/fonts/roboto/stylesheet.css">
|
||||
<!-- Fonts CSS-->
|
||||
<link rel="stylesheet" href="assets/fonts/styles.css">
|
||||
<link rel="icon" href="assets/images/favicon.ico" type="image/ico" />
|
||||
|
||||
<title>Panel de administración</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Font Awesome -->
|
||||
<link href="vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
|
||||
<!-- NProgress -->
|
||||
<link href="vendors/nprogress/nprogress.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom Theme Style -->
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="page forms-page" style="width:100%;">
|
||||
<!-- navbar-->
|
||||
<header class="header">
|
||||
<nav class="navbar">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-holder d-flex align-items-center justify-content-between">
|
||||
<div class="navbar-header">
|
||||
<div class="brand-text hidden-sm-down"><span style="color:white;">CheckServer</span></div></div>
|
||||
|
||||
<body class="nav-md">
|
||||
<div class="container body">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Instalación de CheckServer</h2>
|
||||
<ul class="nav navbar-right panel_toolbox">
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<br />
|
||||
<form id="demo-form2" method="POST" data-parsley-validate class="form-horizontal form-label-left">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="adminname">Nombre de usuario admin <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="adminname" name="adminname" required="required" class="form-control col-md-7 col-xs-12" value="{{POST.adminname}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="adminmail">Correo de admin <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="adminmail" name="adminmail" required="required" class="form-control col-md-7 col-xs-12" value="{{POST.adminname}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="adminpass">Contraseña
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="password" id="adminpass" name="adminpass" class="form-control col-md-7 col-xs-12" value="{{POST.adminpass}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Base de datos:</h2>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="dbhost">Ubicación BBDD <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="dbhost" name="dbhost" required="required" class="form-control col-md-7 col-xs-12" value="{{POST.dbhost}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="dbuser">Nombre de usuario de BBDD <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="dbuser" name="dbuser" required="required" class="form-control col-md-7 col-xs-12" value="{{POST.dbuser}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="dbpass">Contraseña BBDD
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="password" id="dbpass" name="dbpass" class="form-control col-md-7 col-xs-12" value="{{POST.dbpass}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="dbdata">Base de datos a usar <span class="required">*</span>
|
||||
</label>
|
||||
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||
<input type="text" id="dbdata" name="dbdata" required="required" class="form-control col-md-7 col-xs-12" value="{{POST.dbdata}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ln_solid"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
|
||||
<button class="btn btn-primary" type="reset">Poner en blanco</button>
|
||||
<button type="submit" class="btn btn-success">Instalar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- /page content -->
|
||||
|
||||
|
||||
<section class="forms">
|
||||
<div class="container-fluid">
|
||||
<header>
|
||||
<h1 class="h3 display">CheckServer installer</h1>
|
||||
</header>
|
||||
|
||||
{% if part != 2 %}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<p>Welcome to the "one-minute" installer of CheckServer. We only need the lang and admin data to configure the site and take the control to you</p>
|
||||
</div>
|
||||
</div>
|
||||
<form class="form-horizontal" method="POST" action="?page=install">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Language</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="lang">
|
||||
<option value="es">Spanish</option>
|
||||
<option value="en">English</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Site name</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="websiteName" type="text" placeholder="Nombre del sitio." value="CheckServer" class="form-control form-control-success"><small class="form-text">For "naming" CheckServer</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Admin username</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="username" type="text" placeholder="Nombre de usuario" value="" class="form-control form-control-success"><small class="form-text">Your username</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="passw1" type="password" placeholder="" value="" class="form-control form-control-success"><small class="form-text">Your password</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Repeat password</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="passw2" type="password" placeholder="" value="" class="form-control form-control-success"><small class="form-text">Your password, again.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-10 offset-sm-2">
|
||||
<button type="submit" class="btn btn-primary">Install</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%else%}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<p>Installed!<br/>Well, not all, there is one manual step left to you. You have to
|
||||
configure your cron service (If using cpanel is in cron jobs, in standard linux see distro cron).
|
||||
</p>
|
||||
<p>You have to create a cron that executes using php the file cronchk.php that is here.<br/>
|
||||
Example using cron of Linux:</p>
|
||||
<pre>
|
||||
*/5 * * * * root cd /srv/http/checkserver/ && /usr/bin/php -f cronchk.php >/dev/null 2>&1
|
||||
</pre>
|
||||
<p>In this example, cron runs every 5 mins, you can adjust it, but I do not recommend less than 3 mins if you have somewhat much checks, it can slow server.</p>
|
||||
<p>Go to <a href="index.php">home</a> to start using CheckServer! Welcome</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{%endif%}
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
<!-- jQuery -->
|
||||
<script src="vendors/jquery/dist/jquery.min.js"></script>
|
||||
<!-- Bootstrap -->
|
||||
<script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<!-- FastClick -->
|
||||
<script src="vendors/fastclick/lib/fastclick.js"></script>
|
||||
|
||||
<!-- bootstrap-progressbar -->
|
||||
<script src="vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
|
||||
<!-- Skycons -->
|
||||
<script src="vendors/skycons/skycons.js"></script>
|
||||
|
||||
<script src="js/custom.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
112
assets/html/login.twig
Executable file → Normal file
112
assets/html/login.twig
Executable file → Normal file
@@ -1,33 +1,83 @@
|
||||
{% include 'header.twig' %}
|
||||
<section>
|
||||
<div class="col-lg-10 mhcenter">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">Inicio de sesión de CheckServer</h2>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
{% if status == 'error' %}
|
||||
<h2>Datos incorrectos, vuelva a intentarlo</h2>
|
||||
{% endif %}
|
||||
<form id="form1" method="post" action="login.php">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="textT">Nick:</td>
|
||||
<td style="padding-left:10px;"><input name="nick" type="text" id="nick"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="textT">Contraseña:</td>
|
||||
<td style="padding-left:10px;"><input name="pass" type="password" id="pass" required="required"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td><td><button type="submit" class="btn">Enviar</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<!-- Meta, title, CSS, favicons, etc. -->
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="assets/images/favicon.ico" type="image/ico" />
|
||||
|
||||
<title>CheckServer | JKANetwork</title>
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Font Awesome -->
|
||||
<link href="vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
|
||||
<!-- NProgress -->
|
||||
<link href="vendors/nprogress/nprogress.css" rel="stylesheet">
|
||||
<!-- Animate.css -->
|
||||
<link href="vendors/animate.css/animate.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom Theme Style -->
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="login">
|
||||
<div>
|
||||
<a class="hiddenanchor" id="signup"></a>
|
||||
<a class="hiddenanchor" id="signin"></a>
|
||||
|
||||
<div class="login_wrapper">
|
||||
<div class="animate form login_form">
|
||||
<section class="login_content">
|
||||
<form method="POST">
|
||||
<h1>Iniciar sesión</h1>
|
||||
|
||||
{% if msg_e %}
|
||||
{% for string in msg_e %}
|
||||
<div>
|
||||
<div class="alert alert-error alert-dismissible fade in" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
{{string}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<div>
|
||||
<input type="text" name="user" class="form-control" placeholder="Username" required="" />
|
||||
</div>
|
||||
<div>
|
||||
<input type="password" name="password" class="form-control" placeholder="Password" required="" />
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-default submit" type="submit" >Entrar</button>
|
||||
<!--<a class="reset_pass" href="#">Lost your password?</a>-->
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="separator">
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<br />
|
||||
|
||||
<div>
|
||||
<h1><i class="fa fa-server"></i> CheckServer - 2019</h1>
|
||||
<p>©2016 All Rights Reserved. Tema Gentelella Alela! is a Bootstrap 3 template. Privacy and Terms</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% include 'footer.twig' %}
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="vendors/jquery/dist/jquery.min.js"></script>
|
||||
<!-- Bootstrap -->
|
||||
<script src="vendors/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
|
||||
<!-- Add/edit form -->
|
||||
<section class="forms">
|
||||
<div class="container-fluid">
|
||||
<header>
|
||||
{%if type == 'edit' %}
|
||||
<h1 class="h3 display">Editando {{check.name}}</h1>
|
||||
{%else%}
|
||||
<h1 class="h3 display">Nuevo check</h1>
|
||||
{%endif%}
|
||||
</header>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<form class="form-horizontal" method="POST"
|
||||
{%if type == 'edit'%}
|
||||
action="?page=updatecheck&ID_C={{check.ID_C}}"
|
||||
{%else%}
|
||||
action="?page=savenewcheck"
|
||||
{%endif%}>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">{{T_.name}}</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="name" type="text" placeholder="Nombre del check" value="{{check.name}}" class="form-control form-control-success"><small class="form-text">Nombre del checkeo.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 form-control-label">{{T_.group}}</label>
|
||||
<div class="col-sm-10 select">
|
||||
<select name="group" id="group" class="form-control">
|
||||
{% for group in groups %}
|
||||
<option value="{{group.ID_G}}" {%if group.ID_G == check.ID_G %} selected="selected" {%endif%}>
|
||||
{{group.name}}
|
||||
</option>
|
||||
{%endfor%}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 form-control-label">Tipo de check</label>
|
||||
<div class="col-sm-10 select">
|
||||
<select name="tcheck" id="tcheck" class="form-control" onchange="showOptData(this);">
|
||||
{% for tchk in tchecks %}
|
||||
<option value="{{tchk.ID_TC}}" {%if tchk.ID_TC == check.ID_TC %} selected="selected" {%endif%}>
|
||||
{{tchk.name}}
|
||||
</option>
|
||||
{%endfor%}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Aquí empiezan los campos "opcionales" dependiendo del tipo de check (Estos vienen de la tabla, al campo) #}
|
||||
{# Sacar variables #}
|
||||
{% if check.ID_TC == 1%}
|
||||
{% set t1 = check.url|split(':') %}
|
||||
{% elseif check.ID_TC == 2%}
|
||||
{% set t2_url = check.url %}
|
||||
{% set t2_code = check.urlParam %}
|
||||
{% elseif check.ID_TC == 4%}
|
||||
{% set t4_url = check.url %}
|
||||
{% elseif check.ID_TC == 5 %}
|
||||
{% set t5_url = check.url %}
|
||||
{% set t5_params = check.urlParam|split('|') %}
|
||||
{% set t5_exceptedRes = check.exceptedRes %}
|
||||
{% endif %}
|
||||
|
||||
{# Trozos de formulario #}
|
||||
|
||||
{# Tipo 1 - Ping IP #}
|
||||
<div id="t1" style="display:none;">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">IP</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="t1url" type="text" placeholder="URL" value="{{t1[0]}}" class="form-control form-control-success"><small class="form-text">IP/Web a hacer "ping".</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Puerto</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="t1port" type="text" placeholder="Puerto" value="{{t1[1]}}" class="form-control form-control-success"><small class="form-text">Puerto que comprobar. Por defecto es el 80/www.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Tipo 2 - HttpCode (WWW) #}
|
||||
<div id="t2" style="display:none;">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">URL</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="t2url" type="text" placeholder="URL" value="{{t2_url}}" class="form-control form-control-success"><small class="form-text">URL a la que comprobar si funciona o no.</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Codigo esperado</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="t2code" type="text" placeholder="Puerto" value="{{t2_code}}" class="form-control form-control-success"><small class="form-text">Codigo esperado, si no se pone nada, es el 200 (Ok)</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Tipo 3 - Visit Counter #}
|
||||
<div id="t3" style="display:none;">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2"></label>
|
||||
<div class="col-sm-10">
|
||||
<p><small class="form-text">Al aceptar, en las opciones del check, está el código HTML para añadir a la web</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Tipo 4 - Database #}
|
||||
<div id="t4" style="display:none;">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Lugar donde estará el fichero PHP de la comprobación en tu servidor</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="t4url" type="text" placeholder="URL" value="{{t4_url}}" class="form-control form-control-success"><small class="form-text">Aquí debes poner la URL completa al fichero php que se te dará para comprobar el estado de la base de datos (Por seguridad, sus datos no se guardan en CheckServer)</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Tipo 5 - Json API #}
|
||||
<div id="t5" style="display:none;">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">JSON</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="t5url" type="text" placeholder="URL" value="{{t5_url}}" class="form-control form-control-success"><small class="form-text">URL de la API</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Tipo de request</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="t5type" class="form-control">
|
||||
<option value="GET" {%if t5_params[0] == 'GET' %} selected="selected" {%endif%}>GET</option>
|
||||
<option value="POST" {%if t5_params[0] == 'POST' %} selected="selected" {%endif%}>POST</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Parametros enviados</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="t5params" type="text" placeholder="?params" value="{{t5_params[1]}}" class="form-control form-control-success"><small class="form-text">Parametros de la API (Si es GET, empezar con ? o /)</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Respuesta esperada</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="t5exceptedRes" placeholder="Respuesta en formato JSON" class="form-control form-control-success">{{t5_exceptedRes}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-10 offset-sm-2">
|
||||
<button type="submit" class="btn btn-primary">Guardar cambios</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
function showOptData(valSel){
|
||||
document.getElementById("t1").style.display = "none";
|
||||
document.getElementById("t2").style.display = "none";
|
||||
document.getElementById("t3").style.display = "none";
|
||||
document.getElementById("t4").style.display = "none";
|
||||
document.getElementById("t5").style.display = "none";
|
||||
optVal = valSel.value;
|
||||
|
||||
if(optVal == '1'){
|
||||
document.getElementById("t1").style.display = "block";
|
||||
}else if(optVal == '2'){
|
||||
document.getElementById("t2").style.display = "block";
|
||||
}else if(optVal == '3'){
|
||||
document.getElementById("t3").style.display = "block";
|
||||
}else if(optVal == '4'){
|
||||
document.getElementById("t4").style.display = "block";
|
||||
}else {
|
||||
document.getElementById("t5").style.display = "block";
|
||||
}
|
||||
}
|
||||
showOptData(document.getElementById("tcheck"))
|
||||
</script>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,251 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
|
||||
<!-- Checks -->
|
||||
<section>
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">Checks de la web. Desde aquí puedes ver, editar, y añadir nuevos checkeos a tus servidores</h2>
|
||||
</div>
|
||||
<div class="card">
|
||||
{% if you.fullRights == 1 %}
|
||||
<div class="card-header d-flex align-items-center">
|
||||
{% if groups is not empty %}
|
||||
<h2><a href="?page=addcheck" class="btn btn-info">{{T_.add}}</a></h2>
|
||||
{%else%}
|
||||
<h5>{{T_.add_grp_to_add_chk}}</h5>
|
||||
{%endif%}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card-block">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{T_.name}}</th>
|
||||
<th>Tipo Check</th>
|
||||
<th>{{T_.edit}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for check in checks %}
|
||||
{% if check.ID_G != beforegroup %}
|
||||
<tr>
|
||||
<th colspan="4" class="thgrp">{{check.nameGroup}}</th>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% set beforegroup = check.ID_G %}
|
||||
<tr>
|
||||
<td>{{check.name}}</td>
|
||||
<td>{{check.nameTCheck}} - {{check.url}}</td>
|
||||
<td>
|
||||
<a href="?page=viewhist&ID_C={{check.ID_C}}" class="btn btn-info">{{T_.view_hist}}</a>
|
||||
{% if you.fullRights == 1 %}
|
||||
<a href="?page=editcheck&ID_C={{check.ID_C}}" class="btn btn-primary">{{T_.edit}}</a>
|
||||
{% if check.ID_TC == 3 %}{#Visitas#}
|
||||
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#countercode_{{check.ID_C}}">Código del contador</button>
|
||||
|
||||
{% elseif check.ID_TC == 4 %}{#Database#}
|
||||
<a href="#" data-toggle="modal" data-target="#dbcode_{{check.ID_C}}" class="btn btn-info">Codigo para check database</a>
|
||||
{% endif %}
|
||||
<div class="dropdown show"> <!-- Dropdown más opciones -->
|
||||
<a class="btn btn-secondary dropdown-toggle" href="#" id="more_{{check.ID_C}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{T_.more_opts}}
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu" aria-labelledby="more_{{check.ID_C}}">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editGrp_{{check.ID_C}}">Cambiar de grupo</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editName_{{check.ID_C}}">Editar nombre</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#delChk_{{check.ID_C}}">{{T_.delete}}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Modal de "Cambiar de grupo" -->
|
||||
<div id="editGrp_{{check.ID_C}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Nuevo grupo para {{check.name}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=modcheckgrp&ID_C={{check.ID_C}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<select name="group_{{check.ID_C}}" class="form-control">
|
||||
{% for group in groups %}
|
||||
<option value="{{group.ID_G}}" {%if group.ID_G == check.ID_G %} selected="selected" {%endif%}>
|
||||
{{group.name}}
|
||||
</option>
|
||||
{%endfor%}
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Cambiar grupo</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
<!-- Modal de "Editar nombre" -->
|
||||
<div id="editName_{{check.ID_C}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Editando el nombre de {{check.name}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=modcheckname&ID_C={{check.ID_C}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<input type="text" name="name_{{check.ID_C}}" value="{{check.name}}"/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Cambiar nombre</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
<!-- Modal de "Eliminar" -->
|
||||
<div id="delChk_{{check.ID_C}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{T_.delete}} {{check.name}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=delcheck&ID_C={{check.ID_C}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p>¿Estas seguro de eliminar el check {{check.name}}? Es irreversible</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-danger">{{T_.delete}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
|
||||
{# Modales concretos #}
|
||||
|
||||
{% if check.ID_TC == 3 %} {#Contador de visitas #}
|
||||
<!-- Modal para descargar el codigo de comprobación de DB -->
|
||||
<div id="countercode_{{check.ID_C}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Código HTML del contador de visitas</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<h3>Código a copiar para que el contador de visitas funcione:</h3>
|
||||
<pre style="width:100%;">
|
||||
<script type="text/javascript">
|
||||
var SiteID={{check.ID_C}};
|
||||
</script>
|
||||
<script src="{{you.webRoot}}counter.js"></script>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal" class="btn btn-primary">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
{% elseif check.ID_TC == 4 %}
|
||||
<!-- Modal para descargar el codigo de comprobación de DB -->
|
||||
<div id="dbcode_{{check.ID_C}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{T_.delete}} {{check.name}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="downdbcode.php?ID_C={{check.ID_C}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<h3>Datos de la conexión (Para generar el fichero)</h3>
|
||||
<p>Tipo de base de datos:
|
||||
<select id="dbcode_type" name="dbcode_type" onchange="showOptD(this);">
|
||||
<option value="sqlite3">SQLite3</option>
|
||||
<option value="mysqli">MySql</option>
|
||||
<option value="pgsql">PostgreSQL</option>
|
||||
</select>
|
||||
</p>
|
||||
<p><small>En sqlite, el host es la ubicación relativa al fichero</small></p>
|
||||
<p>Host (Usualmente localhost): <input type="text" name="dbcode_host" placeholder="Host" /></p>
|
||||
<p id="userBD">Usuario bd<input type="text" name="dbcode_user" placeholder="Usuario" /></p>
|
||||
<p id="passBD">Contraseña bd<input type="password" name="dbcode_pass" placeholder="Contraseña" /></p>
|
||||
<p id="baseBD">Base de datos<input type="text" name="dbcode_db" placeholder="Base de datos" /></p>
|
||||
</div>
|
||||
<!-- Script for showing options -->
|
||||
<script>
|
||||
function showOptD(valSel){
|
||||
optVal = valSel.value;
|
||||
if(optVal == 'sqlite3'){
|
||||
document.getElementById("userBD").style.display = "none";
|
||||
document.getElementById("passBD").style.display = "none";
|
||||
document.getElementById("baseBD").style.display = "none";
|
||||
}else if(optVal == 'mysqli'){
|
||||
document.getElementById("userBD").style.display = "block";
|
||||
document.getElementById("passBD").style.display = "block";
|
||||
document.getElementById("baseBD").style.display = "none";
|
||||
}else if(optVal == 'pgsql'){
|
||||
document.getElementById("userBD").style.display = "block";
|
||||
document.getElementById("passBD").style.display = "block";
|
||||
document.getElementById("baseBD").style.display = "block";
|
||||
}
|
||||
}
|
||||
showOptD(document.getElementById("dbcode_type"))
|
||||
</script>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Enviar y descargar php</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for group in emptygrp %}
|
||||
<tr>
|
||||
<th colspan="4" class="thgrp">{{group.name}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Este grupo está vacío. Puedes eliminarlo desde grupos</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,105 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
|
||||
<!-- Grupos -->
|
||||
<section>
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">Aquí se pueden crear, renombrar y borrar grupos para ordenar tus checkeos.</h2>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{T_.name}}</th>
|
||||
<th>{{T_.edit}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if you.fullRights == 1 %}{#New group only admins #}
|
||||
<form action="?page=addgroup" method="POST">
|
||||
<tr>
|
||||
<td><input type="text" name="grpname" placeholder="Nombre del nuevo grupo"/></td>
|
||||
<td>
|
||||
<button type="submit" class="btn btn-info">{{T_.add}}</button>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% for group in groups %}
|
||||
<tr>
|
||||
<td>{{group.name}}</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editName_{{group.ID_G}}">{{T_.edit}}</button>
|
||||
<!-- Modal Editar -->
|
||||
<div id="editName_{{group.ID_G}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Nuevo nombre para {{group.name}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=changegroup&ID_G={{group.ID_G}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p><input type="text" name="GN_{{group.ID_G}}" value="{{group.name}}"/></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Cambiar</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delGrp_{{group.ID_G}}">{{T_.delete}}</button>
|
||||
<!-- Modal borrar -->
|
||||
<div id="delGrp_{{group.ID_G}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Se va a borrar {{group.name}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=delgroup&ID_G={{group.ID_G}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p class="black">Borrar un grupo es irreversible</p>
|
||||
{% if group.checks > 0 %}
|
||||
<h3 class="black">Hay checks dentro de {{group.name}}. Si continúa, se borrarán también.</h3>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-danger">{{T_.delete}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<script>
|
||||
function changeName(Id_G,name){
|
||||
var retVal = prompt("Nuevo nombre para "+name+" ", name);
|
||||
alert("You have entered : " + retVal);
|
||||
}
|
||||
</script>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,79 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Credits to https://bootstrapious.com/p/bootstrap-4-dashboard -->
|
||||
<meta charset="utf-8">
|
||||
<title>Panel de administración</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/css/panel.css" id="theme-stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/patchpanel.css" id="theme-stylesheet">
|
||||
<link rel="stylesheet" href="assets/fonts/roboto/stylesheet.css">
|
||||
|
||||
<!-- Fonts CSS-->
|
||||
<link rel="stylesheet" href="assets/fonts/styles.css">
|
||||
|
||||
<script src="assets/js/Chart.min.js"></script> <!-- For charts -->
|
||||
<script src="assets/js/jquery-3.2.1.min.js"></script> <!-- For bootstrap -->
|
||||
<script src="assets/js/popper.min.js"></script> <!-- For bootstrap dropdown -->
|
||||
<script src="assets/js/bootstrap-util-modal-dropdown.min.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<!-- Side Navbar -->
|
||||
<nav class="side-navbar">
|
||||
<div class="side-navbar-wrapper">
|
||||
<div class="sidenav-header d-flex align-items-center justify-content-center">
|
||||
<div><p class="text-center"> Panel de control</p></div>
|
||||
</div>
|
||||
<div class="main-menu">
|
||||
<ul id="side-main-menu" class="side-menu list-unstyled">
|
||||
<li {%if mpage == 'index'%} class="active"{%endif%}>
|
||||
<a href="panel.php?page=index"> <i class="icon-home-house-streamline"></i><span>{{T_.home}}</span></a>
|
||||
</li>
|
||||
<li {%if mpage == 'checks'%} class="active"{%endif%}>
|
||||
<a href="panel.php?page=checks"><i class="icon-browser-streamline-window"></i><span>{{T_.checks}}</span></a>
|
||||
</li>
|
||||
<li {%if mpage == 'groups'%} class="active"{%endif%}>
|
||||
<a href="panel.php?page=groups"><i class="icon-coffee-streamline"></i><span>{{T_.groups}}</span></a>
|
||||
</li>
|
||||
<li {%if mpage == 'news'%} class="active"{%endif%}>
|
||||
<a href="panel.php?page=news"><i class="icon-notebook-streamline"></i><span>{{T_.news}}</span></a>
|
||||
</li>
|
||||
{% if you.fullRights == 1 %}
|
||||
<li {%if mpage == 'settings'%} class="active"{%endif%}>
|
||||
<a href="panel.php?page=settings"><i class="icon-settings-streamline-1"></i><span>{{T_.settings}}</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li {%if mpage == 'users'%} class="active"{%endif%}>
|
||||
<a href="panel.php?page=users"><i class="icon-man-people-streamline-user"></i><span>{{T_.users}}</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="page forms-page">
|
||||
<!-- navbar-->
|
||||
<header class="header">
|
||||
<nav class="navbar">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-holder d-flex align-items-center justify-content-between">
|
||||
<div class="navbar-header"><a href="index.php" class="navbar-brand">
|
||||
<div class="brand-text hidden-sm-down"><span>CheckServer</span></div></a></div>
|
||||
<ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
|
||||
<li class="nav-item"><a href="login.php?do=logout" class="nav-link logout">Salir<i class="icon-sign-out"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="breadcrumb-holder">
|
||||
<div class="container-fluid">
|
||||
<ul class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="index.html">Inicio</a></li>
|
||||
<li class="breadcrumb-item active">Estado</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,70 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
<!-- Controles numéricos -->
|
||||
<section class="dashboard-counts section-padding">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xl-3 col-md-4 col-6">
|
||||
<div class="wrapper count-title d-flex">
|
||||
<div class="icon"><i class="icon-eye"></i></div>
|
||||
<div class="name"><strong class="text-uppercase">Tests</strong><span>Controles activos</span>
|
||||
<div class="count-number">{{data.checks}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3 col-md-4 col-6">
|
||||
<div class="wrapper count-title d-flex">
|
||||
<div class="icon"><i class="icon-exclamation-triangle"></i></div>
|
||||
<div class="name"><strong class="text-uppercase">Test erróneos</strong><span>Desde el {{data.errinidate}}</span>
|
||||
<div class="count-number">{{data.err}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="col-xl-2 col-md-4 col-6">
|
||||
<div class="wrapper count-title d-flex">
|
||||
<div class="icon"><i class="icon-padnote"></i></div>
|
||||
<div class="name"><strong class="text-uppercase">Incidencias</strong><span>Desde el</span>
|
||||
<div class="count-number">{{data.err}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div><!--Row-->
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Lastest fails -->
|
||||
<section class="updates section-padding">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="wrapper recent-updated">
|
||||
<div id="new-updates" class="card-header d-flex justify-content-between align-items-center">
|
||||
<h2 class="h5 display"><a data-toggle="collapse" data-parent="#accordion" href="#upadtes-box" aria-expanded="true" aria-controls="upadtes-box">{{T_.lastest_fails}}</a></h2>
|
||||
</div>
|
||||
<div id="upadtes-box" role="tabpanel" class="collapse show">
|
||||
<ul class="news list-unstyled">
|
||||
<!-- Item-->
|
||||
{% for fail in fails %}
|
||||
<li class="d-flex justify-content-between">
|
||||
<div class="left-col d-flex">
|
||||
<div class="icon"><i class="icon-times"></i></div>
|
||||
<div class="title"><a href="?page=viewhist&ID_C={{fail.ID_C}}">{{fail.name}} - <strong>{{fail.groupName}}</strong>
|
||||
<p>{{fail.typeCheck}}</p>
|
||||
</a></div>
|
||||
</div>
|
||||
<div class="right-col text-right">
|
||||
<div class="update-date">{{fail.date}}<span class="month">{{fail.hour}}</span></div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,114 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
|
||||
<!-- Noticias -->
|
||||
<section>
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">Vista rápida de noticias.</h2>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
|
||||
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#new_{{news.ID_N}}">Nueva noticia</button>
|
||||
<!-- Modal Editar -->
|
||||
<div id="new_{{news.ID_N}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Nueva noticia.</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=newnews" method="POST">
|
||||
<div class="modal-body">
|
||||
<p>Se acepta el uso de MarkDown y/o texto plano.</p>
|
||||
<p><textarea style="width:100%;height:250px;" name="text_new"></textarea></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Nueva noticia</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fecha</th>
|
||||
<th>Noticia</th>
|
||||
<th>Opciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for news in allnews %}
|
||||
<tr>
|
||||
<td>{{news.date}}</td>
|
||||
<td>{{news.text | raw}}</td>
|
||||
<td>
|
||||
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#edit_{{news.ID_N}}">Editar</button>
|
||||
<!-- Modal Editar -->
|
||||
<div id="edit_{{news.ID_N}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Editando noticia...</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=editnews&ID_N={{news.ID_N}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p><textarea style="width:100%;height:250px;" name="text_{{news.ID_N}}">{{news.mdtext}}</textarea></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Cambiar</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delnews_{{news.ID_N}}">Borrar</button>
|
||||
<!-- Modal borrar -->
|
||||
<div id="delnews_{{news.ID_N}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Se va a borrar la noticia</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=delnews&ID_N={{news.ID_N}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p class="black">Borrar una noticia es irreversible</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-danger">Borrar</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,21 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
|
||||
<!-- Add/edit form -->
|
||||
<section class="forms">
|
||||
<div class="container-fluid">
|
||||
<header>
|
||||
<h1 class="h3 display">No tienes permisos</h1>
|
||||
</header>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<p class="black">No tienes permisos para entrar en esta página</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,41 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
|
||||
<!-- Add/edit form -->
|
||||
<section class="forms">
|
||||
<div class="container-fluid">
|
||||
<header>
|
||||
<h1 class="h3 display">Opciones de CheckServer</h1>
|
||||
</header>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<form class="form-horizontal" method="POST" action="?page=savesettings">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Nombre de la web</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="name" type="text" placeholder="Nombre de la web" value="{{sys.name}}" class="form-control form-control-success"><small class="form-text">Nombre para sacar en titulos.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2">Cantidad de tiempo a guardar historial de resultados en días.</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="maxTimeSave" type="numeric" placeholder="Nombre del check" value="{{sys.maxTimeSave}}" class="form-control form-control-success"><small class="form-text">Por defecto, dos semanas</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-10 offset-sm-2">
|
||||
<button type="submit" class="btn btn-primary">Guardar cambios</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,191 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
|
||||
<!-- Checks -->
|
||||
<section>
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">Usuarios</h2>
|
||||
</div>
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#changepass">Editar tu contraseña</button></h2>
|
||||
</div>
|
||||
|
||||
<!-- Modal editar password -->
|
||||
<div id="changepass" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Cambiar tu contraseña</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=edituserpass" method="POST">
|
||||
<div class="modal-body">
|
||||
<p>Contraseña nueva: <input name="userpass1" type="password" value=""/><br/>
|
||||
Repetir contraseña: <input name="userpass2" type="password" value=""/></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Cambiar contraseña</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
{% if you.fullRights == 1 %} {#Only for admins #}
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2><button type="button" class="btn btn-info" data-toggle="modal" data-target="#newUser">Añadir usuario</button></h2>
|
||||
</div>
|
||||
|
||||
<!-- Modal nuevo usuario -->
|
||||
<div id="newUser" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Nuevo usuario</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=adduser" method="POST">
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Nombre: <input name="nuser_name" type="text"/><br/>
|
||||
Contraseña (Luego se puede cambiar): <input name="nuser_pass" type="password"/><br/>
|
||||
Permisos:
|
||||
<select name="nuser_type">
|
||||
<option value="1">Permisos completos</option>
|
||||
<option value="0">Solo visualización y noticias</option>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Crear usuario</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
{%endif%}
|
||||
<div class="card-block">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nombre</th>
|
||||
<th>Tipo de acceso</th>
|
||||
<th>Editar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>{{user.nick}}</td>
|
||||
<td>
|
||||
{% if user.fullrights == 0 %}
|
||||
Acceso limitado
|
||||
{% else %}
|
||||
Derechos de administración
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if you.ID_U == user.ID_U %} {#Only you can edit your name#}
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editName_{{user.ID_U}}">Editar nombre</button>
|
||||
{% endif %}
|
||||
{% if you.ID_U != user.ID_U and you.fullRights == 1 %}
|
||||
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#editPerm_{{user.ID_U}}">Cambiar permisos</button>
|
||||
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#deleteUser_{{user.ID_U}}">Borrar usuario</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Modal editar nombre -->
|
||||
<div id="editName_{{user.ID_U}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Cambiar nombre de usuario para {{user.nick}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=editusername&ID_U={{user.ID_U}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p>Nick: <input name="name_{{user.ID_U}}" type="text" value="{{user.nick}}"/></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Cambiar nombre</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
<!-- Modal cambiar permisos -->
|
||||
<div id="editPerm_{{user.ID_U}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Cambio de permisos de {{user.nick}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=edituserperm&ID_U={{user.ID_U}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Permisos:
|
||||
<select name="nperm_{{user.ID_U}}">
|
||||
<option value="1">Permisos completos</option>
|
||||
<option value="0">Solo visualización y noticias</option>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Cambiar permisos</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
|
||||
<!-- Modal borrar -->
|
||||
<div id="deleteUser_{{user.ID_U}}" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" role="document">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Borrar el usuario {{user.nick}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="?page=deluser&ID_U={{user.ID_U}}" method="POST">
|
||||
<div class="modal-body">
|
||||
<p>Borrar un usuario no es reversible, no pulses el botón si no estás seguro.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-danger">Borrar usuario</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Fin modal -->
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
@@ -1,84 +0,0 @@
|
||||
{% include 'panel/p_header.twig' %}
|
||||
<script src="assets/js/Chart.min.js"></script>
|
||||
<!-- Checks -->
|
||||
<section>
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h2 class="h5 display">Historial de los últimos {{pagedata.cant}} checks de {{pagedata.name}} - {{pagedata.group}}</h2>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-block">
|
||||
<div style="width:75%;">
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
<!-- Lastest fails -->
|
||||
<h2>{{T_.lastest_fails}}</h2>
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fecha</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for err in pagedata.fails %}
|
||||
<tr>
|
||||
<td>{{err}}</td>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Script Chartjs -->
|
||||
<script>
|
||||
var barChartData = {
|
||||
//labels: ["Correctos", "Errores"],
|
||||
datasets: [{
|
||||
label: "Correctos",
|
||||
backgroundColor: "#2B86FF",
|
||||
borderColor: "#2B86FF",
|
||||
data: [ {{ pagedata.cgood }} ]
|
||||
},{
|
||||
label: "Errores",
|
||||
backgroundColor: "#ff2a2a",
|
||||
borderColor: "#ff2a2a",
|
||||
data: [ {{ pagedata.cbad }} ]
|
||||
}]
|
||||
};
|
||||
var config = {
|
||||
type: 'bar',
|
||||
data: barChartData,
|
||||
|
||||
options: {
|
||||
responsive: true,
|
||||
legend: {
|
||||
position: 'top',
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Checks correctos y erroneos'
|
||||
},
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function() {
|
||||
var ctx = document.getElementById("canvas").getContext("2d");
|
||||
window.myBar = new Chart(ctx, config);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% include 'footer.twig' %}
|
||||
BIN
assets/images/favicon.ico
Normal file
BIN
assets/images/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
10
assets/js/Chart.min.js
vendored
10
assets/js/Chart.min.js
vendored
File diff suppressed because one or more lines are too long
29
assets/js/bootstrap-util-modal-dropdown.min.js
vendored
29
assets/js/bootstrap-util-modal-dropdown.min.js
vendored
File diff suppressed because one or more lines are too long
6
assets/js/bootstrap.min.js
vendored
6
assets/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
1789
assets/js/custom.js
Normal file
1789
assets/js/custom.js
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/js/datepicker/daterangepicker.js
Normal file
1
assets/js/datepicker/daterangepicker.js
Normal file
File diff suppressed because one or more lines are too long
4
assets/js/jquery-3.2.1.min.js
vendored
4
assets/js/jquery-3.2.1.min.js
vendored
File diff suppressed because one or more lines are too long
4
assets/js/jquery-3.2.1.slim.min.js
vendored
4
assets/js/jquery-3.2.1.slim.min.js
vendored
File diff suppressed because one or more lines are too long
7
assets/js/moment/moment.min.js
vendored
Normal file
7
assets/js/moment/moment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
assets/js/popper.min.js
vendored
5
assets/js/popper.min.js
vendored
File diff suppressed because one or more lines are too long
2
assets/js/zepto.min.js
vendored
2
assets/js/zepto.min.js
vendored
File diff suppressed because one or more lines are too long
162
assets/sqlinstalldata.sql
Normal file
162
assets/sqlinstalldata.sql
Normal file
@@ -0,0 +1,162 @@
|
||||
START TRANSACTION;
|
||||
|
||||
SET NAMES utf8;
|
||||
SET time_zone = '+00:00';
|
||||
SET foreign_key_checks = 0;
|
||||
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DROP TABLE IF EXISTS `GROUPS`;
|
||||
CREATE TABLE `GROUPS` (
|
||||
`ID_G` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(40) NOT NULL,
|
||||
PRIMARY KEY (`ID_G`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `MAIL`;
|
||||
CREATE TABLE `MAIL` (
|
||||
`ID_M` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`Type` varchar(20) NOT NULL,
|
||||
`Msg` varchar(255) NOT NULL,
|
||||
`Solved` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`Sent` tinyint(4) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID_M`),
|
||||
KEY `ID_SERV` (`ID_SERV`),
|
||||
CONSTRAINT `MAIL_ibfk_1` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `P_ALERTS`;
|
||||
CREATE TABLE `P_ALERTS` (
|
||||
`ID_A` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`Type` varchar(15) NOT NULL,
|
||||
`Param` varchar(20) NOT NULL,
|
||||
`Timestamp` varchar(12) NOT NULL,
|
||||
`Msg` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`ID_A`),
|
||||
UNIQUE KEY `ID_SERV_Type_Param` (`ID_SERV`,`Type`,`Param`),
|
||||
CONSTRAINT `P_ALERTS_ibfk_2` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `SERVERS`;
|
||||
CREATE TABLE `SERVERS` (
|
||||
`ID_SERV` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(40) NOT NULL,
|
||||
`Description` varchar(255) NOT NULL,
|
||||
`IP` varchar(18) NOT NULL,
|
||||
`SO` varchar(20) NOT NULL,
|
||||
`Version` varchar(70) NOT NULL,
|
||||
`Group` int(11) DEFAULT NULL,
|
||||
`User` varchar(40) DEFAULT NULL,
|
||||
`Password` varchar(64) DEFAULT NULL,
|
||||
`IV` varchar(32) DEFAULT NULL,
|
||||
`BadCreds` tinyint(4) DEFAULT '0',
|
||||
`SSHPort` smallint(6) DEFAULT NULL,
|
||||
`Enabled` int(11) DEFAULT '1',
|
||||
`Online` int(11) DEFAULT '1',
|
||||
`Uptime` int(11) DEFAULT '0',
|
||||
`LastCheck` int(11) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`ID_SERV`),
|
||||
KEY `Group` (`Group`),
|
||||
CONSTRAINT `SERVERS_ibfk_2` FOREIGN KEY (`Group`) REFERENCES `GROUPS` (`ID_G`) ON DELETE SET NULL ON UPDATE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `SYS`;
|
||||
CREATE TABLE `SYS` (
|
||||
`Option` varchar(20) NOT NULL,
|
||||
`Value` varchar(20) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `S_HDDSTAT`;
|
||||
CREATE TABLE `S_HDDSTAT` (
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`Timestamp` int(11) NOT NULL,
|
||||
`HDD` varchar(40) NOT NULL,
|
||||
`Space` bigint(20) DEFAULT NULL,
|
||||
`Freespace` bigint(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID_SERV`,`Timestamp`,`HDD`),
|
||||
CONSTRAINT `S_HDDSTAT_ibfk_1` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `S_HISTPING`;
|
||||
CREATE TABLE `S_HISTPING` (
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`Timestamp` int(11) NOT NULL,
|
||||
`Value` int(11) NOT NULL DEFAULT '-1',
|
||||
PRIMARY KEY (`ID_SERV`,`Timestamp`),
|
||||
CONSTRAINT `S_HISTPING_ibfk_1` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `S_HISTRAM`;
|
||||
CREATE TABLE `S_HISTRAM` (
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`Timestamp` int(11) NOT NULL,
|
||||
`Freeram` bigint(20) NOT NULL,
|
||||
`Detram` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`ID_SERV`,`Timestamp`,`Freeram`),
|
||||
CONSTRAINT `S_HISTRAM_ibfk_1` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `S_HISTSERVICES`;
|
||||
CREATE TABLE `S_HISTSERVICES` (
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`Name` varchar(40) NOT NULL,
|
||||
`Timestamp` int(11) NOT NULL,
|
||||
`Status` int(11) NOT NULL,
|
||||
PRIMARY KEY (`ID_SERV`,`Name`,`Timestamp`),
|
||||
CONSTRAINT `S_HISTSERVICES_ibfk_1` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `S_INGROUP`;
|
||||
CREATE TABLE `S_INGROUP` (
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`ID_G` int(11) NOT NULL,
|
||||
UNIQUE KEY `ID_SERV_ID_G` (`ID_SERV`,`ID_G`),
|
||||
KEY `ID_G` (`ID_G`),
|
||||
CONSTRAINT `S_INGROUP_ibfk_3` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `S_INGROUP_ibfk_4` FOREIGN KEY (`ID_G`) REFERENCES `GROUPS` (`ID_G`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `S_SERVICES`;
|
||||
CREATE TABLE `S_SERVICES` (
|
||||
`ID_SERV` int(11) NOT NULL,
|
||||
`Name` varchar(40) NOT NULL,
|
||||
`Type` varchar(15) NOT NULL,
|
||||
`Description` varchar(40) DEFAULT NULL,
|
||||
`Enabled` int(11) DEFAULT '1',
|
||||
`Status` int(11) DEFAULT '1',
|
||||
PRIMARY KEY (`ID_SERV`,`Name`),
|
||||
CONSTRAINT `S_SERVICES_ibfk_1` FOREIGN KEY (`ID_SERV`) REFERENCES `SERVERS` (`ID_SERV`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `USERS`;
|
||||
CREATE TABLE `USERS` (
|
||||
`ID_U` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(40) NOT NULL,
|
||||
`Password` varchar(100) NOT NULL,
|
||||
`Email` varchar(40) NOT NULL,
|
||||
`SendMail` tinyint(4) NOT NULL,
|
||||
`Enabled` int(11) DEFAULT '1',
|
||||
`PE_editserv` int(11) DEFAULT '0',
|
||||
`PE_admin` int(11) DEFAULT '0',
|
||||
PRIMARY KEY (`ID_U`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
INSERT INTO `SYS` (`Option`, `Value`) VALUES
|
||||
('HDDALERT', '5'), ('RAMALERT','5'),('AUTODELETE','30');
|
||||
|
||||
COMMIT;
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
//English (Use as a reference) - Maybe grammar can be fixed
|
||||
if (!defined('T_ENGVERSION')){
|
||||
define('T_ENGVERSION',1);
|
||||
}
|
||||
|
||||
//(indexpage.twig) In index, title
|
||||
$T_['statdif1'] = 'Status of different checks';
|
||||
$T_['name'] = 'Name';
|
||||
$T_['group'] = 'Group';
|
||||
$T_['status'] = 'Status';
|
||||
$T_['status_uptime'] = 'Status (Uptime)';
|
||||
$T_['failed'] = 'Failed';
|
||||
$T_['last_check'] = 'Last check';
|
||||
$T_['last_err'] = 'Last error';
|
||||
$T_['last_news'] = 'Lastest news';
|
||||
//(indexpage.twig)[NEXT 6] Marking as good, problems or other in status.
|
||||
$T_['status_right'] = 'Well';
|
||||
$T_['status_lproblems'] = 'Maybe some light fails';
|
||||
$T_['status_problems'] = 'Some outages';
|
||||
$T_['status_outofserv'] = 'Out of service';
|
||||
$T_['status_maintenance'] = 'In maintenance';
|
||||
$T_['status_empty'] = 'No checks yet';
|
||||
$T_['no_errs'] = 'No errors';
|
||||
$T_['add'] = 'Add';
|
||||
$T_['edit'] = 'Edit';
|
||||
$T_['delete'] = 'Delete';
|
||||
$T_['more_opts'] = 'More options';
|
||||
$T_['check_type'] = 'Type of check';
|
||||
//(admin panel)[NEXT 6] Left menu of panel
|
||||
$T_['home'] = 'Home';
|
||||
$T_['checks'] = 'Checks';
|
||||
$T_['groups'] = 'Groups';
|
||||
$T_['news'] = 'News';
|
||||
$T_['settings'] = 'Settings';
|
||||
$T_['users'] = 'Users';
|
||||
//[NEXT 5]Check texts
|
||||
$T_['PING_IP'] = 'Ping to IP:Port';
|
||||
$T_['HTTP_CODE'] = 'Http code';
|
||||
$T_['VISIT_COUNT'] = 'Visit counter';
|
||||
$T_['DATABASE'] = 'Database check';
|
||||
$T_['JSON_API'] = 'JSON API';
|
||||
$T_['add_grp_to_add_chk'] = 'Add a group for start adding checks';
|
||||
$T_['view_hist'] = 'View history';
|
||||
$T_['lastest_fails'] = 'Lastest fails';
|
||||
?>
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
//Español (Oficial)
|
||||
if (!defined('T_VERSION')){
|
||||
define('T_VERSION',1);
|
||||
}
|
||||
|
||||
//(indexpage.twig) In index, title
|
||||
$T_['statdif1'] = 'Estado de los diferentes servicios';
|
||||
$T_['name'] = 'Nombre';
|
||||
$T_['group'] = 'Grupo';
|
||||
$T_['status'] = 'Estado';
|
||||
$T_['status_uptime'] = 'Estado (Uptime)';
|
||||
$T_['failed'] = 'Erróneo';
|
||||
$T_['last_check'] = 'Última comprobación';
|
||||
$T_['last_err'] = 'Último error';
|
||||
$T_['last_news'] = 'Últimas noticias';
|
||||
//(indexpage.twig) [NEXT 6] Marking as good, problems or other in status.
|
||||
$T_['status_right'] = 'Todo correcto';
|
||||
$T_['status_lproblems'] = 'Problemas de rendimiento';
|
||||
$T_['status_problems'] = 'Problemas';
|
||||
$T_['status_outofserv'] = 'Fuera de servicio';
|
||||
$T_['status_maintenance'] = 'En mantenimiento';
|
||||
$T_['status_empty'] = 'Sin registros';
|
||||
$T_['no_errs'] = 'Sin errores';
|
||||
$T_['add'] = 'Añadir';
|
||||
$T_['edit'] = 'Editar';
|
||||
$T_['delete'] = 'Borrar';
|
||||
$T_['more_opts'] = 'Más opciones';
|
||||
$T_['check_type'] = 'Tipo de check';
|
||||
//(admin panel)[NEXT 6] Left menu of panel
|
||||
$T_['home'] = 'Inicio';
|
||||
$T_['checks'] = 'Checks';
|
||||
$T_['groups'] = 'Grupos';
|
||||
$T_['news'] = 'Noticias';
|
||||
$T_['settings'] = 'Opciones';
|
||||
$T_['users'] = 'Usuarios';
|
||||
//[NEXT 5]Check texts
|
||||
$T_['PING_IP'] = 'Ping a IP:Puerto';
|
||||
$T_['HTTP_CODE'] = 'Código HTTP';
|
||||
$T_['VISIT_COUNT'] = 'Contador de visitas';
|
||||
$T_['DATABASE'] = 'Conexión a base de datos';
|
||||
$T_['JSON_API'] = 'JSON API';
|
||||
$T_['add_grp_to_add_chk'] = 'Añade un grupo para empezar a añadir checks';
|
||||
$T_['view_hist'] = 'Ver histórico';
|
||||
$T_['lastest_fails'] = 'Ultimos errores';
|
||||
?>
|
||||
@@ -1,12 +0,0 @@
|
||||
# ¿How it works?
|
||||
|
||||
It's based in a array ($T_[]), because it pass to Twig as T_.TEXT, for "fast" translating it.
|
||||
In the english.php there are annotations for all, and its the reference for new versions.
|
||||
There is a T_VERSION as define, for knowing version of this translate, changed when new sentences are.
|
||||
|
||||
When help, its only for next line (Unless specified), and is provided with a starting comment like that:
|
||||
'''
|
||||
//(Example twig page with it) Description
|
||||
$T_['internal_name'] = 'Translation';
|
||||
'''
|
||||
Lines before that are not of that help.
|
||||
8
config/config.php
Normal file
8
config/config.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
define('ENCPASSWD','vkOqNKNn6Q9b');
|
||||
define('SGBD','mysqli');
|
||||
define('DBSERVER','192.168.1.20');
|
||||
define('DBUSER','checkuser');
|
||||
define('DBPASS','db=checkserver');
|
||||
define('DBDATABASE','checkserver');
|
||||
define('DEBUG',false); ?>
|
||||
9
config/config.php.bak
Normal file
9
config/config.php.bak
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
define('ENCPASSWD','asir2m');
|
||||
define('SGBD','sqlite3'); //mysqli
|
||||
define('DBSERVER','file.sqlite');
|
||||
define('DBUSER',NULL);
|
||||
define('DBPASS',NULL);
|
||||
define('DBDATABASE',NULL);
|
||||
define('DEBUG',true);
|
||||
?>
|
||||
46
counter.js
46
counter.js
@@ -1,46 +0,0 @@
|
||||
var script = document.currentScript; //For know path
|
||||
|
||||
//Returns path of file, without /
|
||||
function cutUrlFile(cad){
|
||||
chars = cadena.split("");
|
||||
blocks = cadena.split("/");
|
||||
blockNum=1;
|
||||
|
||||
if(chars[chars.length-1]==="/"){
|
||||
blockNum++;
|
||||
}
|
||||
|
||||
pseudoReturn = [];
|
||||
|
||||
for(i=0;i<blocks.length-blockNum;i++){
|
||||
pseudoReturn.push(blocks[i]);
|
||||
}
|
||||
|
||||
return pseudoReturn.join("/");
|
||||
}
|
||||
|
||||
var path = cutUrlFile(script.src); //Path, for calling php in Ajax
|
||||
|
||||
function loadcounter() { //Todo el js
|
||||
var cookiename = "CheckWeb" + SiteID;
|
||||
var b = document.cookie.match('(^|;)\\s*' + cookiename + '\\s*=\\s*([^;]+)');
|
||||
var iscookie = b ? b.pop() : '';
|
||||
if (iscookie != ""){
|
||||
var visited = 1; //Visitado
|
||||
}else{ //Si no esta visitado, hacer la cookie y contar visita unica
|
||||
var visited = 0;
|
||||
var d = new Date();
|
||||
d.setTime(d.getTime() + (24*3600*1000));
|
||||
var expires = "expires="+ d.toUTCString();
|
||||
document.cookie = "CheckWeb" + SiteID + "=visited" + "; " + expires;
|
||||
}
|
||||
// Enviamos los datos para introducir en la DB
|
||||
// Obtener la instancia del objeto XMLHttpRequest
|
||||
conexion = new XMLHttpRequest();
|
||||
// Realizar peticion HTTP
|
||||
conexion.open('POST', path+'/counterajax.php');
|
||||
conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
conexion.send("SiteID="+SiteID+"&visited="+visited);
|
||||
}
|
||||
|
||||
loadcounter(); //Para que funcione
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
require_once "connect.php";
|
||||
|
||||
$ID_C = $_POST['SiteID']; //Web del contador
|
||||
$visited = $_POST['visited'];
|
||||
$pause = 0;
|
||||
$dateVis = date('ymd'); //añomesdia
|
||||
if ($pause == "0"){ //Si el argumento pause existe y es 0, contar la visita.
|
||||
if (dbw_query_fetch_array($db_conn, "SELECT COUNT(`date`) FROM VISITS WHERE ID_C = '$ID_C' AND `date` = '$dateVis'")[0] == 0) //Para saber si existe la tupla
|
||||
{
|
||||
dbw_query($db_conn, "INSERT INTO VISITS (ID_C, `date`) VALUES ('$ID_C', '$dateVis')");
|
||||
}
|
||||
if ($visited=='0'){ //Si la cookie no existe, crearla (Visita unica)
|
||||
//Añadir a la BD como visita única nueva, siguiendo las opciones de conteo establecidas
|
||||
dbw_query($db_conn, "UPDATE VISITS SET `uniqueVisits` = `uniqueVisits`+'1' WHERE ID_C = '$ID_C' AND `date` = '$dateVis'"); //Añadimos visita unica
|
||||
}
|
||||
dbw_query($db_conn, "UPDATE VISITS SET `visits` = `visits`+'1' WHERE ID_C = '$ID_C' AND `date` = '$dateVis'"); //Añadimos visita normal siempre
|
||||
} //Fin de no pause. Si esta pausada esto no hará nada
|
||||
101
cron/cron.php
Normal file
101
cron/cron.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
//Cron automático, con llamada manual por argumentos
|
||||
|
||||
require_once __DIR__ .'/../functions.php';
|
||||
$db_conn = dbconn();
|
||||
|
||||
if (isset($argv[1]) && (int)$argv[1] != 0){ //Si se envió un servidor forzado por un argumento...
|
||||
$ID_SERV = (int)$argv[1];
|
||||
$pcsenabled = dbw_query($db_conn,"SELECT * FROM SERVERS WHERE ID_SERV='$ID_SERV'");
|
||||
}else{
|
||||
$pcsenabled = dbw_query($db_conn,"SELECT * FROM SERVERS WHERE `Enabled`=1");
|
||||
}
|
||||
|
||||
require_once __DIR__ .'/servers.php';
|
||||
|
||||
$tryping = ping('127.0.0.1'); //Try if ping work
|
||||
|
||||
while ($pc = dbw_fetch_array($db_conn,$pcsenabled)){
|
||||
$ID_SERV = $pc['ID_SERV'];
|
||||
|
||||
foreach ($pc as $key => $value){ //Clean data, and update data in db if it's bad
|
||||
if ($pc[$key] != trim($pc[$key])){
|
||||
$pc[$key] = trim($pc[$key]);
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET `$key`='$pc[$key]' WHERE ID_SERV='$ID_SERV'");
|
||||
}
|
||||
}
|
||||
|
||||
/* Some hosts doesn't have an IP, has a DNS, then first check if host is a real IP, or can be DNS queried. Ever work with the IP */
|
||||
if (!filter_var($pc['IP'], FILTER_VALIDATE_IP)){ //If its not a IP (Its a hostname)
|
||||
$pc['IP'] = gethostbyname($pc['IP'].'.'); //Resolve hostname and set IP
|
||||
if (!filter_var($pc['IP'], FILTER_VALIDATE_IP)){ //If domain doesn't resolve, it returns a string or false, will not validate
|
||||
$notdetectedip = 1; // Return 1 if IP can't be translated (Computer off or bad writed)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$time = time();
|
||||
$pc['Password'] = decodePassword($pc['Password'],$pc['IV']); //Decoding password before starting
|
||||
|
||||
if ($tryping != -1){ //Only if I can ping. (Root/cron)
|
||||
$res = cron_ping($db_conn,$time,$pc);
|
||||
if ($res == -1 ){ //PC Off
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update SQL Last Check time */
|
||||
$timestamp = time();
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET LastCheck='$timestamp' WHERE ID_SERV='$ID_SERV'");
|
||||
|
||||
//This tries to login computer, and if not, cancel going next things.
|
||||
$result = try_login($pc);
|
||||
if ($result == 1){
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET BadCreds='0' WHERE ID_SERV='$ID_SERV'");
|
||||
}else if ($result == 2){ //Windows WMI error, not about credentials
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET BadCreds='2' WHERE ID_SERV='$ID_SERV'");
|
||||
continue;
|
||||
}else{
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET BadCreds='1' WHERE ID_SERV='$ID_SERV'");
|
||||
continue;
|
||||
}
|
||||
|
||||
$tstamp = dbw_query_fetch_array($db_conn,"SELECT `Timestamp` FROM S_HDDSTAT WHERE ID_SERV='$pc[ID_SERV]' ORDER BY `Timestamp` DESC LIMIT 1")[0];
|
||||
if ((!$tstamp || abs(time() - $tstamp) > (30*60)) || isset($argv[1])){ //30 minutos o forzar si lo piden
|
||||
cron_status($db_conn,$time,$pc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Services
|
||||
$services = dbw_query($db_conn,"SELECT ID_SERV,`Name` FROM S_SERVICES WHERE ID_SERV='$pc[ID_SERV]' AND `Enabled`=1 AND `Type`='SERVICE'");
|
||||
while ($service = dbw_fetch_array($db_conn,$services)){
|
||||
cron_service($db_conn,$time,$pc,$service);
|
||||
}
|
||||
|
||||
//Web pages
|
||||
$services = dbw_query($db_conn,"SELECT ID_SERV,`Name` FROM S_SERVICES WHERE ID_SERV='$pc[ID_SERV]' AND `Enabled`=1 AND `Type`='WEBSERVICE'");
|
||||
while ($service = dbw_fetch_array($db_conn,$services)){
|
||||
cron_webservice($db_conn,$time,$pc,$service);
|
||||
}
|
||||
|
||||
cron_uptime($db_conn,$time,$pc); //Uptime
|
||||
|
||||
|
||||
//Get type of linux
|
||||
if ($pc['SO'] == 'LINUX'){ //Only update if needs (Todo?)
|
||||
detect_linux($pc);
|
||||
}
|
||||
|
||||
cron_getversion($db_conn,$pc); //Windows/Linux version name
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Cleaning
|
||||
$when = time() - (getsysopt('AUTODELETE') * 24*3600);
|
||||
dbw_query($db_conn,"DELETE FROM S_HDDSTAT WHERE `Timestamp` < '$when'");
|
||||
dbw_query($db_conn,"DELETE FROM S_HISTRAM WHERE `Timestamp` < '$when'");
|
||||
dbw_query(dbconn(),"DELETE FROM S_HISTPING WHERE `Timestamp` < '$when'");
|
||||
dbw_query(dbconn(),"DELETE FROM S_HISTSERVICES WHERE `Timestamp` < '$when'");
|
||||
0
cron/mail.php
Normal file
0
cron/mail.php
Normal file
311
cron/servers.php
Normal file
311
cron/servers.php
Normal file
@@ -0,0 +1,311 @@
|
||||
<?php
|
||||
|
||||
// En todas las funciones, la llamada a gestionAlerta debe ser anterior a meter los datos en el historico, sino no se puede comparar.
|
||||
|
||||
function cron_ping($db_conn,$time,$pc){
|
||||
|
||||
$res = ping($pc['IP']); //Created func.
|
||||
if ($res != '-1'){
|
||||
gestionAlerta($pc,'PING','ping',1); //1 -> OK, 0 -> Not OK
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET `Online` = 1 WHERE ID_SERV='$pc[ID_SERV]'");
|
||||
|
||||
}else{ //Off / No ping
|
||||
gestionAlerta($pc,'PING','ping',0);
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET `Online` = 0, Uptime = 0 WHERE ID_SERV='$pc[ID_SERV]'");
|
||||
}
|
||||
|
||||
//Only change if ping number changes
|
||||
if ((int)dbw_query_fetch_array($db_conn,"SELECT * FROM S_HISTPING WHERE ID_SERV='$pc[ID_SERV]' ORDER BY `Timestamp` DESC LIMIT 1")['Value'] !== (int)$res){
|
||||
dbw_query($db_conn,"INSERT INTO S_HISTPING (ID_SERV,`Timestamp`,`Value`) VALUES ('$pc[ID_SERV]','$time','$res')");
|
||||
}else if (dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_HISTPING WHERE ID_SERV='$pc[ID_SERV]'")[0] == 0){ //If empty.
|
||||
dbw_query($db_conn,"INSERT INTO S_HISTPING (ID_SERV,`Timestamp`,`Value`) VALUES ('$pc[ID_SERV]','$time','$res')");
|
||||
}
|
||||
|
||||
if (DEBUG){
|
||||
$log[] = "Ping: ".$res;
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function cron_service($db_conn,$time,$pc,$service){
|
||||
|
||||
switch ($pc['SO']){
|
||||
case 'WINDOWS':
|
||||
$resu = shell_exec('net rpc service status '.$service['Name'].' -I '.$pc['IP'].' -U \''.$pc['User'].'%'.$pc['Password'].'\' 2>&1');
|
||||
|
||||
if (strpos($resu, 'stop') !== false || strpos($resu, 'WERR') !== false){
|
||||
$status = 0; //Not Working
|
||||
}else{
|
||||
$status = 1;
|
||||
}
|
||||
break;
|
||||
case 'LINUX_SYSTEMD':
|
||||
$lines = explode(PHP_EOL,commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'systemctl status '.$service['Name'].'>/dev/null;echo $?'));
|
||||
$lines = removeEmptyLines($lines);
|
||||
$lastline = $lines[count($lines)-1];
|
||||
$status = $lastline != 0 ? 0 : 1; //3 is stop, 4 is non exist
|
||||
break;
|
||||
case 'LINUX_SERVICE':
|
||||
$lines = explode(PHP_EOL,commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'service '.$service['Name'].' status;echo $?'));
|
||||
$lastline = $lines[count($lines)-1];
|
||||
$status = $lastline != 0 ? 0 : 1; //3 is stop (TODO see number)
|
||||
break;
|
||||
case 'LINUX': //Proceso
|
||||
$lines = explode(PHP_EOL,commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'ps -A | grep '.$service['Name']));
|
||||
//$lastline = $lines[count($lines)-1];
|
||||
if (count($lines)){
|
||||
$status = 1;
|
||||
}else{
|
||||
$status = 0; //Not found
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
gestionAlerta($pc,'SERVICE',$service['Name'],$status);
|
||||
//Update in tables
|
||||
dbw_query($db_conn,"UPDATE S_SERVICES SET `Status` = '$status' WHERE ID_SERV='$pc[ID_SERV]' AND `Name` = '$service[Name]'");
|
||||
|
||||
|
||||
|
||||
//Only change if ping number changes
|
||||
if ((int)dbw_query_fetch_array($db_conn,"SELECT * FROM S_HISTSERVICES WHERE ID_SERV='$pc[ID_SERV]' ORDER BY `Timestamp` DESC LIMIT 1")['Status'] !== (int)$status){
|
||||
dbw_query($db_conn,"INSERT INTO S_HISTSERVICES (ID_SERV,`Name`,`Timestamp`,`Status`) VALUES ('$pc[ID_SERV]','$service[Name]','$time','$status')");
|
||||
}else if (dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_HISTSERVICES WHERE ID_SERV='$pc[ID_SERV]'")[0] == 0){ //If empty.
|
||||
dbw_query($db_conn,"INSERT INTO S_HISTSERVICES (ID_SERV,`Name`,`Timestamp`,`Status`) VALUES ('$pc[ID_SERV]','$service[Name]','$time','$status')");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function cron_webservice($db_conn,$time,$pc,$service){
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $service['Name']);
|
||||
curl_setopt($ch, CURLOPT_HEADER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 3); //timeout in seconds
|
||||
$head = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
if ($head = 200){
|
||||
$status = 1;
|
||||
}else{
|
||||
$status = 0;
|
||||
}
|
||||
|
||||
gestionAlerta($pc,'WEBSERVICE',$service['Name'],$status);
|
||||
|
||||
dbw_query($db_conn,"UPDATE S_SERVICES SET `Status` = '$status' WHERE ID_SERV='$pc[ID_SERV]' AND `Name` = '$service[Name]'");
|
||||
|
||||
//Only change if ping number changes
|
||||
if ((int)dbw_query_fetch_array($db_conn,"SELECT * FROM S_HISTSERVICES WHERE ID_SERV='$pc[ID_SERV]' ORDER BY `Timestamp` DESC LIMIT 1")['Status'] !== (int)$status){
|
||||
dbw_query($db_conn,"INSERT INTO S_HISTSERVICES (ID_SERV,`Name`,`Timestamp`,`Status`) VALUES ('$pc[ID_SERV]','$service[Name]','$time','$status')");
|
||||
}else if (dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_HISTSERVICES WHERE ID_SERV='$pc[ID_SERV]'")[0] == 0){ //If empty.
|
||||
dbw_query($db_conn,"INSERT INTO S_HISTSERVICES (ID_SERV,`Name`,`Timestamp`,`Status`) VALUES ('$pc[ID_SERV]','$service[Name]','$time','$status')");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Function status for cron
|
||||
function cron_status($db_conn,$time,$pc){
|
||||
$pass =$pc['Password'];
|
||||
|
||||
//Get Free RAM and total RAM
|
||||
if ($pc['SO'] == "WINDOWS"){
|
||||
$wql = "select FreePhysicalMemory from Win32_OperatingSystem";
|
||||
$freeramwmic = shell_exec('wmic -U \''.$pc['User'].'%'.$pass.'\' //'.$pc['IP'].' "'.$wql.'"');
|
||||
|
||||
//showdeb($freeramwmic);
|
||||
|
||||
$freeramexp = explode(PHP_EOL,$freeramwmic);
|
||||
$freeram = explode('|',$freeramexp[2])[0]*1024; //Third line. Windows doesn't have tail -n+3 and cut. Also show in KB
|
||||
|
||||
$wql = "select TotalPhysicalMemory from Win32_ComputerSystem";
|
||||
$totalramwmic = shell_exec('wmic -U '.$pc['User'].'%'.$pass.' //'.$pc['IP'].' "'.$wql.'"');
|
||||
$totalramexp = explode(PHP_EOL,$totalramwmic);
|
||||
$detram = explode('|',$totalramexp[2])[1]; //Third line. Windows doesn't have tail an cut. This is in KB directly
|
||||
|
||||
}else{ //Systemd and init goes same way
|
||||
$resu = commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pass,'free -b | tail -n+2 | head -1');
|
||||
$line = preg_replace("/[[:blank:]]+/",' ',$resu);
|
||||
$part = explode(' ',$line);
|
||||
//Mem: total used free shared buff/cache available
|
||||
$detram = $part[1]; //Total RAM
|
||||
if (isset($part[6])){
|
||||
$freeram = $part[6];//Avaiable
|
||||
}else{ //Some systems do not have avaiable col
|
||||
$freeram = $part[4];//Free
|
||||
}
|
||||
}
|
||||
dbw_query($db_conn,"INSERT INTO S_HISTRAM (ID_SERV,`Timestamp`,Freeram,Detram) VALUES ('$pc[ID_SERV]','$time','$freeram','$detram')");
|
||||
|
||||
if (percalertfor('RAM')){ //Only set if alert percent is configured.
|
||||
$percent = percent($freeram,$detram);
|
||||
if (percent($freeram,$detram) < percalertfor('RAM')){ //HDD Lower than alert position
|
||||
gestionAlerta($pc,'RAM',$percent,0); //1 -> OK, 0 -> Not OK
|
||||
}else{
|
||||
gestionAlerta($pc,'RAM',$percent,1); //1 -> OK, 0 -> Not OK
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get drives and free space
|
||||
if ($pc['SO'] == "WINDOWS"){
|
||||
$resu = shell_exec('wmic -U \''.$pc['User'].'%'.$pass.'\' //'.$pc['IP'].' "select FreeSpace,Size from Win32_LogicalDisk where DriveType=3"');
|
||||
$explines = explode(PHP_EOL,$resu);
|
||||
$explines = removeEmptyLines($explines);
|
||||
//As Windows doesnt have tail command, I have to emulate " | tail -n+2"
|
||||
if (DEBUG)
|
||||
var_dump($explines);
|
||||
for ($x = 0;$x < 2;$x++){array_shift($explines);}
|
||||
|
||||
|
||||
foreach($explines as $line){
|
||||
$part = explode('|',$line);
|
||||
//Drive, Space, FreeSpace
|
||||
if (isset($part[1]) && $part[2] != 0){
|
||||
$unidades[] = array ($part[0],$part[2],$part[1]);
|
||||
}
|
||||
}
|
||||
}else{ //Systemd and init goes same way
|
||||
//I use exec for avoid alias that bash can have (Anarchy has a custom df alias for example)
|
||||
$resu = commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pass,'exec df -P -B1 --output=fstype,size,avail,target -x tmpfs -x udev -x devtmpfs | tail -n+2');
|
||||
|
||||
if (strpos ($resu , 'df --help')){ //Esto suele pasar en redhat y centos porque No soportan --output Probamos alternativa que parece ser estandar en estos sistemas
|
||||
$resu = commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pass,'exec df -P -B1 -x tmpfs -x udev -x devtmpfs | tail -n+2');
|
||||
$explines = preg_split('/[\r\n]+/', $resu);
|
||||
foreach($explines as $line){
|
||||
$line = preg_replace("/[[:blank:]]+/",' ',$line);
|
||||
$part = explode(' ',$line);
|
||||
//S.ficheros Bloques de 1 Usado Dispon Ocupado Montado en
|
||||
if (isset($part[1])){
|
||||
$unidades[] = array ($part[5],$part[1],$part[3]);//Drive, Space, FreeSpace
|
||||
}
|
||||
}
|
||||
}else{ //Si el comando acabó correctamente, todo estandar (Centos 6+, Debian, Ubuntu...)
|
||||
$explines = preg_split('/[\r\n]+/', $resu);
|
||||
foreach($explines as $line){
|
||||
$line = preg_replace("/[[:blank:]]+/",' ',$line);
|
||||
$part = explode(' ',$line);
|
||||
//S.ficheros,Tamaño,Usado,Montado en
|
||||
if (isset($part[1])){
|
||||
$unidades[] = array ($part[3],$part[1],$part[2]);//Drive, Space, FreeSpace
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//showdeb($unidades);
|
||||
|
||||
foreach ($unidades as $disk){ //Array disks and space, put in database, and see if I want to alert (Low space)
|
||||
if ($disk[1] > 0){ //Only save if disk is a real one
|
||||
dbw_query($db_conn,"INSERT INTO S_HDDSTAT (ID_SERV,`Timestamp`,`HDD`,`Space`,`Freespace`) VALUES ('$pc[ID_SERV]','$time','$disk[0]','$disk[1]','$disk[2]')");
|
||||
|
||||
if (percalertfor('HDD')){ //Only set if alert percent is configured.
|
||||
if (percent($disk[2],$disk[1]) < percalertfor('HDD')){ //HDD Lower than alert position
|
||||
gestionAlerta($pc,'HDD',"$disk[0]",0); //1 -> OK, 0 -> Not OK
|
||||
}else{
|
||||
gestionAlerta($pc,'HDD',"$disk[0]",1); //1 -> OK, 0 -> Not OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function cron_uptime($db_conn,$time,$pc){
|
||||
//Get Uptime
|
||||
if ($pc['SO'] == "WINDOWS"){
|
||||
$resu = shell_exec('wmic -U \''.$pc['User'].'%'.$pc['Password'].'\' //'.$pc['IP'].' "select lastBootupTime from Win32_OperatingSystem" | grep "\." | cut -d"." -f1');
|
||||
$datetime = date_create_from_format ('YmdHis', (int)$resu );
|
||||
$timestamp = date_timestamp_get ($datetime);
|
||||
$uptime = time() - $timestamp;
|
||||
}else{ //Systemd and init goes same way
|
||||
$uptime = explode('.',commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'cat /proc/uptime'))[0];
|
||||
if (DEBUG)
|
||||
echo $uptime;
|
||||
}
|
||||
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET Uptime='$uptime' WHERE ID_SERV='$pc[ID_SERV]'");
|
||||
}
|
||||
|
||||
function cron_getversion($db_conn,$pc){
|
||||
if ($pc['SO'] == "WINDOWS"){
|
||||
$resu = shell_exec('wmic -U \''.$pc['User'].'%'.$pc['Password'].'\' //'.$pc['IP'].' "select Caption from Win32_OperatingSystem"');
|
||||
|
||||
$explines = preg_split('/[\r\n]+/', $resu);
|
||||
$part = explode('|',$explines[2]);
|
||||
$version = $part[0];
|
||||
}else{ //Systemd and init goes same way
|
||||
$part = explode('"',commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'cat /etc/os-release | grep PRETTY_NAME'));
|
||||
if (isset($part[1])){
|
||||
$version = $part[1];
|
||||
}else{
|
||||
$version = commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'cat /etc/redhat-release');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dbw_query($db_conn,"UPDATE SERVERS SET `Version`='$version' WHERE ID_SERV='$pc[ID_SERV]'");
|
||||
}
|
||||
|
||||
|
||||
function try_login($pc){
|
||||
if ($pc['SO'] == "WINDOWS"){
|
||||
|
||||
exec ('wmic -U \''.$pc['User'].'%'.$pc['Password'].'\' //'.$pc['IP'].' "select Caption from Win32_OperatingSystem" 2>&1', $resu, $return_var );
|
||||
|
||||
foreach ($resu as $line){
|
||||
if (strpos($line, '0x80041045') !== FALSE){ //Error de WMI bloqueado
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
if ($return_var != 0){
|
||||
return NULL;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}else{ //Systemd and init goes same way
|
||||
$part = commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'echo "TRY"');
|
||||
if ($part == NULL){
|
||||
return NULL;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function detect_linux($pc,$forcedetect = NULL){
|
||||
if ($pc['SO'] == 'LINUX' ||$forcedetect){
|
||||
|
||||
|
||||
//Search for systemd
|
||||
$lines = explode(PHP_EOL,commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'systemctl --version &>/dev/null;echo $?'));
|
||||
$lines = removeEmptyLines($lines);
|
||||
$lastline = $lines[count($lines)-1];
|
||||
if (! ($lastline > 0)){
|
||||
dbw_query(dbconn(),"UPDATE SERVERS SET SO='LINUX_SYSTEMD' WHERE ID_SERV='$pc[ID_SERV]'");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Search for "service"
|
||||
$lines = explode(PHP_EOL,commandbyssh($pc['IP'],$pc['SSHPort'],$pc['User'],$pc['Password'],'service --status-all &>/dev/null;echo $?'));
|
||||
$lines = removeEmptyLines($lines);
|
||||
$lastline = $lines[count($lines)-1];
|
||||
if (! ($lastline > 0)){
|
||||
dbw_query(dbconn(),"UPDATE SERVERS SET SO='LINUX_SERVICE' WHERE ID_SERV='$pc[ID_SERV]'");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
13
cron/switchs/discover.php
Normal file
13
cron/switchs/discover.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
require_once dirname( __FILE__ ) . '/../../lib/OSS_SNMP-master/SNMP.php'; //Load SNMP
|
||||
|
||||
$ip = $_GET['IP'];
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $ip, 'public' );
|
||||
|
||||
echo "\nSystem information for {$ip}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
117
cronchk.php
117
cronchk.php
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
require_once "load.php";
|
||||
|
||||
function PING_IP($ID_C,$URL){
|
||||
if (strpos($URL, ":")){ //Si usa un puerto, dividir
|
||||
$host = explode(":", $URL)[0];
|
||||
$port = explode(":", $URL)[1];
|
||||
}else{$host=$URL;}
|
||||
$result = isset($port) ? ping($host,$port) : ping($host); //Ping IP with or without port
|
||||
return $result; //Returns result
|
||||
}
|
||||
|
||||
function HTTP_CODE($ID_C,$URL,$Param){
|
||||
$httpCode = httpCode($URL); //Code
|
||||
|
||||
$code = (int)$Param != 0 ? $Param : 200; //Establish the code test want to see
|
||||
|
||||
if ($httpCode == $code){ //Si es igual
|
||||
$ret = 0; //All right
|
||||
}else{ //Si no es igual (Incluye false)
|
||||
$ret = (int)$httpCode; //Code not 0 (And it's received code)
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function DATABASE_CONN($ID_C,$URL){
|
||||
$ch = curl_init();
|
||||
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
|
||||
$body = curl_exec($ch); //All file
|
||||
curl_close($ch);
|
||||
$result = htmlentities($body);
|
||||
if($result == 'OK'){
|
||||
return 0;
|
||||
}else{ //Fail if it returns other than "OK".
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
function JSON_API($ID_C,$URL,$params,$exceptedRes){
|
||||
$type = explode('|',$params)[0];
|
||||
$JSONParams = explode('|',$params)[1];
|
||||
|
||||
$ch = curl_init();
|
||||
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_HEADER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 4); //timeout in seconds
|
||||
$body = curl_exec($ch); //All file
|
||||
curl_close($ch);
|
||||
|
||||
$json_ret = json_decode($body,true);
|
||||
$json_param = json_decode($exceptedRes,true);
|
||||
if ($json_ret == $json_param){
|
||||
return 0;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
$db_conn = getconn();
|
||||
$sites = dbw_query($db_conn,"SELECT * FROM CHECKS");
|
||||
while ($site = dbw_fetch_array($db_conn,$sites)){
|
||||
$try = 0;
|
||||
$extitC = 0;
|
||||
$ID_C= $site['ID_C'];
|
||||
do {
|
||||
$try++; //This is for avoiding posible "second" problems in some checks that are working but doesn't answer to first time
|
||||
set_time_limit (15); //This resets time limit of php, avoids 30 sec limit in some servers
|
||||
|
||||
switch ($site['ID_TC']) {
|
||||
case '1': //Ping to IP:Port
|
||||
$exitC = PING_IP($ID_C,$site['url']);
|
||||
break;
|
||||
|
||||
case '2': //HttpCode
|
||||
$exitC = HTTP_CODE($ID_C,$site['url'],$site['urlParam']);
|
||||
break;
|
||||
|
||||
case '4': //MySQL|Database connect
|
||||
$exitC = DATABASE_CONN($ID_C,$site['url']);
|
||||
break;
|
||||
|
||||
case '5': //JSON GET | POST
|
||||
$exitC = JSON_API($ID_C,$site['url'],$site['urlParam'],$site['exceptedRes']);
|
||||
break;
|
||||
}
|
||||
}while($try <= 2 && $exitC == 1);
|
||||
$timestamp = time();
|
||||
if ($exitC == 0){ //Check successful
|
||||
dbw_query($db_conn, "INSERT INTO `CHKHIST` (`ID_C`,`code`,`timestamp`) VALUES ('$ID_C','0','$timestamp')");
|
||||
}else if ($exitC == 1){ //Normal check failed
|
||||
dbw_query($db_conn, "INSERT INTO `CHKHIST` (`ID_C`,`code`,`timestamp`) VALUES ('$ID_C','1','$timestamp')");
|
||||
}else{ //Other code of check failed
|
||||
dbw_query($db_conn, "INSERT INTO `CHKHIST` (`ID_C`,`code`,`errorText`,`timestamp`) VALUES ('$ID_C','1','$exitC','$timestamp')");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Delete old Checks (Based on time to save, put in secs)
|
||||
$mintime = time()-(getSystemOpt("maxTimeSave")*24*3600);
|
||||
dbw_query($db_conn,"DELETE FROM CHKHIST WHERE `timestamp` < $mintime");
|
||||
|
||||
//Delete Checks stored for pages that not exist
|
||||
dbw_query($db_conn, "DELETE FROM CHKHIST WHERE ID_C NOT IN (SELECT ID_C FROM CHECKS)");
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
/** This PHP makes "download" files for database see. JKANetwork and DBWrapper involved...*/
|
||||
|
||||
$type = $_POST['dbcode_type']; //Database (SQLite3,MySQL...)
|
||||
$dbHost = $_POST['dbcode_host']; //Where it is.
|
||||
|
||||
switch($type){
|
||||
case 'sqlite3':
|
||||
$file = '<?php
|
||||
$conn = new SQLite3("'.$dbHost.'",SQLITE3_OPEN_READONLY) or die("FAIL");
|
||||
die("OK");
|
||||
?>';
|
||||
break;
|
||||
case 'mysqli':
|
||||
$dbUser = $_POST['dbcode_user'];
|
||||
$dbPass = $_POST['dbcode_pass'];
|
||||
$file = '<?php
|
||||
mysqli_connect("'.$dbHost.'","'.$dbUser.'","'.$dbPass.'",) or die("FAIL");
|
||||
die("OK");
|
||||
?>';
|
||||
break;
|
||||
case 'pgsql':
|
||||
$dbUser = $_POST['dbcode_user'];
|
||||
$dbPass = $_POST['dbcode_pass'];
|
||||
$dbDb = $_POST['dbcode_db'];
|
||||
$file = '<?php
|
||||
pg_connect("host='.$dbHost.' dbname='.$dbDb.' user='.$dbUser.' password='.$dbPass.'") or die ("FAIL");
|
||||
die("OK");
|
||||
?>';
|
||||
break;
|
||||
}
|
||||
|
||||
header ("Content-Disposition: attachment; filename=dbtest.php");
|
||||
header ("Content-Type: text/php");
|
||||
print $file;
|
||||
609
functions.php
Executable file → Normal file
609
functions.php
Executable file → Normal file
@@ -1,105 +1,327 @@
|
||||
<?php
|
||||
//Functions
|
||||
if (file_exists(__DIR__ .'/config/config.php')){
|
||||
require_once __DIR__ .'/config/config.php';
|
||||
}
|
||||
require_once __DIR__ .'/lib/dbwrapper.php';
|
||||
|
||||
function getUptime($ID_C,$precision = 0){
|
||||
$db_conn = getconn();
|
||||
if ($precision == 0){
|
||||
$time = time()-30*7*3600; //Last week
|
||||
}else{
|
||||
$time = $precision;
|
||||
session_start();
|
||||
|
||||
function dbconn(){
|
||||
//return dbw_connect('mysqli','localhost','proyecto','root','mysql');
|
||||
if (!defined('SGBD')){
|
||||
die('You can\'t establish a connection without a config file.');
|
||||
}
|
||||
$res = dbw_query($db_conn,"SELECT code FROM CHKHIST WHERE ID_C='$ID_C' AND `timestamp` > $time");
|
||||
$count = 0;
|
||||
$err = 0;
|
||||
while ($fila = dbw_fetch_array($db_conn,$res)){
|
||||
$count++;
|
||||
$err += $fila['code'];
|
||||
}
|
||||
if ($count == 0){
|
||||
return '-1'; //No registers
|
||||
if (SGBD == 'sqlite3'){
|
||||
return dbw_connect('sqlite3',__DIR__ .'/'.DBSERVER);
|
||||
}else if (SGBD == 'mysqli'){
|
||||
return dbw_connect('mysqli',DBSERVER,DBDATABASE,DBUSER,DBPASS);
|
||||
}
|
||||
}
|
||||
|
||||
function showUptime($str) {
|
||||
$num = floatval($str);
|
||||
$secs = $num % 60;
|
||||
$num = (int)($num / 60);
|
||||
$mins = $num % 60;
|
||||
$num = (int)($num / 60);
|
||||
$hours = $num % 24;
|
||||
$num = (int)($num / 24);
|
||||
$days = $num;
|
||||
|
||||
return $days . " días, " . sprintf('%02d', $hours) . ":" . sprintf('%02d', $mins) . ":" . sprintf('%02d', $secs);
|
||||
}
|
||||
|
||||
/** Transform bytes to an human readable text **/
|
||||
function bytesToHuman($int,$round = 2, $onlynumber = 0,$returnin = NULL){
|
||||
if (!is_numeric($int)){
|
||||
return NULL;
|
||||
}
|
||||
$ret = ($int / 1024/1024);
|
||||
if ($onlynumber){
|
||||
if ($returnin == 'GB'){
|
||||
return round($ret / 1024,$round); //Return in GB
|
||||
}else{
|
||||
return round($ret,$round); //Return in MB, ever, and without text, for charts
|
||||
}
|
||||
|
||||
}else{
|
||||
if ($ret > 1024*10){ //Long number
|
||||
return round(($ret / 1024),$round).'GB';
|
||||
}else{
|
||||
return round($ret,$round).'MB';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function percent($parc,$total){
|
||||
if ($total){
|
||||
return round(($parc/$total)*100,2);
|
||||
}else{
|
||||
if ($err != 0){
|
||||
$uptime = (100 - round(($err/$count)*100,2));
|
||||
return $uptime;
|
||||
return 'DIV BY ZERO';
|
||||
}
|
||||
}
|
||||
|
||||
/** Know at what groups belong a Server **/
|
||||
function arrayGroupsOfServ($ID_SERV) {
|
||||
$db_conn = dbconn();
|
||||
$list = dbw_query($db_conn,"SELECT * FROM S_INGROUP WHERE ID_SERV='$ID_SERV'");
|
||||
|
||||
$ret = NULL; //Empty var
|
||||
while ($line = dbw_fetch_array($db_conn,$list)){
|
||||
$ID_G = $line['ID_G'];
|
||||
$namegrp = dbw_query_fetch_array($db_conn,"SELECT `Name` FROM GROUPS WHERE ID_G='$ID_G'")[0];
|
||||
$ret[] = array('ID_G' => $ID_G,'Name' => $namegrp);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/** Return last hdd status as string **/
|
||||
function getFastHddStats($ID_SERV){
|
||||
$db_conn = dbconn();
|
||||
$sql = dbw_query($db_conn,"SELECT * FROM S_HDDSTAT WHERE ID_SERV='$ID_SERV' AND `Timestamp` = (SELECT MAX(`Timestamp`) FROM S_HDDSTAT WHERE ID_SERV='$ID_SERV')");
|
||||
$ret = NULL; //Empty var
|
||||
|
||||
while ($line = dbw_fetch_array($db_conn,$sql)){
|
||||
$line['Usedspace'] = $line['Space']-$line['Freespace'];
|
||||
$ret .= $line['HDD']. ' - ' . percent($line['Usedspace'],$line['Space']).'% ocupado ('.bytesToHuman($line['Usedspace']).'/'.bytesToHuman($line['Space']).')<br>';
|
||||
}
|
||||
return $ret; //HDD1 - % ocupado (NUsedGb/NTotalGb)<br>Other..
|
||||
}
|
||||
|
||||
|
||||
/** This function returns, from a ID_SERV and a time, an array of every HDD and free space **/
|
||||
function getHistoricHddStats($ID_SERV,$backto = (24*3600)){ //Backto one day by default
|
||||
$db_conn = dbconn();
|
||||
|
||||
$timeini = time() - $backto;
|
||||
$lines = dbw_query($db_conn,"SELECT * FROM S_HDDSTAT WHERE ID_SERV='$ID_SERV' AND `Timestamp` > '$timeini' ORDER BY `Timestamp` DESC");
|
||||
|
||||
$ret = array();
|
||||
|
||||
$between = (time() - $timeini) / 100; //Tiempo entre el actual y desde el que empieza, partido de 100, para que el máximo sean 100 tramos.
|
||||
|
||||
|
||||
while ($line = dbw_fetch_array($db_conn,$lines)){
|
||||
if (!isset($lasttimestamp[$line['HDD']]) || abs($lasttimestamp[$line['HDD']] - $line['Timestamp']) > $between ){ //Calcula que exista, y que el tiempo sea mayor que el tramo dicho
|
||||
$ret[$line['HDD']][] = array('Timestamp' => $line['Timestamp'],'HumanTimestamp' => timestampToHuman($line['Timestamp']), 'Space' => bytesToHuman($line['Space'],2,1,'GB') , 'Freespace' =>bytesToHuman($line['Freespace'],2,1,'GB'));
|
||||
$lasttimestamp[$line['HDD']] = $line['Timestamp'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ($ret as $key => $value){ //Order timestamps ASC
|
||||
$ret[$key] = array_reverse($ret[$key]);
|
||||
|
||||
}
|
||||
return $ret; //Array ret[HDD1][0](Timestamp,HumanTimestamp,Space,Freespace)-[1](Timestamp,HumanTimestamp,Space,Freespace)-....
|
||||
|
||||
}
|
||||
|
||||
/** Sents a command by SSH to server and returns result **/
|
||||
function commandbyssh($host,$port,$user,$pass,$cmd){
|
||||
if ((int)$port == 0){
|
||||
$port = 22;
|
||||
}
|
||||
require_once __DIR__ .'/lib/phpseclib-2.0/phpseclib/bootstrap.php';
|
||||
$ssh = new phpseclib\Net\SSH2($host,$port);
|
||||
if (!$ssh->login($user, $pass)) {
|
||||
if (DEBUG) {echo "ERROR AL CONECTAR|".$user;}
|
||||
return NULL;
|
||||
|
||||
}else{
|
||||
return $ssh->exec($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
//This function is an alias to Twig render, with "standard args" added
|
||||
function renderPage($page,$array = array()){
|
||||
require 'lib/loadTwig.php';
|
||||
global $namepage; //Todo edit this.
|
||||
if (isset($_SESSION['user'])){$allarray['user'] = $_SESSION['user'];}
|
||||
$allarray['namepage'] = $namepage;
|
||||
if (isset($_SESSION['MSG'])){$allarray['msg'] = $_SESSION['MSG'];$_SESSION['MSG'] = NULL;} //Var for showing messages
|
||||
if (isset($_SESSION['MSG_E'])){$allarray['msg_e'] = $_SESSION['MSG_E'];$_SESSION['MSG_E'] = NULL;} //Var for showing messages
|
||||
if (isset($_SESSION['MSG_I'])){$allarray['msg_i'] = $_SESSION['MSG_I'];$_SESSION['MSG_I'] = NULL;} //Var for showing messages
|
||||
$allarray['POST'] = $_POST; //For forms
|
||||
foreach ($array as $key => $value) {
|
||||
$allarray[$key] = $value;
|
||||
}
|
||||
|
||||
if (defined('SGBD')){
|
||||
$allarray['alerts'] = getAlerts();
|
||||
}
|
||||
|
||||
$allarray['sys']['intervalts'] = (30*60);
|
||||
echo $twig->render($page, $allarray);
|
||||
}
|
||||
|
||||
function ping($ip, $timeout = 2,$rTimes = 2) {
|
||||
|
||||
/* ICMP ping packet with a pre-calculated checksum */
|
||||
$retry = 0;
|
||||
while ($retry < $rTimes){ //Retry rTimes times if fail
|
||||
//Create ICMP socket and see if works
|
||||
$package = "\x08\x00\x7d\x4b\x00\x00\x00\x00PingHost";
|
||||
$socket = socket_create(AF_INET, SOCK_RAW, 1);
|
||||
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $timeout, 'usec' => 0));
|
||||
socket_connect($socket, $ip, null);
|
||||
|
||||
$ts = microtime(true);
|
||||
socket_send($socket, $package, strLen($package), 0);
|
||||
if (socket_read($socket, 255))
|
||||
$result = microtime(true) - $ts;
|
||||
else $result = -1; // Never returns, host off or didn't answer
|
||||
socket_close($socket);
|
||||
|
||||
if ($result != -1){
|
||||
return round($result,3);
|
||||
}else{
|
||||
return 100;
|
||||
$retry++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1; //If in rTimes doesn't connect, return error
|
||||
}
|
||||
|
||||
function getStatus($ID_C){
|
||||
$T_ = loadLang();
|
||||
$db_conn = getconn();
|
||||
$resql = dbw_query($db_conn,"SELECT code FROM CHKHIST WHERE ID_C='$ID_C' ORDER BY `timestamp` DESC LIMIT 5");
|
||||
$err = 0;
|
||||
while ($x = dbw_fetch_array($db_conn,$resql)){
|
||||
if ($x['code'] != 0){
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
switch ($err){
|
||||
case 0:
|
||||
case 1:
|
||||
return array($T_['status_right'],'green');
|
||||
break;
|
||||
case 2:
|
||||
return array($T_['status_lproblems'],'blue');
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
return array($T_['status_problems'],'orange');
|
||||
break;
|
||||
default: // > 4
|
||||
return array($T_['status_outofserv'],'red');
|
||||
break;
|
||||
}
|
||||
function encodePassword($str,$IV){
|
||||
//$IV = randomString(16); //For secure encoding
|
||||
return base64_encode(openssl_encrypt($str, 'aes-256-ctr', ENCPASSWD, false, $IV));
|
||||
}
|
||||
|
||||
function decodePassword($str,$IV){
|
||||
//$IV = randomString(16); //For secure encoding
|
||||
return openssl_decrypt(base64_decode($str), 'aes-256-ctr', ENCPASSWD, false, $IV);
|
||||
}
|
||||
|
||||
/** This function returns all data from server in array, do not overuse this function **/
|
||||
function serverData($ID_SERV){
|
||||
$db_conn = dbconn();
|
||||
|
||||
//For HDD Stats
|
||||
if (isset($_GET['backto']) && (int)$_GET['backto']) {
|
||||
$backto = (int)$_GET['backto'] * 24*3600;
|
||||
}else if (isset($_POST['backto']) && (int)$_POST['backto']) {
|
||||
$backto = (int)$_POST['backto'] * 24*3600;
|
||||
}else{
|
||||
$backto = 24*3600; //Un día
|
||||
}
|
||||
|
||||
$serv = dbw_query_fetch_array($db_conn,"SELECT * FROM SERVERS WHERE ID_SERV='$ID_SERV'");
|
||||
|
||||
if (!$serv){ //No server with this ID? Return null
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$servEnabled = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_SERVICES WHERE ID_SERV='$serv[ID_SERV]' AND `Enabled`=1")[0];
|
||||
$servDisabled = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_SERVICES WHERE ID_SERV='$serv[ID_SERV]' AND `Enabled`=0")[0];
|
||||
|
||||
if ($servEnabled){
|
||||
$servActive = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM S_SERVICES WHERE `Status`=1 AND ID_SERV='$serv[ID_SERV]' AND `Enabled`=1")[0];
|
||||
$servInactive = $servEnabled - $servActive;
|
||||
}else{
|
||||
$servActive = 0;
|
||||
$servEnabled = 0;
|
||||
}
|
||||
|
||||
$sql = dbw_query($db_conn,"SELECT * FROM S_INGROUP WHERE ID_SERV='$ID_SERV'");
|
||||
$listidg = array();
|
||||
while ($line = dbw_fetch_array($db_conn,$sql)){
|
||||
$listidg[$line['ID_G']] = array(
|
||||
'ID_G' => $line['ID_G'],
|
||||
'Name' => nameFromID_G($line['ID_G'])
|
||||
);
|
||||
}
|
||||
$ping = dbw_query_fetch_array($db_conn,"SELECT `Value` FROM S_HISTPING WHERE ID_SERV='$serv[ID_SERV]' ORDER BY `Timestamp` DESC LIMIT 1")[0];
|
||||
|
||||
list($serv['Freeram'],$serv['Detram']) = dbw_query_fetch_array($db_conn,"SELECT `Freeram`,`Detram` FROM S_HISTRAM WHERE ID_SERV='$ID_SERV' ORDER BY `Timestamp` DESC LIMIT 1");
|
||||
return array(
|
||||
'ID_SERV' => $serv['ID_SERV'],
|
||||
'Name' => trim($serv['Name']),
|
||||
'Description' => trim($serv['Description']),
|
||||
'IP' => trim($serv['IP']),
|
||||
'SO' => trim($serv['SO']),
|
||||
'Version' => $serv['Version'],
|
||||
'InGroups' => $listidg,
|
||||
'Online' => $serv['Online'],
|
||||
'Enabled' => $serv['Enabled'],
|
||||
'Ping' => $ping,
|
||||
'BadCreds' => $serv['BadCreds'],
|
||||
'Uptime' => showUptime($serv['Uptime']),
|
||||
'Freeram' => bytesToHuman($serv['Freeram']),
|
||||
'Detram' => bytesToHuman($serv['Detram']),
|
||||
'Usedram' => bytesToHuman($serv['Detram']-$serv['Freeram']),
|
||||
'HDDFastStats' => getFastHddStats($serv['ID_SERV']),
|
||||
'HDDData' => getHistoricHddStats($serv['ID_SERV'],$backto),
|
||||
'STotal' => ($servEnabled + $servDisabled),
|
||||
'SEnabled' => $servEnabled,
|
||||
'SDisabled' => $servDisabled,
|
||||
'SActive' => $servActive,
|
||||
'SInactive' => ($servEnabled - $servActive),
|
||||
'LastCheck' => $serv['LastCheck'],
|
||||
'AlertHDD' => hasalert($ID_SERV,'HDD')
|
||||
);
|
||||
}
|
||||
|
||||
function getPerm($perm){
|
||||
if ($_SESSION['user'][$perm] ||$_SESSION['user']['PE_admin']){ //Admin has all rights
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function showdeb($str){
|
||||
if (DEBUG){
|
||||
//echo "<p>Debug: ".$str."</p>";
|
||||
sendmsg('info','Debug: '.var_dump($str));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** Ping a WebSite */
|
||||
function ping($host,$port = '80') {
|
||||
$fP = fSockOpen($host, $port, $errno, $errstr, 3); //Host,port,Err,ErrString,Timeout(Sec)
|
||||
//echo "Error:$errno";
|
||||
return $fP ? "0" : "1";
|
||||
function cleanData($str,$raw = 0){
|
||||
if (!is_array($str)){
|
||||
return htmlentities(trim($str),ENT_QUOTES);
|
||||
}else{
|
||||
return $str; //Arrays not clean yet
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Returns web root (ie. http://jkanetwork.com) */
|
||||
function webRoot(){
|
||||
$root = isset($_SERVER['HTTPS']) ? "https://" : "http://"; //Variable = condicion ? Verdadero : Falso
|
||||
return $root . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
|
||||
|
||||
function nameFromID_G($ID_G){
|
||||
$ID_G = (int)$ID_G;
|
||||
return dbw_query_fetch_array(dbconn(),"SELECT `Name` FROM GROUPS WHERE ID_G='$ID_G'")[0];
|
||||
}
|
||||
|
||||
/** Returns a system option */
|
||||
function getSystemOpt($sysopt){
|
||||
return dbw_query_fetch_array(getconn(),"SELECT * FROM SYS WHERE option = '$sysopt'")['value'];
|
||||
//Send msg to twig template to see it. Its an array
|
||||
function sendmsg($type,$str){
|
||||
switch ($type){
|
||||
case 'ok':
|
||||
$_SESSION['MSG'][] = $str;
|
||||
break;
|
||||
case 'error':
|
||||
$_SESSION['MSG_E'][] = $str;
|
||||
break;
|
||||
case 'info':
|
||||
$_SESSION['MSG_I'][] = $str;
|
||||
break;
|
||||
case 'debug':
|
||||
$_SESSION['MSG_I'][] = 'Debug: '.$str;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Return HttpCode of page. Returns false if page is not found (Used in cron) */
|
||||
function httpCode($url, $wait = 5)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_NOBODY, TRUE); // remove body
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $wait); //timeout in seconds
|
||||
$head = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
return $head ? $httpCode : FALSE;
|
||||
}
|
||||
|
||||
/** Return a String of $lenght chars */
|
||||
function RandomString($length)
|
||||
{
|
||||
//https://phpes.wordpress.com/2007/06/12/generador-de-una-cadena-aleatoria/
|
||||
$source = 'abcdefghijklmnopqrstuvwxyz';
|
||||
$source .= '1234567890';
|
||||
//https://phpes.wordpress.com/2007/06/12/generador-de-una-cadena-aleatoria/
|
||||
$source = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
|
||||
if($length>0){
|
||||
$rstr = "";
|
||||
$source = str_split($source,1);
|
||||
for($i=1; $i<=$length; $i++){
|
||||
mt_srand((double)microtime() * 1000000);
|
||||
$num = mt_rand(1,count($source));
|
||||
$rstr .= $source[$num-1];
|
||||
}
|
||||
@@ -108,73 +330,194 @@ function RandomString($length)
|
||||
return $rstr;
|
||||
}
|
||||
|
||||
/** 1 if its logued, 0 if not */
|
||||
function isLogued(){
|
||||
if (isset($_SESSION['UserID'])){
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
function removeEmptyLines($arr){
|
||||
for ($x = 0;$x < count($arr);$x++){
|
||||
if (strlen($arr[$x]) == 0 ||!$arr[$x]){
|
||||
array_splice($arr,$x,1);
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
function requireLogin(){
|
||||
if (isLogued() == 0){
|
||||
die('You dont have admin rights'); //This blocks edit or create nothing if its not logued
|
||||
|
||||
function enviarcorreo($ID_SERV,$type,$msg){
|
||||
$db_conn = dbconn();
|
||||
dbw_query($db_conn,"INSERT INTO MAIL (ID_SERV,`Type`,Msg) VALUES ('$ID_SERV','$type','$msg')");
|
||||
$lastid = dbw_last_id($db_conn);
|
||||
$mails = listaMails();
|
||||
if ($mails != NULL){
|
||||
foreach($mails as $mail){
|
||||
mail ($mail,'Incidencias',$type.' \n'.$msg);
|
||||
}
|
||||
//Add to sent
|
||||
dbw_query($db_conn,"UPDATE MAIL SET `Sent`=1 WHERE ID_M='$lastid'");
|
||||
}
|
||||
//dbw_query($db_conn,"DELETE FROM MAIL WHERE `Sent`=1"); //Delete sent messages
|
||||
|
||||
}
|
||||
|
||||
function nameFromIDC($ID_C){
|
||||
return dbw_query_fetch_array(getconn(),"SELECT name FROM CHECKS WHERE ID_C='$ID_C'")[0];
|
||||
function listaMails(){
|
||||
$db_conn = dbconn();
|
||||
$query = dbw_query($db_conn,"SELECT Email FROM USERS WHERE SendMail = '1'");
|
||||
while ($line = dbw_fetch_array($db_conn,$query)){
|
||||
$mail[] = $line['Email'];
|
||||
}
|
||||
if (!isset($mail)){
|
||||
return NULL;
|
||||
}else{
|
||||
return $mail;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function nameGroupFromIDG($ID_G){
|
||||
return dbw_query_fetch_array(getconn(),"SELECT ID_G,name FROM GROUPS WHERE ID_G='$ID_G'")['name'];
|
||||
|
||||
function gestionAlerta($server,$type,$nameParam,$status){
|
||||
$db_conn = dbconn();
|
||||
$ID_SERV = (int)$server['ID_SERV'];
|
||||
switch ($type) {
|
||||
case 'PING':
|
||||
$hasalert = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type` = 'PING'")[0];
|
||||
if ($hasalert == 0 && $status == 0){ //Apagado
|
||||
enviarcorreo($ID_SERV,$type,'El servidor '.$server['Name'].' está apagado / no responde a Ping');
|
||||
newAlert($ID_SERV,$type,'','El servidor '.$server['Name'].' está apagado / no responde a Ping');
|
||||
|
||||
}else if ($hasalert && $status == 1){ //Todo bien
|
||||
enviarcorreo($ID_SERV,$type,'El servidor '.$server['Name'].' vuelve a estar disponible / responde al Ping');
|
||||
deleteAlert($ID_SERV,$type);
|
||||
}
|
||||
break;
|
||||
case 'SERVICE':
|
||||
$service = $nameParam;
|
||||
$hasalert = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type`='SERVICE' AND `Param`='$service'")[0];
|
||||
if ($hasalert == 0 && $status == 0){ //Se ha caido
|
||||
enviarcorreo($ID_SERV,$type.'.'.$service,'El servicio '.$service.' del servidor '.$server['Name'] .' ('.$server['IP'].') no responde');
|
||||
newAlert($ID_SERV,$type,$service,'El servicio '.$service.' del servidor '.$server['Name'] .' ('.$server['IP'].') no responde');
|
||||
}else if ($hasalert && $status == 1){ //Volvió
|
||||
enviarcorreo($ID_SERV,$type.'.'.$service,'El servicio '.$service.' del servidor '.$server['Name'] .' ('.$server['IP'].') ya responde');
|
||||
deleteAlert($ID_SERV,$type,$service);
|
||||
}
|
||||
break;
|
||||
case 'HDD':
|
||||
$disk = $nameParam;
|
||||
$hasalert = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type` = 'HDD' AND `Param`='$disk'")[0];
|
||||
if ($hasalert == 0 && $status == 0){ //Espacio bajo
|
||||
enviarcorreo($ID_SERV,$type.'.'.$disk,'El disco duro '.$disk.' del servidor '.$server['Name'] .' tiene poco espacio disponible');
|
||||
newAlert($ID_SERV,$type,$disk,'El disco duro '.$disk.' del servidor '.$server['Name'] .' tiene poco espacio disponible');
|
||||
}else if ($hasalert && $status == 1){ //Todo bien
|
||||
enviarcorreo($ID_SERV,$type.'.'.$disk,'El disco duro '.$disk.' del servidor '.$server['Name'] .' ya tiene más espacio disponible');
|
||||
deleteAlert($ID_SERV,$type,$disk);
|
||||
}
|
||||
break;
|
||||
case 'RAM':
|
||||
$percent = $nameParam;
|
||||
$hasalert = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type` = 'RAM'")[0];
|
||||
if ($hasalert == 0 && $status == 0){ //RAM bajo
|
||||
enviarcorreo($ID_SERV,$type,'El servidor '.$server['Name'] .' tiene poca RAM disponible ('.$percent.')');
|
||||
newAlert($ID_SERV,$type,$disk,'El servidor '.$server['Name'] .' tiene poca RAM disponible ('.$percent.')');
|
||||
}else if ($hasalert && $status == 1){ //Todo bien
|
||||
enviarcorreo($ID_SERV,$type,'El servidor '.$server['Name'] .' ya tiene más RAM disponible');
|
||||
deleteAlert($ID_SERV,$type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function IDGFromIDC($ID_C){
|
||||
return dbw_query_fetch_array(getconn(),"SELECT ID_G FROM CHECKS WHERE ID_C='$ID_C'")['ID_G'];
|
||||
function newAlert($ID_SERV,$type,$param,$msg){
|
||||
$time = time();
|
||||
dbw_query(dbconn(),"INSERT INTO P_ALERTS (ID_SERV,`Type`,`Param`,`Timestamp`,`Msg`) VALUES ('$ID_SERV','$type','$param','$time','$msg')");
|
||||
}
|
||||
function deleteAlert($ID_SERV,$type,$param = NULL){
|
||||
if ($param == NULL){
|
||||
dbw_query(dbconn(),"DELETE FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type`='$type'");
|
||||
}else{
|
||||
dbw_query(dbconn(),"DELETE FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type`='$type' AND `Param`='$param'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* This funtion returns the array with type of checks */
|
||||
function arrayTypeChk(){
|
||||
return array(
|
||||
1 => 'PING_IP',
|
||||
2 => 'HTTP_CODE',
|
||||
3 => 'VISIT_COUNT',
|
||||
4 => 'DATABASE',
|
||||
5 => 'JSON_API');
|
||||
}
|
||||
/* This funtion returns the translated text of a type check */
|
||||
function textTypeChk($typeChk){
|
||||
$T_ = loadLang();
|
||||
$arr = array(
|
||||
1 => $T_['PING_IP'],
|
||||
2 => $T_['HTTP_CODE'],
|
||||
3 => $T_['VISIT_COUNT'],
|
||||
4 => $T_['DATABASE'],
|
||||
5 => $T_['JSON_API']
|
||||
);
|
||||
return $arr[$typeChk];
|
||||
|
||||
function getAlerts(){
|
||||
$db_conn = dbconn();
|
||||
$query = dbw_query($db_conn,"SELECT * FROM P_ALERTS ORDER BY `Timestamp` DESC");
|
||||
while ($line = dbw_fetch_array($db_conn,$query)){
|
||||
//$type = strtolower(explode('.',$line['Type'])[0]);
|
||||
$servName = dbw_query_fetch_array($db_conn,"SELECT `Name` FROM SERVERS WHERE ID_SERV='$line[ID_SERV]'")[0];
|
||||
$alert[] = array(
|
||||
'ID_SERV' => $line['ID_SERV'],
|
||||
'Type' => $line['Type'],
|
||||
'Param' => $line['Param'],
|
||||
'Timestamp' => timestampToHuman($line['Timestamp']),
|
||||
'Text' => $line['Msg'],
|
||||
'ServName' => $servName
|
||||
);
|
||||
}
|
||||
if (!isset($alert)) return NULL;
|
||||
return $alert;
|
||||
}
|
||||
|
||||
//This function is an alias to Twig render, with "standard args" added
|
||||
function renderPage($page,$array = array()){
|
||||
$T_ = loadLang(); //Load transactions
|
||||
//Default params to send
|
||||
$allarray = array(
|
||||
'version' => VERSION,
|
||||
'T_' => $T_,
|
||||
);
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
$allarray[$key] = $value;
|
||||
}
|
||||
require 'lib/loadTwig.php';
|
||||
echo $twig->render($page, $allarray);
|
||||
function timestampToHuman($timestamp){
|
||||
return date('d-m-y H:i',$timestamp);
|
||||
}
|
||||
|
||||
function loadLang(){
|
||||
//Translations
|
||||
require __DIR__."/assets/translations/en.php"; //Ever first English, and then your lang (Database)
|
||||
require __DIR__."/assets/translations/".LANG.".php";
|
||||
return $T_;
|
||||
function percalertfor($str){
|
||||
$value = dbw_query_fetch_array(dbconn(),"SELECT `Value` FROM SYS WHERE `Option`='${str}ALERT'")[0];
|
||||
if (!$value){
|
||||
return NULL;
|
||||
}else{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
//Return 1 is alert is going, 0 if not alerts of this type
|
||||
function hasalert($ID_SERV,$type){
|
||||
if (dbw_query_fetch_array(dbconn(),"SELECT COUNT(*) FROM P_ALERTS WHERE ID_SERV='$ID_SERV' AND `Type`='$type'")[0]){
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function getsysopt($opt){
|
||||
$value = dbw_query_fetch_array(dbconn(),"SELECT `Value` FROM SYS WHERE `Option`='${opt}'")[0];
|
||||
if (!$value){
|
||||
return NULL;
|
||||
}else{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggle_server_svc($ID_SERV,$servicename){
|
||||
|
||||
$server = serverData($ID_SERV); //Load server data
|
||||
|
||||
list($name,$status) = dbw_query_fetch_array($db_conn,"SELECT `Name`,`Status` FROM S_SERVICES WHERE ID_SERV='$ID_SERV' AND `Name`='$servicename'");
|
||||
|
||||
if ($status == 0){ //Estaba parado, arrancar
|
||||
switch ($server['SO']){
|
||||
case 'LINUX_SYSTEMD':
|
||||
commandbyssh($server['IP'],$server['SSHPort'],$server['User'],$server['Password'],'systemctl restart '.$servicename.'>/dev/null');
|
||||
|
||||
break;
|
||||
case 'LINUX_SERVICE':
|
||||
commandbyssh($server['IP'],$server['SSHPort'],$server['User'],$server['Password'],'service '.$servicename.' start;');
|
||||
|
||||
break;
|
||||
}
|
||||
}else{ //Esta arrancado, parar
|
||||
switch ($so){
|
||||
case 'LINUX_SYSTEMD':
|
||||
commandbyssh($server['IP'],$server['SSHPort'],$server['User'],$server['Password'],'systemctl stop '.$servicename.'>/dev/null');
|
||||
|
||||
break;
|
||||
case 'LINUX_SERVICE':
|
||||
commandbyssh($server['IP'],$server['SSHPort'],$server['User'],$server['Password'],'service '.$servicename.' stop;');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
BIN
images/csscheckbox.png
Normal file
BIN
images/csscheckbox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 516 B |
BIN
images/favicon.ico
Normal file
BIN
images/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
101
index.php
Executable file → Normal file
101
index.php
Executable file → Normal file
@@ -1,88 +1,43 @@
|
||||
<?php
|
||||
require_once "load.php";
|
||||
|
||||
$results = dbw_query($db_conn,"SELECT * FROM GROUPS"); //All groups
|
||||
|
||||
while ($group = dbw_fetch_array($db_conn,$results)){ //Know name of all groups
|
||||
$groups[$group['ID_G']] = $group['name'];
|
||||
if (isset($_GET['logout'])){session_start(); session_destroy();} //Logout
|
||||
if (!file_exists(dirname(__FILE__).'/config/config.php')){
|
||||
die('Not configured yet');
|
||||
}
|
||||
unset($results); //Free mem
|
||||
require_once 'functions.php';
|
||||
|
||||
$results = dbw_query($db_conn,"SELECT * FROM CHECKS ORDER BY ID_G"); //All checks
|
||||
|
||||
while ($onechk = dbw_fetch_array($db_conn,$results)){
|
||||
$idchk = $onechk['ID_C'];
|
||||
$chks[$idchk] = $onechk; //First array data
|
||||
$chks[$idchk]['nameGroup'] = $groups[$onechk['ID_G']]; //Know group of this check
|
||||
$ID_TC = $chks[$idchk]['ID_TC']; //Type of Check
|
||||
|
||||
switch ($ID_TC){
|
||||
// Case 3 (Visits) is numeric, not status
|
||||
case 1: //Ping
|
||||
case 2: //HttpCode
|
||||
case 4: //MySQL
|
||||
case 5: //JSON GET|POST
|
||||
|
||||
//To enter or not, check if has history (Instead of count > 0, only see if there is any timestamp, is faster)
|
||||
if (dbw_query_fetch_array($db_conn, "SELECT `timestamp` FROM CHKHIST WHERE ID_C = '$idchk' LIMIT 1")[0] != 0){
|
||||
$db_conn = dbconn();
|
||||
|
||||
$consul = dbw_query_fetch_array($db_conn, "SELECT `code`,`timestamp` FROM CHKHIST WHERE ID_C = '$idchk' ORDER BY `timestamp` DESC LIMIT 1");
|
||||
$chks[$idchk]['dateLastChk'] = date('d/m H:i',$consul['timestamp']);
|
||||
//Calculemos estadísticas
|
||||
$servs = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM SERVERS")[0];
|
||||
|
||||
$chks[$idchk]['failedLastChk'] = $consul['code'];
|
||||
//Sacar datos de cada servidor
|
||||
$serverssql = dbw_query($db_conn,"SELECT ID_SERV FROM SERVERS"); //Todos los ID_SERV
|
||||
$numrows['all'] = dbw_num_rows($db_conn,$serverssql);
|
||||
$numrows['on'] = 0;
|
||||
$numrows['enabled'] = dbw_query_fetch_array($db_conn,"SELECT COUNT(*) FROM SERVERS WHERE `Enabled`=1")[0];
|
||||
|
||||
$lastErr = dbw_query_fetch_array($db_conn, "SELECT MAX(`timestamp`) FROM CHKHIST WHERE ID_C = '$idchk' AND code != 0")[0]; //Record last error, for showing if there are any.
|
||||
if ($lastErr != false){
|
||||
$chks[$idchk]['dateLastErr'] = date('d/m H:i',$lastErr);
|
||||
}
|
||||
$SEnabled = 0;
|
||||
$STotal = 0;
|
||||
$SActive = 0;
|
||||
|
||||
$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
|
||||
}else{
|
||||
$chks[$idchk]['uptime'] = getUptime($idchk);
|
||||
}
|
||||
list($chks[$idchk]['statusText'],$chks[$idchk]['statusColor']) = getStatus($idchk);
|
||||
}else{ //If nothing collected yet
|
||||
$chks[$idchk]['uptime'] = -1; // -1 is nothing in twig page
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3: //Visits
|
||||
$visitsSite = dbw_query($db_conn, "SELECT * FROM (SELECT * FROM VISITS WHERE ID_C = '$idchk' ORDER BY `date` DESC LIMIT 0,5) sub ORDER BY `date` ASC"); //Subquery for reorder lastest days in reverse
|
||||
//Create array from last 5 days
|
||||
while ($visitsDay = dbw_fetch_array($db_conn, $visitsSite)){
|
||||
$dateArray[] = $visitsDay['date'];
|
||||
$visitsArray[] = $visitsDay['visits'];
|
||||
$uniqueVisitsArray[] = $visitsDay['uniqueVisits'];
|
||||
}
|
||||
$chks[$idchk]['dateArray'] = implode(',',$dateArray);
|
||||
$chks[$idchk]['visitsArray'] = implode(',',$visitsArray);
|
||||
break;
|
||||
}
|
||||
while ($id = dbw_fetch_array($db_conn,$serverssql)){
|
||||
$server = serverData($id['ID_SERV']);
|
||||
if ($server['Online']){$numrows['on']++;}
|
||||
$servers[$id['ID_SERV']] = $server; //Insert data array
|
||||
|
||||
$STotal += $server['STotal'];
|
||||
$SEnabled += $server['SEnabled'];
|
||||
$SActive += $server['SActive'];
|
||||
}
|
||||
$numrows['off'] = $numrows['all'] - $numrows['on'];
|
||||
|
||||
//Here load "News"
|
||||
$numrows['allsensors'] = $STotal + $numrows['all'];
|
||||
$numrows['activesensors'] = $SActive + $numrows['on'];
|
||||
|
||||
$incidents = dbw_query($db_conn,"SELECT * FROM NEWS ORDER BY ID_N DESC LIMIT 20");
|
||||
while ($incident = dbw_fetch_array($db_conn,$incidents)){
|
||||
$ID_N = $incident['ID_N'];
|
||||
$incs[$ID_N]['day'] = date('j/n/Y', $incident['timestamp']);
|
||||
require_once "lib/parsedown.php"; //Import parsedown (once)
|
||||
|
||||
$incs[$ID_N]['sentBy'] = $incident['sentBy'];
|
||||
if ($incident['sentBy'] != NULL && substr($incident['sentBy'],0,1) == "S"){ // Sent by a page
|
||||
$pageinc = substr($incident['sentBy'],1);
|
||||
$pageinc = dbw_query_fetch_array($db_conn,"SELECT name FROM CHECKS WHERE ID_C = '$pageinc'")[0];
|
||||
$incs[$ID_N]['sentBy'] = $pageinc;
|
||||
}
|
||||
$incs[$ID_N]['text'] = Parsedown::instance()
|
||||
->setMarkupEscaped(true) # escapes markup (HTML)
|
||||
->text($incident['text']);
|
||||
$incs[$ID_N]['ID_N'] = $incident['ID_N'];
|
||||
if (!isset($servers)){
|
||||
$servers = NULL;
|
||||
}
|
||||
renderPage('indexpage.twig',array('checks' => $chks, 'news' => $incs)); //Render
|
||||
?>
|
||||
renderPage('index.twig',array('servers' => $servers,'numrows' => $numrows));
|
||||
|
||||
133
install.php
Executable file → Normal file
133
install.php
Executable file → Normal file
@@ -1,92 +1,51 @@
|
||||
<?php
|
||||
define('VERSION','0.9.4');
|
||||
//define('INSTALLER_MODE','1');
|
||||
require_once 'lib/loadTwig.php';
|
||||
|
||||
$db_file = __DIR__."/sqlite.db3";
|
||||
if (is_file($db_file)){ //Go to install if not.
|
||||
header('Location: index.php'); //Ya está instalado. Borra la base de datos si quieres forzar una reinstalación
|
||||
session_start(); session_destroy(); //No session in install
|
||||
require_once 'functions.php';
|
||||
if (file_exists(dirname(__FILE__).'/config/config.php')){
|
||||
die("Ya está instalado. Borre el fichero /config/config.php si quiere reiniciar la instalación");
|
||||
}
|
||||
|
||||
if (!isset($_POST['websiteName']) && !isset($_POST['username']) && !isset($_POST['passw1']) && !isset($_POST['passw2'])){
|
||||
echo $twig->render('install.twig');
|
||||
//Comprobaciones
|
||||
if (!function_exists('socket_create') ){
|
||||
sendmsg('error','Debes activar el soporte para socket en el php.ini');
|
||||
}
|
||||
if (!is_writable(__DIR__ .'/config/') ){
|
||||
sendmsg('error','Debes dar permisos de escritura al directorio config');
|
||||
}
|
||||
|
||||
if (isset($_POST['adminname'])){
|
||||
|
||||
list($adminname,$adminmail,$adminname,$adminpass,$dbhost,$dbdata,$dbuser,$dbpass) = array(
|
||||
cleanData($_POST['adminname']),cleanData($_POST['adminmail']),cleanData($_POST['adminname']),cleanData($_POST['adminpass']),
|
||||
cleanData($_POST['dbhost']),cleanData($_POST['dbdata']),cleanData($_POST['dbuser']),cleanData($_POST['dbpass'])
|
||||
);
|
||||
|
||||
$db_conn = dbw_connect('mysqli',$dbhost,$dbdata,$dbuser,$dbpass);
|
||||
if (!$db_conn){
|
||||
sendmsg('error','No se puede conetar a la base de datos');
|
||||
renderPage('install.twig');
|
||||
die();
|
||||
}
|
||||
|
||||
dbw_multi_query($db_conn,file_get_contents(dirname(__FILE__).'/assets/sqlinstalldata.sql'),1); //1 is erase buffer then. (For insert)
|
||||
//Crear usuario admin
|
||||
dbw_query($db_conn,"INSERT INTO USERS (`Name`,`Password`,`Email`,`PE_admin`) VALUES('$adminname','x','$adminmail',1)");
|
||||
$id_u = dbw_last_id($db_conn);
|
||||
$password = hash("sha256",$id_u.$adminpass); //Password with salt (id_u)
|
||||
dbw_query($db_conn,"UPDATE USERS SET `Password`='$password' WHERE ID_U='$id_u'");
|
||||
//Create config file
|
||||
$configfile = "<?php
|
||||
define('ENCPASSWD','".RandomString(12)."');
|
||||
define('SGBD','mysqli');
|
||||
define('DBSERVER','".$dbhost."');
|
||||
define('DBUSER','".$dbuser."');
|
||||
define('DBPASS','".$dbpass."');
|
||||
define('DBDATABASE','".$dbdata."');
|
||||
define('DEBUG',false); ?>";
|
||||
file_put_contents(dirname(__FILE__).'/config/config.php', $configfile);
|
||||
|
||||
header("location: index.php");
|
||||
die("<p>Instalado. Dirigiéndote al <a href='index.php'>login</a>, gracias por usar CheckServer</p>");
|
||||
}else{
|
||||
if ($_POST['passw1'] !== $_POST['passw2']){
|
||||
die("Passwords didn't match");
|
||||
}else{
|
||||
//Creamos toda la base de datos
|
||||
require_once "lib/dbwrapper.php"; //For using database
|
||||
$db_conn = dbw_connect("sqlite",$db_file); //Create database
|
||||
$sqlcreate='
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE "VISITS" (
|
||||
`ID_C` INTEGER,
|
||||
`date` INTEGER,
|
||||
`visits` INTEGER DEFAULT 0,
|
||||
`uniqueVisits` INTEGER DEFAULT 0,
|
||||
FOREIGN KEY(`ID_C`) REFERENCES `Sites`(`ID_Site`)
|
||||
);
|
||||
CREATE TABLE "USERS" (
|
||||
`ID_U` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`nick` TEXT NOT NULL UNIQUE,
|
||||
`passw` TEXT,
|
||||
`fullRights` INTEGER NOT NULL
|
||||
);
|
||||
CREATE TABLE "TOKENS" (
|
||||
`ID_T` TEXT UNIQUE,
|
||||
`name` TEXT,
|
||||
PRIMARY KEY(`ID_T`)
|
||||
);
|
||||
CREATE TABLE "SYS" (
|
||||
`option` TEXT UNIQUE,
|
||||
`value` TEXT
|
||||
);
|
||||
CREATE TABLE "NEWS" (
|
||||
`ID_N` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`text` TEXT NOT NULL,
|
||||
`timestamp` INTEGER NOT NULL,
|
||||
`sentBy` TEXT
|
||||
);
|
||||
CREATE TABLE "GROUPS" (
|
||||
`ID_G` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`name` TEXT NOT NULL
|
||||
);
|
||||
CREATE TABLE "CHKHIST" (
|
||||
`ID_CHist` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`ID_C` INTEGER,
|
||||
`code` INTEGER,
|
||||
`errorText` TEXT,
|
||||
`timestamp` INTEGER,
|
||||
FOREIGN KEY(`ID_C`) REFERENCES `Sites`(`ID_Site`)
|
||||
);
|
||||
CREATE TABLE "CHECKS" (
|
||||
`ID_C` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
`ID_G` INTEGER,
|
||||
`name` TEXT NOT NULL,
|
||||
`url` TEXT,
|
||||
`manStatus` INTEGER,
|
||||
`ID_TC` INTEGER,
|
||||
`urlParam` TEXT,
|
||||
`exceptedRes` TEXT,
|
||||
FOREIGN KEY(`ID_G`) REFERENCES `GROUPS`(`ID_G`),
|
||||
FOREIGN KEY(`ID_TC`) REFERENCES `TYPECHK`(`ID_TC`)
|
||||
);
|
||||
COMMIT;';
|
||||
dbw_multi_query($db_conn,$sqlcreate); //Create scheme
|
||||
$user = $_POST['username'];
|
||||
$pass = hash("sha256",$_POST['passw1']);
|
||||
dbw_query($db_conn,"INSERT INTO USERS (nick,passw,fullRights) VALUES('$user','$pass',1)"); //Create user
|
||||
|
||||
//System opts
|
||||
dbw_query($db_conn,"INSERT INTO SYS VALUES ('maxTimeSave',14)");
|
||||
dbw_query($db_conn,"INSERT INTO SYS VALUES ('lang','$_POST[lang]')");
|
||||
dbw_query($db_conn,"INSERT INTO SYS VALUES ('websiteTitle','Status')");
|
||||
dbw_query($db_conn,"INSERT INTO SYS VALUES ('version','".VERSION."')");
|
||||
dbw_query($db_conn,"INSERT INTO SYS VALUES ('maintenance','0')");
|
||||
|
||||
echo $twig->render('install.twig', array('part' => 2));
|
||||
}
|
||||
renderPage('install.twig');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
9
lib/OSS_SNMP-master/.gitignore
vendored
Normal file
9
lib/OSS_SNMP-master/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
.buildpath
|
||||
.idea/
|
||||
.project
|
||||
.settings/
|
||||
*~
|
||||
*.DS_Store
|
||||
doc/phpdoc-cache-*
|
||||
*~
|
||||
vendor/
|
||||
31
lib/OSS_SNMP-master/LICENSE
Normal file
31
lib/OSS_SNMP-master/LICENSE
Normal file
@@ -0,0 +1,31 @@
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
36
lib/OSS_SNMP-master/etc/phpdoc.tpl.xml
Normal file
36
lib/OSS_SNMP-master/etc/phpdoc.tpl.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<phpdocumentor>
|
||||
<parser>
|
||||
<default-package-name>OSS_SNMP</default-package-name>
|
||||
<markers>
|
||||
<item>TODO</item>
|
||||
<item>FIXME</item>
|
||||
</markers>
|
||||
<extensions>
|
||||
<extension>php</extension>
|
||||
<extension>php3</extension>
|
||||
<extension>phtml</extension>
|
||||
</extensions>
|
||||
<visibility></visibility>
|
||||
</parser>
|
||||
<files>
|
||||
<ignore-hidden>on</ignore-hidden>
|
||||
<ignore-symlinks>on</ignore-symlinks>
|
||||
<directory>OSS_SNMP</directory>
|
||||
</files>
|
||||
<transformer>
|
||||
<target>output</target>
|
||||
</transformer>
|
||||
<logging>
|
||||
<level>warn</level>
|
||||
<paths>
|
||||
<default>{APP_ROOT}/data/log/{DATE}.log</default>
|
||||
<errors>{APP_ROOT}/data/log/{DATE}.errors.log</errors>
|
||||
</paths>
|
||||
</logging>
|
||||
<transformations>
|
||||
<template name="responsive" />
|
||||
</transformations>
|
||||
<title><![CDATA[OSS_SNMP]]></title>
|
||||
|
||||
</phpdocumentor>
|
||||
226
lib/OSS_SNMP-master/examples/asterisk.php
Normal file
226
lib/OSS_SNMP-master/examples/asterisk.php
Normal file
@@ -0,0 +1,226 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Asterisk MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "Asterisk version running on {$argv[1]}: " . $host->useAsterisk()->version() . "\n";
|
||||
echo "Asterisk SVN tag running on {$argv[1]}: " . $host->useAsterisk()->tag() . "\n";
|
||||
|
||||
|
||||
echo "Asterisk on {$argv[1]} up for: " . ( $host->useAsterisk()->uptime() / 100 / 60 / 60 ) . " hours\n";
|
||||
echo "Asterisk on {$argv[1]} reloaded: " . ( $host->useAsterisk()->reloadTime() / 100 / 60 / 60 ) . " hours ago\n";
|
||||
echo "Asterisk PID: " . $host->useAsterisk()->pid() . "\n";
|
||||
echo "Asterisk control socket: " . $host->useAsterisk()->controlSocket() . "\n";
|
||||
echo "Calls active: " . $host->useAsterisk()->callsActive() . "\n";
|
||||
echo "Calls processed: " . $host->useAsterisk()->callsProcessed() . "\n";
|
||||
echo "Modules compiled in: " . $host->useAsterisk()->modules() . "\n";
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "Indications defined: " . $host->useAsterisk_Indications()->number() . "\n";
|
||||
echo "Default indications zone: " . $host->useAsterisk_Indications()->defaultZone() . "\n";
|
||||
|
||||
echo "Indication country codes:\n\n";
|
||||
print_r( $host->useAsterisk_Indications()->countryCodes() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Indication descriptions:\n\n";
|
||||
print_r( $host->useAsterisk_Indications()->descriptions() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channels active: " . $host->useAsterisk_Channels()->active() . "\n";
|
||||
echo "Channels supported: " . $host->useAsterisk_Channels()->supported() . "\n";
|
||||
|
||||
|
||||
echo "Channel type names:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->names() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type descriptions:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->descriptions() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type device state capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->deviceStates() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type progress indication capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->progressIndications() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type transfer capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->transfers() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Active calls on supported channel types:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->activeCalls() );
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "Supported channel details:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->details() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channels bridged: " . $host->useAsterisk_Channels()->bridged() . "\n";
|
||||
|
||||
/**
|
||||
|
||||
|
||||
echo "\n\n\nchanName\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanName() );
|
||||
echo "\n\n\nchanLanguage\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanLanguage() );
|
||||
echo "\n\n\nchanType\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanType() );
|
||||
echo "\n\n\nchanMusicClass\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMusicClass() );
|
||||
echo "\n\n\nchanBridge\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanBridge() );
|
||||
echo "\n\n\nchanMasq\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMasq() );
|
||||
echo "\n\n\nchanMasqr\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMasqr() );
|
||||
echo "\n\n\nchanWhenHangup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanWhenHangup() );
|
||||
echo "\n\n\nchanApp\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanApp() );
|
||||
echo "\n\n\nchanData\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanData() );
|
||||
echo "\n\n\nchanContext\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanContext() );
|
||||
echo "\n\n\nchanMacroContext\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroContext() );
|
||||
echo "\n\n\nchanMacroExten\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroExten() );
|
||||
echo "\n\n\nchanMacroPri\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroPri() );
|
||||
echo "\n\n\nchanExten\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanExten() );
|
||||
echo "\n\n\nchanPri\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanPri() );
|
||||
echo "\n\n\nchanAccountCode\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanAccountCode() );
|
||||
echo "\n\n\nchanForwardTo\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanForwardTo() );
|
||||
echo "\n\n\nchanUniqueId\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanUniqueId() );
|
||||
echo "\n\n\nchanCallGroup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCallGroup() );
|
||||
echo "\n\n\nchanPickupGroup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanPickupGroup() );
|
||||
echo "\n\n\nchanState\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanState(1) );
|
||||
echo "\n\n\nchanMuted\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMuted() );
|
||||
echo "\n\n\nchanRings\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanRings() );
|
||||
echo "\n\n\nchanCidDNID\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidDNID() );
|
||||
echo "\n\n\nchanCidNum\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidNum() );
|
||||
echo "\n\n\nchanCidName\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidName() );
|
||||
echo "\n\n\nchanCidANI\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidANI() );
|
||||
echo "\n\n\nchanCidRDNIS\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidRDNIS() );
|
||||
echo "\n\n\nchanCidPresentation\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidPresentation() );
|
||||
echo "\n\n\nchanCidANI2\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidANI2() );
|
||||
echo "\n\n\nchanCidTON\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidTON() );
|
||||
echo "\n\n\nchanCidTNS\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidTNS() );
|
||||
echo "\n\n\nchanAMAFlags\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanAMAFlags(1) );
|
||||
echo "\n\n\nchanADSI\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanADSI(1) );
|
||||
echo "\n\n\nchanToneZone\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanToneZone() );
|
||||
echo "\n\n\nchanHangupCause\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanHangupCause(1) );
|
||||
echo "\n\n\nchanVariables\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanVariables() );
|
||||
echo "\n\n\nchanFlags\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanFlags() );
|
||||
echo "\n\n\nchanTransferCap\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanTransferCap(1) );
|
||||
|
||||
*/
|
||||
|
||||
echo "\n\n\nChannel Details\n";
|
||||
print_r( $host->useAsterisk_Channels()->channelDetails( true, false ) );
|
||||
|
||||
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
|
||||
88
lib/OSS_SNMP-master/examples/bgp.php
Normal file
88
lib/OSS_SNMP-master/examples/bgp.php
Normal file
@@ -0,0 +1,88 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Asterisk MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "BGP version running on {$argv[1]}: " . $host->useBGP()->version() . "\n";
|
||||
|
||||
echo "BGP - local ASN: " . $host->useBGP()->localASN() . "\n";
|
||||
|
||||
echo "BGP - identifier: " . $host->useBGP()->identifier() . "\n";
|
||||
|
||||
#echo "BGP - peers: \n\n";
|
||||
|
||||
#print_r( $host->useBGP()->peerDetails(1) );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
|
||||
exit( 0 );
|
||||
|
||||
|
||||
95
lib/OSS_SNMP-master/examples/extreme.php
Normal file
95
lib/OSS_SNMP-master/examples/extreme.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Extreme system MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\nSystem information for {$argv[1]}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "\n\nPlatform details for {$argv[1]}:\n"
|
||||
. "\nVendor: " . $host->getPlatform()->getVendor()
|
||||
. "\nModel: " . $host->getPlatform()->getModel()
|
||||
. "\nOS: " . $host->getPlatform()->getOs()
|
||||
. "\nOS Version: " . $host->getPlatform()->getOsVersion();
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "Temperature alarm: " . ( $host->useExtreme_System_Common()->overTemperatureAlarm() ? 'YES' : 'NO' ) . "\n";
|
||||
echo "Temperature : " . $host->useExtreme_System_Common()->currentTemperature() . "C\n";
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
print_r( $host->useExtreme_SwMonitor_Memory()->percentUsage() );
|
||||
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
|
||||
exit( 0 );
|
||||
134
lib/OSS_SNMP-master/examples/interfaces.php
Normal file
134
lib/OSS_SNMP-master/examples/interfaces.php
Normal file
@@ -0,0 +1,134 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 && count( $argv ) != 4 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two or three arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
- the index of the interface to show details for
|
||||
|
||||
If the third argument is missing, it will print interface indexes and names.
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
if( count( $argv ) == 3 )
|
||||
{
|
||||
echo "\nNumber of interfaces on {$argv[1]}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Descrition - Type - Admin/Operational State\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
echo "{$id}: {$name} - {$host->useIface()->descriptions()[$id]} - {$host->useIface()->types(1)[$id]}"
|
||||
. " - {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
$names = $host->useIface()->names();
|
||||
$id = $argv[3];
|
||||
|
||||
if( !isset( $names[ $id ] ) )
|
||||
{
|
||||
echo "Unknown interface index!\n";
|
||||
exit( 2 );
|
||||
}
|
||||
|
||||
$hdr = "\nInterface information for {$names[$id]} ({$host->useIface()->descriptions()[$id]})";
|
||||
|
||||
echo $hdr . "\n". str_repeat( '=', strlen( $hdr ) ) . "\n\n";
|
||||
|
||||
echo <<<INTINFO
|
||||
Alias: {$host->useIface()->aliases()[$id]}
|
||||
Type: {$host->useIface()->types(1)[$id]}
|
||||
|
||||
Admin / Operational State: {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}
|
||||
|
||||
MTU: {$host->useIface()->mtus()[$id]}
|
||||
Speeds: {$host->useIface()->speeds()[$id]}
|
||||
Physical Address: {$host->useIface()->physAddresses()[$id]}
|
||||
Last Change: {$host->useIface()->lastChanges()[$id]}
|
||||
|
||||
INTINFO;
|
||||
|
||||
try
|
||||
{
|
||||
echo <<<INTINFO
|
||||
In/Out Octets: {$host->useIface()->inOctets()[$id]} / {$host->useIface()->outOctets()[$id]}
|
||||
In/Out Unicast: {$host->useIface()->inUnicastPackets()[$id]} / {$host->useIface()->outUnicastPackets()[$id]}
|
||||
In/Out Non Unicats: {$host->useIface()->inNonUnicastPackets()[$id]} / {$host->useIface()->outNonUnicastPackets()[$id]}
|
||||
In/Out Discards: {$host->useIface()->inDiscards()[$id]} / {$host->useIface()->outDiscards()[$id]}
|
||||
In/Out Errors: {$host->useIface()->inErrors()[$id]} / {$host->useIface()->outErrors()[$id]}
|
||||
|
||||
In Unknown Protocols: {$host->useIface()->inUnknownProtocols()[$id]}
|
||||
Out Queue Length: {$host->useIface()->outQueueLength()[$id]}
|
||||
|
||||
INTINFO;
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
echo "\nCould not poll interface statistics for this interface.\n";
|
||||
}
|
||||
|
||||
exit( 0 );
|
||||
97
lib/OSS_SNMP-master/examples/mau.php
Normal file
97
lib/OSS_SNMP-master/examples/mau.php
Normal file
@@ -0,0 +1,97 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2015, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 && count( $argv ) != 4 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two or three arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
if( count( $argv ) == 3 )
|
||||
{
|
||||
echo "\nNumber of interfaces on {$argv[1]}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Index - Type - State - Media Available - Jack Type - State Exits - Jabber State - Autoneg\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
if( $id >1100 ) continue;
|
||||
|
||||
echo "{$id}: {$name} - {$host->useMAU()->index()[$id]}"
|
||||
. " - {$host->useMAU()->types( true )[$id]}"
|
||||
. " - {$host->useMAU()->states( true )[$id]}"
|
||||
. " - {$host->useMAU()->mediaAvailable( true )[$id]}"
|
||||
. " - {$host->useMAU()->jackTypes( true )[$id]}"
|
||||
. " - {$host->useMAU()->mediaAvailableStateExits()[$id]}"
|
||||
. " - {$host->useMAU()->jabberStates( true )[$id]}"
|
||||
. " - " . ( $host->useMAU()->autonegSupported()[$id] ? 'Y' : 'N' )
|
||||
. " - " . ( $host->useMAU()->autonegAdminState()[$id] ? 'Y' : 'N' )
|
||||
. "\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
|
||||
exit( 0 );
|
||||
206
lib/OSS_SNMP-master/examples/mst-port-roles.php
Normal file
206
lib/OSS_SNMP-master/examples/mst-port-roles.php
Normal file
@@ -0,0 +1,206 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script (in practical use by the author) which demonstrates
|
||||
// OSS_SNMP's MST querying capabilities. See the following link for more details
|
||||
// and a screenshot:
|
||||
//
|
||||
//
|
||||
|
||||
// SNMP community of the devices. Assumes all devices have the same community.
|
||||
// Script can easiy be augmented to put this detail in the $ports array below.
|
||||
$community = 'public';
|
||||
|
||||
// Array or arrays of switches and ports to collect MST information from.
|
||||
//
|
||||
// Format of each individual port array is:
|
||||
//
|
||||
// [
|
||||
// 'host' => 'hostname or IP address of device',
|
||||
// 'port' => ifName of the port to query
|
||||
// 'linkedTo' => index of another port array to which this port connects.
|
||||
// Set to null to ignore. Displayed the connected to in the
|
||||
// output which can be useful.
|
||||
// ]
|
||||
//
|
||||
$ports = [
|
||||
0 => [ 'host' => 'sw01', 'port' => 'Gi1/1/1', 'linkedTo' => 10 ],
|
||||
10 => [ 'host' => 'sw01.example.com', 'port' => 'Gi0/11', 'linkedTo' => 0 ],
|
||||
20 => [ 'host' => '192.0.2.67', 'port' => 'Gi1/0/6', 'linkedTo' => null ],
|
||||
// ...
|
||||
];
|
||||
|
||||
// Path to your OSS_SNMP installation.
|
||||
// https://github.com/opensolutions/OSS_SNMP
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
|
||||
///////////
|
||||
// No need to change anything else from here.
|
||||
///////////
|
||||
|
||||
|
||||
// array of OSS_SNMP host objects
|
||||
$hosts = [];
|
||||
|
||||
// array of MST instances on each host (indexed by hostname / IP from $ports array)
|
||||
$hosts_msts = [];
|
||||
|
||||
// array of MST port roles per MST instance for each host (indexed by hostname / IP from $ports array)
|
||||
$hosts_msts_portroles = [];
|
||||
|
||||
// maps ifName to ifIndex as we allow ports to be specified by ifName for ease of use
|
||||
$portNameToIndex = [];
|
||||
|
||||
|
||||
// iterate over each port array (from $ports) and:
|
||||
// - instantiate the OSS_SNMP object for the device (once per device)
|
||||
// - populate the $hosts_msts array with device MST instance information
|
||||
// - populate the port ifName to ifIndex array
|
||||
// - get the port roles for all MST instances on the device
|
||||
//
|
||||
foreach( $ports as $id => $conf )
|
||||
{
|
||||
if( !isset( $hosts[ $conf['host'] ] ) )
|
||||
{
|
||||
$hosts[ $conf['host'] ] = new \OSS_SNMP\SNMP( $conf['host'], $community );
|
||||
$hosts_msts[ $conf['host'] ] = $hosts[ $conf['host'] ]->useCisco_SMST()->instances( '' );
|
||||
$portNameToIndex[ $conf['host'] ] = array_flip( $hosts[ $conf['host'] ]->useIface()->names() );
|
||||
|
||||
foreach( $hosts_msts[ $conf['host'] ] as $id => $instance )
|
||||
$hosts_msts_portroles[ $conf['host'] ][$instance] = $hosts[ $conf['host'] ]->useCisco_MST()->portRoles( $instance, true );
|
||||
}
|
||||
}
|
||||
|
||||
// For our tabular output, we need to know what the maximum instance number is:
|
||||
$maxMstInstance = 0;
|
||||
foreach( $hosts_msts as $msts )
|
||||
if( max( $msts ) > $maxMstInstance )
|
||||
$maxMstInstance = max( $msts );
|
||||
|
||||
// Format and print our table header:
|
||||
$title = "Device - Port :\tStatus Speed ";
|
||||
for( $i = 0; $i <= $maxMstInstance; $i++ )
|
||||
$title .= sprintf( "MST%-9d", $i );
|
||||
|
||||
$title .= ' Connected to ';
|
||||
|
||||
echo "{$title}\n";
|
||||
echo str_repeat( '=', strlen( $title ) ) . "\n";
|
||||
|
||||
// Bash colouring.
|
||||
// Ref: http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
|
||||
function bashColour( $text, $fgColour ) {
|
||||
$colours = [
|
||||
'green' => '0;32',
|
||||
'red' => '0;31'
|
||||
];
|
||||
|
||||
return "\033[{$colours[$fgColour]}m{$text}\033[0m";
|
||||
}
|
||||
|
||||
// closure to print coloured port state of a specified column width
|
||||
$colourisedPortState = function( $state, $width ) {
|
||||
$td = $state;
|
||||
while( strlen( $td ) < $width )
|
||||
$td .= ' ';
|
||||
|
||||
if( $state == 'up' )
|
||||
return bashColour( $td, 'green' );
|
||||
else
|
||||
return bashColour( $td, 'red' );
|
||||
};
|
||||
|
||||
// closure to print colours MST port roles of a specified column width
|
||||
$colourisedMSTPortRole = function( $role, $width ) {
|
||||
$td = $role;
|
||||
while( strlen( $td ) < $width )
|
||||
$td .= ' ';
|
||||
|
||||
switch( $role )
|
||||
{
|
||||
case 'designated':
|
||||
return bashColour( $td, 'green' );
|
||||
|
||||
case 'root':
|
||||
return bashColour( $td, 'green' );
|
||||
|
||||
case 'alternate':
|
||||
return bashColour( $td, 'red' );
|
||||
}
|
||||
|
||||
return $td;
|
||||
};
|
||||
|
||||
// iterate over all the ports we are insterested in and print its row:
|
||||
foreach( $ports as $id => $conf )
|
||||
{
|
||||
$ifIndex = $portNameToIndex[ $conf['host'] ][ $conf['port'] ];
|
||||
|
||||
// print hostname/IP, port, port state, and port speed
|
||||
echo sprintf( "%-16s - %-8s:\t%s %-5s ", $conf['host'], $conf['port'],
|
||||
$colourisedPortState( $hosts[ $conf['host'] ]->useIface()->operationStates( true )[ $ifIndex ], 6 ),
|
||||
$hosts[ $conf['host'] ]->useIface()->speeds()[$ifIndex] / 1000 / 1000
|
||||
);
|
||||
|
||||
// print MST port role
|
||||
for( $i = 0; $i <= max( $hosts_msts[ $conf['host'] ] ); $i++ )
|
||||
{
|
||||
if( !isset( $hosts_msts[ $conf['host'] ][ $i ] ) )
|
||||
echo '- mst n/a - ';
|
||||
else if( !isset( $hosts_msts_portroles[ $conf['host'] ][ $i ][ $ifIndex ] ) )
|
||||
echo '- port n/a- ';
|
||||
else
|
||||
echo $colourisedMSTPortRole( $hosts_msts_portroles[ $conf['host'] ][ $i ][ $ifIndex ], 12 );
|
||||
}
|
||||
|
||||
while( $i <= $maxMstInstance )
|
||||
{
|
||||
echo '- mst n/a - ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo ' ';
|
||||
|
||||
if( $conf['linkedTo'] !== null )
|
||||
echo $ports[ $conf['linkedTo'] ]['host'] . ':' . $ports[ $conf['linkedTo'] ]['port'];
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
exit( 0 );
|
||||
|
||||
79
lib/OSS_SNMP-master/examples/platform.php
Normal file
79
lib/OSS_SNMP-master/examples/platform.php
Normal file
@@ -0,0 +1,79 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\nPlatform details for {$argv[1]}:\n"
|
||||
. "\nVendor: " . $host->getPlatform()->getVendor()
|
||||
. "\nModel: " . $host->getPlatform()->getModel()
|
||||
. "\nOS: " . $host->getPlatform()->getOs()
|
||||
. "\nOS Version: " . $host->getPlatform()->getOsVersion();
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
|
||||
27
lib/OSS_SNMP-master/examples/snmptest.php
Normal file
27
lib/OSS_SNMP-master/examples/snmptest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
$ip = '127.0.0.1';
|
||||
$community = 'public';
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $ip, $community );
|
||||
|
||||
echo "\nSystem information for {$ip}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "\nNumber of interfaces on {$ip}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Descrition - Type - Admin/Operational State\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
echo "{$id}: {$name} - {$host->useIface()->descriptions()[$id]} - {$host->useIface()->types(1)[$id]}"
|
||||
. " - {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
15
lib/OSS_SNMP-master/examples/system-info.php
Normal file
15
lib/OSS_SNMP-master/examples/system-info.php
Normal file
@@ -0,0 +1,15 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
$ip = '127.0.0.1';
|
||||
$community = 'public';
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $ip, $community );
|
||||
|
||||
echo "\nSystem information for {$ip}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user