EBOOZ / TeamsStatus

Monitoring your Microsoft Teams status with PowerShell
202 stars 40 forks source link

Improve performance / reduce CPU load and disk IO #38

Open andreasbrett opened 3 years ago

andreasbrett commented 3 years ago

Tail'ing the last 1000 lines twice every second results in unnecessary CPU load and disk I/O. I changed this to use the -Wait feature of Get-Content. Could shave down CPU usage from 3-4% to 0-1%.

First run will fetch the last 1000 lines of the Teams logfile and process them. After that Get-Content will monitor the file for changes and only report those to the subsequent Scriptblock.

jimmyeao commented 3 years ago

nice, running this and it works well

vmax77 commented 2 years ago

This is really nice. I seem to get an error when I use the script from this commit. Any idea what I might be doing wrong?

image

andreasbrett commented 2 years ago

This is really nice. I seem to get an error when I use the script from this commit. Any idea what I might be doing wrong?

image

Sorry, I can't help here. I'm not using this script as a service as that is not permitted on my work laptop (for good reasons).

felipecrs commented 2 years ago

I'm using as a service and it's working for me just fine. I would advise to merge this, as it brings major benefits.

vmax77 commented 2 years ago

I fixed it with changing the ENV var back to full path, and then it works

chriscolden commented 2 years ago

im using this as a service with the full path not env and its working great.

AntoineGS commented 2 years ago

Since this project seems abandoned I've created a copy here: https://github.com/AntoineGS/TeamsStatusV2 I have merged your PR in it already!