Add CPU monitoring to stream health overview
This commit is contained in:
parent
83cec52104
commit
35801ff33a
@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/owncast/owncast/core/data"
|
||||
"github.com/owncast/owncast/models"
|
||||
"github.com/owncast/owncast/utils"
|
||||
)
|
||||
|
||||
var errorMessages = map[string]string{
|
||||
@ -85,6 +86,19 @@ func generateStreamHealthOverview() {
|
||||
}
|
||||
}
|
||||
|
||||
// Report high CPU use.
|
||||
if unhealthyClientCount == 0 && len(metrics.CPUUtilizations) > 2 {
|
||||
recentCPUUses := metrics.CPUUtilizations[len(metrics.CPUUtilizations)-2:]
|
||||
values := make([]float64, len(recentCPUUses))
|
||||
for i, val := range recentCPUUses {
|
||||
values[i] = val.Value
|
||||
}
|
||||
recentCPUUse := utils.Avg(values)
|
||||
if recentCPUUse > 90 {
|
||||
overview.Message = "The CPU usage on your server is over 90%. This may cause video to be provided slower than necessarily, causing buffering for your viewers. Consider increasing the resources available or reducing the number of output variants you made available."
|
||||
}
|
||||
}
|
||||
|
||||
if unhealthyClientCount == 0 {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user