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