ops-agent

command module
v0.0.0-...-7be6626 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

ops-agent

基于open-falcon二次开发的linux监控客户端

特性

  • 代码重构、移除无用的接口和配置信息;
  • 重写url metric的probeUrl方法, 使用go http库替代使用系统curl命令来探测url;
  • 重写/plugin/update接口, 使用go-git库替代使用系统的git命令来更新插件仓库;
  • 新增从私有git仓库同步插件功能;
  • 新增运行日志配置, 支持日志滚动;
  • 新增/metrics接口, 支持查看当前监控的所有metric;
  • 新增/metric/check接口, 支持查看当前系统metric依赖环境;
  • 新增cpu核心绑定、内存阈值配置; 当agent内存达到阈值的50%时, 打印告警信息;当内存达到阈值的100%, 程序直接退出;

编译

it is a golang classic project

cd $GOPATH/src/github.com/fanghongbo/ops-agent/
./control build
./control start

配置

Refer to cfg.example.json, modify the file name to cfg.json :

{
  "debug": false,
  "hostname": "",
  "ip": "",
  "log": {
    "log_level": "INFO",
    "log_path": "./logs",
    "log_file_name": "run.log",
    "log_keep_hours": 3
  },
  "plugin": {
    "enabled": true,
    "dir": "./plugin",
    "git": "https://github.com/open-falcon/plugin.git",
    "username": "",
    "password": "",
    "logs": "./logs"
  },
  "heartbeat": {
    "enabled": true,
    "addr": "127.0.0.1:6030",
    "interval": 60,
    "timeout": 1000
  },
  "transfer": {
    "enabled": true,
    "addrs": [
      "127.0.0.1:8433"
    ],
    "interval": 60,
    "timeout": 1000
  },
  "http": {
    "enabled": true,
    "listen": ":1988"
  },
  "collector": {
    "ifacePrefix": [
      "eth",
      "em",
      "ens"
    ],
    "mountPoint": []
  },
  "default_tags": {
  },
  "ignore": {
    "cpu.busy": true,
    "df.bytes.free": true,
    "df.bytes.total": true,
    "df.bytes.used": true,
    "df.bytes.used.percent": true,
    "df.inodes.total": true,
    "df.inodes.free": true,
    "df.inodes.used": true,
    "df.inodes.used.percent": true,
    "mem.memtotal": true,
    "mem.memused": true,
    "mem.memused.percent": true,
    "mem.memfree": true,
    "mem.swaptotal": true,
    "mem.swapused": true,
    "mem.swapfree": true
  },
  "max_cpu_rate": 0.2,
  "max_mem_rate": 0.3
}

License

This software is licensed under the Apache License. See the LICENSE file in the top distribution directory for the full license text.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
common
cmd
g
git
rpc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL