Hi,
I just tried out.
When I run “kopano-stats --top” I realize following:
the column APP shows for most of our users OUTLOOK.EXE// but they are not using Outlook. This seems to be a wrong detection?
you can only see as much lines as the height of your display permits. All other below are cut and not shown. Sorting with a-h does not help either.
==> this command seems not helpful for this task.
By using “kopano-stats --session --dump” I get a quite helpful output. I modified the command and ended up into:
kopano-stats --session --dump | grep -v SYSTEM |awk -F';' '!a[$7]++ {if (NR!=1) print $7}' |sort -u |uniq |tee >(wc -l)
which will output all currently logged in users and outputs also the number of total users at the end of the output (just 4 ensuring the output is correct)
Going further, I modified this one-liner and I run the command each 5min on my Kopano-server by a cron job.
$ crontab -l
*/5 * * * * /usr/local/bin/kopano-getUserSessions.sh
It will get the total numbers of Kopano user sessions and write them into a logfile.
$ cat /usr/local/bin/kopano-getUserSessions.sh
#!/bin/bash
out=/var/log/kopano/minmax-users.log
kopano-stats --session --dump | grep -v SYSTEM |awk -F';' '!a[$7]++ {if (NR!=1) print $7}' |sort -u |uniq |wc -l >>$out
The following perl program does read all the lines of the previous mentioned log file and output the min/max values.
$ cat /usr/local/bin/kopano-MinMaxUsers.pl
#!/usr/bin/perl
$min = 999;
$max = 0;
while (<>) {
$max = $_ if ($_ > $max);
$min = $_ if ($_ < $min);
}
print "Kopano user sessions:\n=====================\nMIN=$min\nMAX=$max";
Whenever I want to read the min/max values of this log file I just execute this command
kopano-MinMaxUsers.pl /var/log/kopano/minmax-users.log
and the output is something like:
Kopano user sessions:
=====================
MIN=18
MAX=62
Thank you all.