diff options
author | Udo Walter | 2017-01-17 13:47:24 +0100 |
---|---|---|
committer | Udo Walter | 2017-01-17 13:47:24 +0100 |
commit | 4910fa0b9f5ca6b6063965cc516ced8d72f8be5b (patch) | |
tree | 7514244884661c4e7fc323d6d67587616237885b /modules-available/statistics_reporting | |
parent | [statistics_reporting] added cronjob for weekly report (diff) | |
download | slx-admin-4910fa0b9f5ca6b6063965cc516ced8d72f8be5b.tar.gz slx-admin-4910fa0b9f5ca6b6063965cc516ced8d72f8be5b.tar.xz slx-admin-4910fa0b9f5ca6b6063965cc516ced8d72f8be5b.zip |
[statistics_reporting] added vm name anonymization
Diffstat (limited to 'modules-available/statistics_reporting')
3 files changed, 5 insertions, 4 deletions
diff --git a/modules-available/statistics_reporting/hooks/cron.inc.php b/modules-available/statistics_reporting/hooks/cron.inc.php index 57e64a84..9b32bc96 100644 --- a/modules-available/statistics_reporting/hooks/cron.inc.php +++ b/modules-available/statistics_reporting/hooks/cron.inc.php @@ -16,7 +16,7 @@ if ($nextReporting < $time && $allowReport) { $data['perLocation'] = GetData::perLocation(true); $data['perClient'] = GetData::perClient(true); $data['perUser'] = GetData::perUser(true); - $data['perVM'] = GetData::perVM(); + $data['perVM'] = GetData::perVM(true); $statisticsReport = json_encode($data); diff --git a/modules-available/statistics_reporting/inc/getdata.inc.php b/modules-available/statistics_reporting/inc/getdata.inc.php index 880256d6..cfb63658 100644 --- a/modules-available/statistics_reporting/inc/getdata.inc.php +++ b/modules-available/statistics_reporting/inc/getdata.inc.php @@ -84,11 +84,12 @@ class GetData // per vm - public static function perVM() { + public static function perVM($anonymize = false) { $res = Queries::getVMStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); $data = array(); + $vm = $anonymize ? 'vmHash' : 'name'; while ($row = $res->fetch(PDO::FETCH_ASSOC)) { - $data[] = array('vm' => $row['name'], 'sessions' => $row['count']); + $data[] = array('vm' => $row[$vm], 'sessions' => $row['count']); } return $data; } diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php index 23f5fb03..219640a6 100644 --- a/modules-available/statistics_reporting/inc/queries.inc.php +++ b/modules-available/statistics_reporting/inc/queries.inc.php @@ -64,7 +64,7 @@ class Queries // Virtual Machine Data: Name, Number of Usages public static function getVMStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24) { - $res = Database::simpleQuery("SELECT data AS name, COUNT(*) AS 'count' + $res = Database::simpleQuery("SELECT data AS name, MD5(data) AS vmHash, COUNT(*) AS 'count' FROM statistic WHERE typeid='.vmchooser-session-name' AND dateline+data >= $from and dateline <= $to AND ( (@daysDiff := (TO_DAYS(FROM_UNIXTIME(@end := IF(dateline+data > $to, $to, dateline+data), '%y-%m-%d')) - TO_DAYS(FROM_UNIXTIME(@start := IF(dateline < $from, $from, dateline), '%y-%m-%d'))) = 0 |