From a20a7b3c301bb747b195d90cb8d966459eb5f587 Mon Sep 17 00:00:00 2001 From: Steffen Ritter Date: Mon, 31 Jan 2022 17:19:53 +0100 Subject: [statistics_reporting] Gather some more os infos * IP address * Hostname by reverse lookup on IP * OS name/version --- modules-available/statistics_reporting/inc/remotereport.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules-available/statistics_reporting/inc/remotereport.inc.php') diff --git a/modules-available/statistics_reporting/inc/remotereport.inc.php b/modules-available/statistics_reporting/inc/remotereport.inc.php index 98f366b6..fec78542 100644 --- a/modules-available/statistics_reporting/inc/remotereport.inc.php +++ b/modules-available/statistics_reporting/inc/remotereport.inc.php @@ -106,6 +106,7 @@ class RemoteReport $cpuInfo = file_get_contents('/proc/cpuinfo'); $uptime = file_get_contents('/proc/uptime'); $memInfo = file_get_contents('/proc/meminfo'); + $osInfo = parse_ini_file('/etc/os-release'); preg_match_all('/\b(\w+):\s+(\d+)\s/s', $memInfo, $out, PREG_SET_ORDER); $mem = array(); foreach ($out as $e) { @@ -126,6 +127,14 @@ class RemoteReport $data['swapTotal'] = $mem['SwapTotal']; $data['swapUsed'] = ($mem['SwapTotal'] - $mem['SwapFree']); } + + $data['ip'] = $_SERVER['SERVER_ADDR']; + $data['hostname'] = strtolower(gethostbyaddr($_SERVER['SERVER_ADDR'])); + + $data['osID'] = $osInfo['ID']; + $data['osVersionID'] = $osInfo['VERSION_ID']; + $data['osVersionCodename'] = $osInfo['VERSION_CODENAME']; + return $data; } -- cgit v1.2.3-55-g7522