forked from fuzzymannerz/swmp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added error messages (and config.php) (fuzzymannerz#5)
* Code cleanup as preperation - removed all query functions to system.php - swmp.php is now main file to get system information - moved additional util functions in utils.php (from mainclass.php) - added gitignore (with entries for intellij and normal default values) * Added error messages for failed commands * added config.php with a few settings (mainly to disable errors) * Added new themes to config.php comment
- Loading branch information
1 parent
77201ea
commit 70b7053
Showing
9 changed files
with
821 additions
and
722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Thumbs.db | ||
*~ | ||
*.DS_Store | ||
#* | ||
.idea/* | ||
web.config | ||
|
||
config.local.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/*******************************************************************************/ | ||
/** to configure swmp copy this file to config.local.php and change the values */ | ||
/*******************************************************************************/ | ||
|
||
return array | ||
( | ||
// all themes are files in the /css/ folder | ||
// available themes are: | ||
// "cerulean", "cosmo", "lumen", "paper", "readable", "sandstone", | ||
// "simplex", "slate", "spacelab", "superhero", "united", "yeti", | ||
// "darkplex", "rose", "terminal" | ||
"theme" => "simplex", | ||
|
||
// if set to true errors are shown for system information that could not be recieved | ||
// after the server is set up it is recommended to set this to false | ||
"show_errors" => true, | ||
|
||
// the windowtitle | ||
// available replacements are {hostname}, {ip}, {os} and {kernel} | ||
"window_title" => "SWMP | {hostname}", | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
/*/////////////////////////////////////////////// | ||
/// /// | ||
/// SWMP - Server Web Monitoring Page /// | ||
/// By Fuzzy - thefuzz.xyz - 2016 /// | ||
/// /// | ||
///////////////////////////////////////////////// | ||
/// /// | ||
/// Credits, downloads and usage info: /// | ||
/// https://github.com/fuzzymannerz/swmp /// | ||
/// /// | ||
//////////////////////////////////////////////////////////// | ||
/// /// | ||
/// If you make use of SWMP please consider to /// | ||
/// show some love via PayPal, Flattr or BTC. <3 /// | ||
/// (Details are on the GitHub page or my website.) /// | ||
/// /// | ||
//////////////////////////////////////////////////////////*/ | ||
|
||
// ================ Load settings ================ | ||
|
||
$config = require "config.php"; | ||
if(file_exists('config.local.php')){ | ||
$config = array_merge($config, require 'config.local.php'); | ||
}; | ||
|
||
//=================================================== | ||
|
||
require 'php/system.php'; | ||
|
||
$all_errors = array(); | ||
|
||
// ================ Get system info ================ | ||
|
||
$hostname = getSystemHostname($all_errors); | ||
$ip = getLanIp($all_errors); | ||
$cores = getCpuCoresNumber($all_errors); | ||
$os = getOperatingSystem($all_errors); | ||
$kernel = getKernel($all_errors); | ||
$uptime = getUptime($all_errors); | ||
$bootTime = getBootupTime($all_errors); | ||
|
||
$cpumodel = getCpuModel($all_errors); | ||
$cpufrequency = getCpuFrequency($all_errors); | ||
$cpucache = getCpuCacheSize($all_errors); | ||
$cputemp = getCpuTemperature($all_errors); | ||
|
||
$cpudata = getCpuLoadData($all_errors); | ||
|
||
$ramdata = getRamInfo($all_errors); | ||
|
||
|
||
$swap = getSwapData($all_errors); | ||
$network = getNetworkData($all_errors); | ||
$disk = getDiskData($all_errors); | ||
|
||
//=================================================== | ||
|
||
// Limit shown errors to max 8 | ||
|
||
$error_count = count($all_errors); | ||
if ($error_count > 8) { | ||
$all_errors = array_slice($all_errors, 0, 7); | ||
$all_errors[] = "There were " . ($error_count - 7) . " more errors that are currently not shown"; | ||
} | ||
|
||
$wtitle = $config["window_title"]; | ||
$wtitle = str_replace("{hostname}", $hostname, $wtitle); | ||
$wtitle = str_replace("{ip}", $ip, $wtitle); | ||
$wtitle = str_replace("{os}", $os, $wtitle); | ||
$wtitle = str_replace("{kernel}", $kernel, $wtitle); |
Oops, something went wrong.