2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
2023-05-29 21:59:27 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2023
|
2012-06-04 16:58:40 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
2012-11-24 03:30:11 +01:00
|
|
|
James Rose <james.o.rose@gmail.com>
|
2012-06-04 16:58:40 +02:00
|
|
|
*/
|
2017-06-07 20:47:17 +02:00
|
|
|
|
2022-10-11 00:35:14 +02:00
|
|
|
//includes files
|
2023-06-15 19:28:23 +02:00
|
|
|
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
2017-06-07 20:47:17 +02:00
|
|
|
require_once "resources/check_auth.php";
|
|
|
|
|
|
|
|
|
|
//check permissions
|
|
|
|
|
if (permission_exists('system_view_info')
|
|
|
|
|
|| permission_exists('system_view_cpu')
|
|
|
|
|
|| permission_exists('system_view_hdd')
|
|
|
|
|
|| permission_exists('system_view_ram')
|
|
|
|
|
|| permission_exists('system_view_backup')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-24 03:30:11 +01:00
|
|
|
//add multi-lingual support
|
2015-01-18 11:04:43 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
|
|
|
|
|
2017-06-07 20:47:17 +02:00
|
|
|
//additional includes
|
|
|
|
|
require_once "resources/header.php";
|
|
|
|
|
|
|
|
|
|
//set the page title
|
|
|
|
|
$document['title'] = $text['title-sys-status'];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
// OS Support
|
2017-06-07 20:47:17 +02:00
|
|
|
//
|
|
|
|
|
// For each section below wrap in an OS detection statement like:
|
|
|
|
|
// if (stristr(PHP_OS, 'Linux')) {}
|
|
|
|
|
//
|
|
|
|
|
// Some possibilites for PHP_OS...
|
|
|
|
|
//
|
|
|
|
|
// CYGWIN_NT-5.1
|
|
|
|
|
// Darwin
|
|
|
|
|
// FreeBSD
|
|
|
|
|
// HP-UX
|
|
|
|
|
// IRIX64
|
|
|
|
|
// Linux
|
|
|
|
|
// NetBSD
|
|
|
|
|
// OpenBSD
|
|
|
|
|
// SunOS
|
|
|
|
|
// Unix
|
|
|
|
|
// WIN32
|
|
|
|
|
// WINNT
|
|
|
|
|
// Windows
|
|
|
|
|
//
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//system information
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<b>".$text['header-sys-status']."</b>";
|
|
|
|
|
echo "<br><br>";
|
|
|
|
|
|
|
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " <th class='th' colspan='2' align='left'>".$text['title-sys-info']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
if (permission_exists('system_view_info')) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2015-12-07 18:32:20 +01:00
|
|
|
echo " ".$text['label-version']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
2019-11-08 07:21:59 +01:00
|
|
|
echo " ".software::version()."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2015-12-21 11:46:27 +01:00
|
|
|
$git_path = normalize_path_to_os($_SERVER['PROJECT_ROOT']."/.git");
|
2015-12-07 18:37:41 +01:00
|
|
|
if(file_exists($git_path)){
|
2015-12-11 15:57:14 +01:00
|
|
|
$git_exe = 'git';
|
2015-12-12 18:34:52 +01:00
|
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { $git_exe = shell_exec('which git'); }
|
2017-11-07 16:22:33 +01:00
|
|
|
exec($git_exe.' --git-dir='.$git_path.' status', $dummy, $returnCode);
|
2017-04-13 18:07:21 +02:00
|
|
|
if($returnCode){
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-git_info']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".$text['label-git_corrupted']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}else{
|
|
|
|
|
$git_branch = shell_exec($git_exe.' --git-dir='.$git_path.' name-rev --name-only HEAD');
|
|
|
|
|
rtrim($git_branch);
|
|
|
|
|
$git_commit = shell_exec($git_exe.' --git-dir='.$git_path.' rev-parse HEAD');
|
|
|
|
|
rtrim($git_commit);
|
|
|
|
|
$git_origin = shell_exec($git_exe.' --git-dir='.$git_path.' config --get remote.origin.url');
|
|
|
|
|
rtrim($git_origin);
|
|
|
|
|
$git_origin = preg_replace('/\.git$/','',$git_origin);
|
|
|
|
|
$git_status = shell_exec($git_exe.' --git-dir='.$git_path.' status | grep "Your branch"');
|
2023-05-05 18:46:37 +02:00
|
|
|
if(!empty($git_status))
|
|
|
|
|
rtrim($git_status);
|
2017-11-07 16:22:33 +01:00
|
|
|
$git_age = shell_exec($git_exe.' --git-dir='.$git_path.' log --pretty=format:%at "HEAD^!"');
|
2017-04-13 18:07:21 +02:00
|
|
|
rtrim($git_age);
|
|
|
|
|
$git_date = DateTime::createFromFormat('U', $git_age);
|
|
|
|
|
$git_age = $git_date->diff(new DateTime('now'));
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-git_info']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".$text['label-git_branch'].": ".$git_branch."<br>\n";
|
|
|
|
|
echo " ".$text['label-git_commit'].": <a href='$git_origin/commit/$git_commit'>".$git_commit."</a><br>\n";
|
|
|
|
|
echo " ".$text['label-git_origin'].": ".$git_origin."<br>\n";
|
|
|
|
|
echo " ".$text['label-git_status'].": ".$git_status.$git_age->format(' %R%a days ago')."<br>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2015-12-07 18:37:41 +01:00
|
|
|
}
|
2015-12-04 13:18:11 +01:00
|
|
|
|
2015-12-21 11:46:27 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-path']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".$_SERVER['PROJECT_ROOT']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2023-12-03 01:16:18 +01:00
|
|
|
$esl = event_socket::create();
|
|
|
|
|
if ($esl->is_connected()) {
|
|
|
|
|
$switch_version = event_socket::api('version');
|
2015-12-10 11:51:38 +01:00
|
|
|
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $switch_version, $matches);
|
2015-12-07 18:38:54 +01:00
|
|
|
$switch_version = $matches[1];
|
|
|
|
|
$switch_bits = $matches[2];
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2015-12-10 12:58:09 +01:00
|
|
|
echo " ".$text['label-switch']." ".$text['label-version']."\n";
|
2015-12-07 18:38:54 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">$switch_version ($switch_bits)</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2015-12-10 12:58:09 +01:00
|
|
|
preg_match("/\(git\s*(.*?)\s*\d+\w+\s*\)/", $switch_version, $matches);
|
2023-05-29 21:59:27 +02:00
|
|
|
$switch_git_info = $matches[1] ?? null;
|
2023-05-05 18:46:37 +02:00
|
|
|
if(!empty($switch_git_info)){
|
2015-12-10 12:58:09 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-switch']." ".$text['label-git_info']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">$switch_git_info</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2015-12-07 18:38:54 +01:00
|
|
|
}
|
|
|
|
|
|
2020-07-30 17:36:27 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-php']." ".$text['label-version']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">".phpversion()."</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2015-12-21 11:46:27 +01:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <th class='th' colspan='2' align='left' style='padding-top:2em'>".$text['title-os-info']."</th>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2017-06-08 20:44:15 +02:00
|
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
|
|
|
|
echo "<!--\n";
|
|
|
|
|
$data = explode("\n",shell_exec('systeminfo /FO CSV 2> nul'));
|
|
|
|
|
$data = array_combine(str_getcsv($data[0]), str_getcsv($data[1]));
|
|
|
|
|
$os_name = $data['OS Name'];
|
|
|
|
|
$os_version = $data['OS Version'];
|
|
|
|
|
unset($data);
|
|
|
|
|
echo "-->\n";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "<!--\n";
|
|
|
|
|
$os_kernel = shell_exec('uname -a');
|
|
|
|
|
$os_name = shell_exec('lsb_release -is');
|
|
|
|
|
$os_version = shell_exec('lsb_release -rs');
|
|
|
|
|
echo "-->\n";
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($os_name)) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-os']." \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
2017-06-08 20:44:15 +02:00
|
|
|
echo " ".$os_name." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($os_version)) {
|
2017-06-08 20:44:15 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-version']." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".$os_version." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($os_kernel)) {
|
2017-06-08 20:44:15 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-kernel']." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".$os_kernel." \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
2017-06-08 20:44:15 +02:00
|
|
|
unset($os_name, $os_version, $os_kernel);
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
echo "<!--\n";
|
|
|
|
|
$tmp_result = shell_exec('uptime');
|
|
|
|
|
echo "-->\n";
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($tmp_result)) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " Uptime\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".$tmp_result." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
unset($tmp_result);
|
|
|
|
|
}
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2015-02-15 07:50:00 +01:00
|
|
|
echo " Date\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".date('r')." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<br /><br>";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//memory information
|
|
|
|
|
if (permission_exists('system_view_ram')) {
|
|
|
|
|
//linux
|
|
|
|
|
if (stristr(PHP_OS, 'Linux')) {
|
|
|
|
|
echo "<!--\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
$shell_cmd = 'free -hw';
|
|
|
|
|
$shell_result = shell_exec($shell_cmd);
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "-->\n";
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($shell_result)) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " <th colspan='2' align='left' valign='top'>".$text['title-mem']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-mem']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " <pre>\n";
|
|
|
|
|
echo "$shell_result<br>";
|
|
|
|
|
echo "</pre>\n";
|
|
|
|
|
unset($shell_result);
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<br /><br />";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//freebsd
|
|
|
|
|
if (stristr(PHP_OS, 'FreeBSD')) {
|
|
|
|
|
echo "<!--\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
$shell_cmd = 'sysctl vm.vmtotal';
|
|
|
|
|
$shell_result = shell_exec($shell_cmd);
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "-->\n";
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($shell_result)) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " <th colspan='2' align='left' valign='top'>".$text['title-mem']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-mem']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " <pre>\n";
|
|
|
|
|
echo "$shell_result<br>";
|
|
|
|
|
echo "</pre>\n";
|
|
|
|
|
unset($shell_result);
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<br /><br />";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-02-14 18:30:38 +01:00
|
|
|
|
2020-07-30 17:36:27 +02:00
|
|
|
//Windows
|
|
|
|
|
if (stristr(PHP_OS, 'WIN')) {
|
|
|
|
|
echo "<!--\n";
|
|
|
|
|
// connect to WMI
|
|
|
|
|
$wmi = new COM('WinMgmts:root/cimv2');
|
|
|
|
|
// Query this Computer for Total Physical RAM
|
|
|
|
|
$res = $wmi->ExecQuery('Select TotalPhysicalMemory from Win32_ComputerSystem');
|
|
|
|
|
// Fetch the first item from the results
|
|
|
|
|
$system = $res->ItemIndex(0);
|
|
|
|
|
$shell_result = round($system->TotalPhysicalMemory / 1024 /1024, 0);
|
|
|
|
|
echo "-->\n";
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($shell_result)) {
|
2020-07-30 17:36:27 +02:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <th class='th' colspan='2' align='left'>".$text['Physical Memory']."</th>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-mem']." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " $shell_result mb\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "<br /><br />";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//cpu information
|
|
|
|
|
if (permission_exists('system_view_cpu')) {
|
|
|
|
|
//linux
|
|
|
|
|
if (stristr(PHP_OS, 'Linux')) {
|
|
|
|
|
echo "<!--\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
$shell_cmd = "ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d'";
|
|
|
|
|
$shell_result = shell_exec($shell_cmd);
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "-->\n";
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($shell_result)) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " <th class='th' colspan='2' align='left' valign='top'>".$text['title-cpu']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-cpu']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " <pre>\n";
|
|
|
|
|
|
2017-06-07 20:47:17 +02:00
|
|
|
//$last_line = shell_exec($shell_cmd, $shell_result);
|
2012-06-04 16:58:40 +02:00
|
|
|
//foreach ($shell_result as $value) {
|
|
|
|
|
// echo substr($value, 0, 100);
|
|
|
|
|
// echo "<br />";
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
echo "$shell_result<br>";
|
|
|
|
|
|
|
|
|
|
echo "</pre>\n";
|
|
|
|
|
unset($shell_result);
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<br /><br />";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//freebsd
|
|
|
|
|
if (stristr(PHP_OS, 'FreeBSD')) {
|
|
|
|
|
echo "<!--\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
$shell_cmd = 'top';
|
|
|
|
|
$shell_result = shell_exec($shell_cmd);
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "-->\n";
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty($shell_result)) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " <th class='th' colspan='2' align='left' valign='top'>".$text['title-cpu']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-cpu']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " <pre>\n";
|
|
|
|
|
echo "$shell_result<br>";
|
|
|
|
|
echo "</pre>\n";
|
|
|
|
|
unset($shell_result);
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<br /><br />";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//drive space
|
|
|
|
|
if (permission_exists('system_view_hdd')) {
|
|
|
|
|
if (stristr(PHP_OS, 'Linux') || stristr(PHP_OS, 'FreeBSD')) {
|
2017-06-07 16:58:33 +02:00
|
|
|
echo "<!--\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
$shell_cmd = 'df -hP --total';
|
|
|
|
|
$shell_result = shell_exec($shell_cmd);
|
2017-06-07 16:58:33 +02:00
|
|
|
echo "-->\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " <th class='th' colspan='2' align='left'>".$text['title-drive']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-drive']." \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo "<pre>\n";
|
|
|
|
|
echo "$shell_result<br>";
|
|
|
|
|
echo "</pre>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
} else if (stristr(PHP_OS, 'WIN')) {
|
|
|
|
|
//disk_free_space returns the number of bytes available on the drive;
|
|
|
|
|
//1 kilobyte = 1024 byte
|
2014-06-13 22:28:46 +02:00
|
|
|
//1 megabyte = 1024 kilobyte
|
2017-06-07 20:47:17 +02:00
|
|
|
$drive_letter = substr($_SERVER["DOCUMENT_ROOT"], 0, 2);
|
|
|
|
|
$disk_size = round(disk_total_space($drive_letter)/1024/1024, 2);
|
|
|
|
|
$disk_size_free = round(disk_free_space($drive_letter)/1024/1024, 2);
|
|
|
|
|
$disk_percent_available = round(($disk_size_free/$disk_size) * 100, 2);
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " <th class='th' colspan='2' align='left'>".$text['label-drive']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-drive-capacity']." \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
echo " $disk_size mb\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-drive-free']." \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
echo " $disk_size_free mb\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
2012-11-24 03:30:11 +01:00
|
|
|
echo " ".$text['label-drive-percent']." \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
2017-06-07 20:47:17 +02:00
|
|
|
echo " $disk_percent_available% \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
}
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<br /><br />";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2023-02-14 18:30:38 +01:00
|
|
|
//database information
|
|
|
|
|
if (permission_exists('system_view_database')) {
|
|
|
|
|
if ($db_type == 'pgsql') {
|
|
|
|
|
|
2023-02-15 17:51:36 +01:00
|
|
|
//database version
|
2023-02-14 18:30:38 +01:00
|
|
|
$sql = "select version(); ";
|
|
|
|
|
$database = new database;
|
|
|
|
|
$database_version = $database->select($sql, null, 'column');
|
|
|
|
|
|
2023-02-15 17:51:36 +01:00
|
|
|
//database connections
|
|
|
|
|
$sql = "select count(*) from pg_stat_activity; ";
|
|
|
|
|
$database = new database;
|
|
|
|
|
$database_connections = $database->select($sql, null, 'column');
|
|
|
|
|
|
|
|
|
|
//database size
|
|
|
|
|
$sql = "SELECT pg_database.datname,\n";
|
|
|
|
|
$sql .= "pg_size_pretty(pg_database_size(pg_database.datname)) AS size \n";
|
|
|
|
|
$sql .= "FROM pg_database;\n";
|
|
|
|
|
$database = new database;
|
|
|
|
|
$database_size = $database->select($sql, null, 'all');
|
|
|
|
|
|
2023-02-14 18:30:38 +01:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <th class='th' colspan='2' align='left'>".$text['title-database']."</th>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-version']." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
2023-02-15 17:51:36 +01:00
|
|
|
echo " ".$database_version."<br>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-database_connections']." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " ".$database_connections."<br>\n";
|
2023-02-14 18:30:38 +01:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2023-02-15 17:51:36 +01:00
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
|
|
|
|
echo " ".$text['label-databases']." \n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class=\"row_style1\">\n";
|
|
|
|
|
echo " <table border='0' cellpadding='3' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr><td>". $text['label-name'] ."</td><td> </td><td style='text-align: left;'>". $text['label-size'] ."</td></tr>\n";
|
|
|
|
|
foreach ($database_size as $row) {
|
|
|
|
|
echo " <tr><td>".$row['datname'] ."</td><td> </td><td style='text-align: left;'>". $row['size'] ."</td></tr>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2023-02-14 18:30:38 +01:00
|
|
|
echo "</table>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "<br /><br />";
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 22:28:46 +02:00
|
|
|
//memcache information
|
2016-02-05 07:39:08 +01:00
|
|
|
if (permission_exists("system_view_memcache") && file_exists($_SERVER["PROJECT_ROOT"]."/app/sip_status/app_config.php")){
|
2014-06-13 22:28:46 +02:00
|
|
|
echo "<table width='100%' border='0' cellpadding='7' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <th class='th' colspan='2' align='left'>".$text['title-memcache']."</th>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
|
2015-12-06 21:51:19 +01:00
|
|
|
$memcache_fail = false;
|
2014-11-23 10:45:10 +01:00
|
|
|
$mod = new modules;
|
2014-06-13 22:28:46 +02:00
|
|
|
if ($mod -> active("mod_memcache")) {
|
2023-12-03 01:16:18 +01:00
|
|
|
$esl = event_socket::create();
|
|
|
|
|
if ($esl->is_connected()) {
|
2014-06-13 22:28:46 +02:00
|
|
|
$switch_cmd = "memcache status verbose";
|
2023-12-03 01:16:18 +01:00
|
|
|
$switch_result = event_socket::api($switch_cmd);
|
2015-12-06 21:51:19 +01:00
|
|
|
$memcache_lines = preg_split('/\n/', $switch_result);
|
|
|
|
|
foreach($memcache_lines as $memcache_line) {
|
2023-05-05 18:46:37 +02:00
|
|
|
if (!empty(trim($memcache_line)) > 0 && substr_count($memcache_line, ': ')) {
|
2015-12-06 21:51:19 +01:00
|
|
|
$memcache_temp = explode(': ', $memcache_line);
|
|
|
|
|
$memcache_status[$memcache_temp[0]] = $memcache_temp[1];
|
2014-06-13 22:28:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-06 21:51:19 +01:00
|
|
|
if (is_array($memcache_status) && sizeof($memcache_status) > 0) {
|
|
|
|
|
foreach($memcache_status as $memcache_field => $memcache_value) {
|
2014-06-13 22:28:46 +02:00
|
|
|
echo "<tr>\n";
|
2015-12-06 21:51:19 +01:00
|
|
|
echo " <td width='20%' class='vncell' style='text-align: left;'>".$memcache_field."</td>\n";
|
|
|
|
|
echo " <td class='row_style1'>".$memcache_value."</td>\n";
|
2014-06-13 22:28:46 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-06 21:51:19 +01:00
|
|
|
else { $memcache_fail = true; }
|
2014-06-13 22:28:46 +02:00
|
|
|
}
|
2015-12-06 21:51:19 +01:00
|
|
|
else { $memcache_fail = true; }
|
2014-06-13 22:28:46 +02:00
|
|
|
|
|
|
|
|
}
|
2015-12-06 21:51:19 +01:00
|
|
|
else { $memcache_fail = true; }
|
2014-06-13 22:28:46 +02:00
|
|
|
|
2015-12-06 21:51:19 +01:00
|
|
|
if ($memcache_fail) {
|
2014-06-13 22:28:46 +02:00
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo " <td width='20%' class='vncell' style='text-align: left;'>".$text['label-memcache_status']."</td>\n";
|
|
|
|
|
echo " <td class='row_style1'>".$text['message-unavailable']."</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "</table>\n";
|
2015-02-15 12:57:14 +01:00
|
|
|
echo "<br /><br />\n";
|
2014-06-13 22:28:46 +02:00
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//include the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2017-06-07 20:47:17 +02:00
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
?>
|