1package host
2
3import (
4	"encoding/json"
5
6	"github.com/shirou/gopsutil/internal/common"
7)
8
9var invoke common.Invoker = common.Invoke{}
10
11// A HostInfoStat describes the host status.
12// This is not in the psutil but it useful.
13type InfoStat struct {
14	Hostname             string `json:"hostname"`
15	Uptime               uint64 `json:"uptime"`
16	BootTime             uint64 `json:"bootTime"`
17	Procs                uint64 `json:"procs"`           // number of processes
18	OS                   string `json:"os"`              // ex: freebsd, linux
19	Platform             string `json:"platform"`        // ex: ubuntu, linuxmint
20	PlatformFamily       string `json:"platformFamily"`  // ex: debian, rhel
21	PlatformVersion      string `json:"platformVersion"` // version of the complete OS
22	KernelVersion        string `json:"kernelVersion"`   // version of the OS kernel (if available)
23	KernelArch           string `json:"kernelArch"`      // native cpu architecture queried at runtime, as returned by `uname -m` or empty string in case of error
24	VirtualizationSystem string `json:"virtualizationSystem"`
25	VirtualizationRole   string `json:"virtualizationRole"` // guest or host
26	HostID               string `json:"hostid"`             // ex: uuid
27}
28
29type UserStat struct {
30	User     string `json:"user"`
31	Terminal string `json:"terminal"`
32	Host     string `json:"host"`
33	Started  int    `json:"started"`
34}
35
36type TemperatureStat struct {
37	SensorKey   string  `json:"sensorKey"`
38	Temperature float64 `json:"sensorTemperature"`
39}
40
41func (h InfoStat) String() string {
42	s, _ := json.Marshal(h)
43	return string(s)
44}
45
46func (u UserStat) String() string {
47	s, _ := json.Marshal(u)
48	return string(s)
49}
50
51func (t TemperatureStat) String() string {
52	s, _ := json.Marshal(t)
53	return string(s)
54}
55