/
cpus.go
49 lines (42 loc) · 1014 Bytes
/
cpus.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"github.com/spf13/cobra"
)
// cpuCmd represents the cpu command
var (
perCPU bool
cpusCmd = &cobra.Command{
Use: "cpus",
Short: "checks cpu values of the target",
Long: `checks the return values of the agent from the cpu endpoint
example output from the agent with perCPU = false:
[
{
"cpu": "cpu-total",
"user": 94.32,
"system": 76.49,
"idle": 17205.19,
"nice": 0.17,
"iowait": 18.29,
"irq": 0,
"softirq": 33.28,
"steal": 0,
"guest": 0,
"guestNice": 0
}
]
Now you can check if you have enough cpu resources available with the cpuusage command or check the load on unix systems with the load command
./monitoring-agent cpus usage --help
./monitoring-agent cpus load --help`,
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
)
func init() {
RootCmd.AddCommand(cpusCmd)
cpusCmd.PersistentFlags().BoolVar(&perCPU, "perCPU", false, "")
}