2020-10-02 21:18:08 +02:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
|
2020-10-05 19:07:09 +02:00
|
|
|
"github.com/owncast/owncast/metrics"
|
2020-11-15 03:39:53 +01:00
|
|
|
log "github.com/sirupsen/logrus"
|
2020-10-02 21:18:08 +02:00
|
|
|
)
|
|
|
|
|
2020-11-13 00:14:59 +01:00
|
|
|
// GetHardwareStats will return hardware utilization over time.
|
2020-10-02 21:18:08 +02:00
|
|
|
func GetHardwareStats(w http.ResponseWriter, r *http.Request) {
|
2022-03-17 01:34:44 +01:00
|
|
|
m := metrics.GetMetrics()
|
2020-10-02 21:18:08 +02:00
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
2020-11-15 03:39:53 +01:00
|
|
|
err := json.NewEncoder(w).Encode(m)
|
|
|
|
if err != nil {
|
|
|
|
log.Errorln(err)
|
|
|
|
}
|
2020-10-02 21:18:08 +02:00
|
|
|
}
|