mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
✨ agent: 统计rclone挂载
This commit is contained in:
parent
a3689236ee
commit
ff15dfbbb8
@ -106,7 +106,7 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
|
||||
- `net_in_speed` 入站网速、`net_out_speed` 出站网速、`net_all_speed` 双向网速、`transfer_in` 入站流量、`transfer_out` 出站流量、`transfer_all` 双向流量
|
||||
- `offline` 离线监控
|
||||
- `load1`、`load5`、`load15` 负载
|
||||
- `process_count` 进程数 *目前取线程数占用资源太多,暂时不支持*
|
||||
- `process_count` 进程数 _目前取线程数占用资源太多,暂时不支持_
|
||||
- `tcp_conn_count`、`udp_conn_count` 连接数
|
||||
- duration:持续秒数,秒数内采样记录 30% 以上触发阈值才会报警(防数据插针)
|
||||
- min/max
|
||||
@ -224,7 +224,7 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
|
||||
<details>
|
||||
<summary>如何禁用网络连接数监控?</summary>
|
||||
|
||||
编辑 `/etc/systemd/system/nezha-agent.service`,在 `ExecStart=` 这一行的末尾加上 `-kconn` 就是不监控连接数
|
||||
编辑 `/etc/systemd/system/nezha-agent.service`,在 `ExecStart=` 这一行的末尾加上 `--skip-conn` 就是不监控连接数
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
@ -21,6 +20,7 @@ import (
|
||||
"github.com/go-ping/ping"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/p14yground/go-github-selfupdate/selfupdate"
|
||||
flag "github.com/spf13/pflag"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/naiba/nezha/cmd/agent/monitor"
|
||||
@ -35,6 +35,7 @@ import (
|
||||
func init() {
|
||||
cert.TimeoutSeconds = 30
|
||||
http.DefaultClient.Timeout = time.Second * 5
|
||||
flag.CommandLine.ParseErrorsWhitelist.UnknownFlags = true
|
||||
}
|
||||
|
||||
var (
|
||||
@ -67,14 +68,13 @@ func main() {
|
||||
// 来自于 GoReleaser 的版本号
|
||||
monitor.Version = version
|
||||
|
||||
flag.String("i", "", "unused 旧Agent配置兼容")
|
||||
flag.BoolVar(&debug, "d", false, "开启调试信息")
|
||||
flag.StringVar(&server, "s", "localhost:5555", "管理面板RPC端口")
|
||||
flag.StringVar(&clientSecret, "p", "", "Agent连接Secret")
|
||||
flag.BoolVar(&stateConf.SkipConnectionCount, "kconn", false, "不监控连接数")
|
||||
flag.BoolVarP(&debug, "debug", "d", false, "开启调试信息")
|
||||
flag.StringVarP(&server, "*server", "s", "localhost:5555", "管理面板RPC端口")
|
||||
flag.StringVarP(&clientSecret, "password", "p", "", "Agent连接Secret")
|
||||
flag.BoolVar(&stateConf.SkipConnectionCount, "skip-conn", false, "不监控连接数")
|
||||
flag.Parse()
|
||||
|
||||
if server == "" || clientSecret == "" {
|
||||
if clientSecret == "" {
|
||||
flag.Usage()
|
||||
return
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ import (
|
||||
var Version string = "debug"
|
||||
var netInSpeed, netOutSpeed, netInTransfer, netOutTransfer, lastUpdate uint64
|
||||
var expectDiskFsTypes = []string{
|
||||
"apfs", "ext4", "ext3", "ext2", "f2fs", "reiserfs", "jfs", "btrfs", "fuseblk", "zfs", "simfs", "ntfs", "fat32", "exfat", "xfs",
|
||||
"apfs", "ext4", "ext3", "ext2", "f2fs", "reiserfs", "jfs", "btrfs",
|
||||
"fuseblk", "zfs", "simfs", "ntfs", "fat32", "exfat", "xfs", "fuse.rclone",
|
||||
}
|
||||
var excludeNetInterfaces = []string{
|
||||
"lo", "tun", "docker", "veth", "br-", "vmbr", "vnet", "kube",
|
||||
|
1
go.mod
1
go.mod
@ -25,6 +25,7 @@ require (
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/shirou/gopsutil/v3 v3.21.7
|
||||
github.com/spf13/pflag v1.0.3
|
||||
github.com/spf13/viper v1.7.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
|
||||
|
Loading…
Reference in New Issue
Block a user