You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rition/rition-probe/main.go

38 lines
1012 B

package main
import (
"flag"
"os"
"rition-probe/client"
"rition-probe/service"
"time"
)
func main() {
// --report '127.0.0.1:22019' --disk_dev nvme0n1 --mount / --net_dev wlp0s20f3 --interval 30
centerServer := flag.String("report", "", "上报中心")
diskDevice := flag.String("disk_dev", "", "监控的硬盘设备")
mount := flag.String("mount", "/", "监控的分区挂载位置")
netInterface := flag.String("net_dev", "", "监控的网卡设备")
interval := flag.Int("interval", 30, "上报间隔,单位为秒")
flag.Parse()
hostname, _ := os.Hostname()
config := service.Config{
ClientConfig: client.Config{
CenterServer: *centerServer,
HostName: hostname,
InstanceId: "5c4928f8-f27a-4ac9-85b4-c2dd03e086ad",
},
MonitorDiskDevice: *diskDevice,
MonitorDiskMountPoint: *mount,
MonitorNetworkInterface: *netInterface,
ReportInterval: time.Duration(*interval) * time.Second,
}
srv := service.NewService(config)
srv.Run()
//srv.Report()
}