Microsoft Teams sous Linux : Push des logs vers Grafana

76 x served & 6 x viewed

J’ai fait un petit script pour envoyer les logs vers Grafana :

mysql -u root -e "CREATE DATABASE TEAMS;"
mysql -u root -e "USE TEAMS;DROP TABLE TEAMS_AUDIT;"
mysql -u root -e "USE TEAMS; CREATE TABLE TEAMS_AUDIT (DATE datetime, duration float, vdiMode int, eventpdclevel int);"
echo "Version 1.0";
mysql -u root -e "USE TEAMS; DELETE FROM TEAMS_AUDIT";

grep "desktop_foreground_duration" ~/.config/Microsoft/Microsoft\ Teams/logs.txt ~/.config/Microsoft/Microsoft\ Teams/old_logs_* | sed 's/:/ /g' | awk '{print $6 "-" $4 "-" $5 " " $7 ":" $8 ":" $9 " " $20 " " $24 " " $26}' | sed 's/,/ /g' | sed 's/Jun/06/g' | sed 's/May/05/g' > /tmp/audit_teams.txt

while read line
do
DATE=$(echo $line | awk '{print $1 " " $2}');
DURATION=$(echo $line | awk '{print $3}');
VDI=$(echo $line | awk '{print $4}');
LEVEL=$(echo $line | awk '{print $5}');
SQL="USE TEAMS; INSERT INTO TEAMS_AUDIT (DATE, duration, vdiMode, eventpdclevel) VALUES ('$DATE',$DURATION,$VDI,$LEVEL);"
#echo $SQL
mysql -u root -e "$SQL"
done < /tmp/audit_teams.txt

echo "Done"

Ensuite sur Grafana il suffit de faire :

– Pour avoir le temps passé (en seconde) par jour :

SELECT
UNIX_TIMESTAMP(date) as time_sec,
SUM(duration) as value
FROM TEAMS_AUDIT
WHERE
$__timeFilter(DATE)
GROUP BY day(date),month(date),year(date)
ORDER BY DATE

-Pour avoir le temps passé (en jours) par jour :

SELECT
  UNIX_TIMESTAMP(date) as time_sec,
  sum(duration)/60/60 as value
FROM TEAMS_AUDIT
WHERE
  $__timeFilter(DATE)
  GROUP BY  day(date),month(date),year(date)
ORDER BY DATE

– Pour avoir le nombre d’activation de la fenetre par jour:

SELECT
UNIX_TIMESTAMP(date) as time_sec,
count(duration) as value
FROM TEAMS_AUDIT
WHERE
$__timeFilter(DATE)
GROUP BY day(date),month(date),year(date)
ORDER BY DATE

 

Microsoft Teams sous Linux : Use emitter.setMaxListeners() to increase limit

62 x served & 22 x viewed

J’ai pu voir dans les logs ( .config/Microsoft/Microsoft Teams/logs/teams-startup.log ) l’erreur suivante :

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 appInitialized listeners added. Use emitter.setMaxListeners() to increase limit

Ma version de Node.js :

$ node -v
v10.21.0

La version de Teams : 1.3.00.5153 ( dans le fichier .config/Microsoft/Microsoft\ Teams/settings.json )

J’ai vu un article sur le sujet : https://www.stefanjudis.com/today-i-learned/nodejs-sends-warnings-when-you-add-too-many-listeners-to-an-event-emitter/ et j’ai donc l’impression que c’est uniquement via le code que l’on fixe le problème.

A suivre.

 

Installation Gotify sous Ubuntu

64 x served & 14 x viewed

Le site officiel : https://gotify.net/ .
Les sources du projet : https://github.com/gotify .

Voici les étapes de l’installation :

$ cd /opt/
$ sudo wget https://github.com/gotify/server/releases/download/v2.0.16/gotify-linux-amd64.zip
$ sudo unzip gotify-linux-amd64.zip
Archive:  gotify-linux-amd64.zip
  inflating: gotify-linux-amd64      
  inflating: LICENSE                 
   creating: licenses/
$ sudo chmod +x gotify-linux-amd64
$ sudo mkdir /etc/gotify
$ sudo vi /etc/gotify/config.yml
server:
  listenaddr: "" # the address to bind on, leave empty to bind on all addresses
  port: 7070 # the port for the http server
$ sudo ./gotify-linux-amd64

Ensuite on se connecte :

http://127.0.0.1:7070/#/login
– Login : admin
– Password : admin

Ubuntu 18 : Slack vs Teams ( CPU et Memory )

76 x served & 8 x viewed

J’ai fait un petit script :

#!/bin/bash    
psrecord --interval 1 --duration 300 --plot slack-tail.png  $(pgrep slack | tail -n 1) &
P1=$!
psrecord --interval 1 --duration 300 --plot teams-tail.png  $(pgrep teams | tail -n 1) &
P2=$!
psrecord --interval 1 --duration 300 --plot slack-head.png  $(pgrep slack | head -n 1) &
P3=$!
psrecord --interval 1 --duration 300 --plot teams-head.png  $(pgrep teams | head -n 1) &
P4=$!
wait $P1 $P2 $P3 $P4 
echo 'Done'

Résultat rapide (car seulement sur 300 secondes ) :

Slack :

Microsoft Teams :

Je vais essayer de faire un script pour faire la somme des process … car j’ai plus de deux process par softs :

$ pgrep slack
2171
7960
7965
7969
8011
8020
$ pgrep teams
7681
7700
7777
7809
7916
8089

Ubuntu : ntfsfix ( chkdsk sous Windows) pour fixer les problèmes NFTS sous Ubuntu.

102 x served & 17 x viewed

Voici un petit exemple pour fixer les problèmes NTFS sous Ubuntu :

$ sudo mount /dev/sdc2 /media/usb-drive/
$MFTMirr does not match $MFT (record 0).
Failed to mount '/dev/sdc2': Input/output error
NTFS is either inconsistent, or there is a hardware fault, or it's a
SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
then reboot into Windows twice. The usage of the /f parameter is very
important! If the device is a SoftRAID/FakeRAID then first activate
it and mount a different device under the /dev/mapper/ directory, (e.g.
/dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
for more details.
$ sudo ntfsfix /dev/sdc2
Mounting volume... $MFTMirr does not match $MFT (record 0).
FAILED
Attempting to correct errors... 
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... FAILED
Correcting differences in $MFTMirr record 0...OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdc2 was processed successfully.
$ sudo mount /dev/sdc2 /media/usb-drive/
$