Files
oneuptime/InfrastructureAgent/utils/hostname.go
Simon Larsen 0de8e2d818 chore: Add hostname to server monitor report
This commit adds the hostname field to the server monitor report in order to include the hostname of the server in the collected metrics. This information is useful for identifying and distinguishing between different servers in the monitoring system.
2024-07-02 13:04:02 +01:00

17 lines
203 B
Go

package utils
import (
"log/slog"
"os"
)
func GetHostname() string {
hostname, err := os.Hostname()
if err != nil {
slog.Error("Failed to fetch hostname", err)
return ""
}
return hostname
}