{"repo":"nodeseeker/netMonitor","free":true,"listed":false,"github":"https://github.com/nodeseeker/netMonitor","clone":"git clone https://github.com/nodeseeker/netMonitor.git","description":"一款基于Golang的Linux流量统计与提醒工具，支持telegram消息和自动关机。","language":"Go","stars":42,"topics":["go","monitoring"],"license":"GPL-3.0","category":"analytics","readme_excerpt":"netMonitor 一款基于Golang的Linux流量统计与提醒工具，支持telegram消息、Gotify消息和自动关机。 依赖： - Linux系统 - root权限 - 一个telegram机器人或Gotify服务器 使用教程 一键安装脚本 使用root权限执行以下命令进行安装： 安装脚本支持以下操作： 1. 删除并重新安装：清除现有的安装并重新安装程序 2. 升级并保留配置文件：只更新程序文件，保留原有的配置 3. 退出安装：取消安装过程 4. 删除NetMonitor：完全移除已安装的程序 消息提醒示例 支持两种消息服务，根据配置选择使用： Telegram示例 Gotify示例 标题和内容分别为： 运行情况示例 程序运行状态通过 systemd status netmonitor 命令查看 程序的运行记录在 /opt/NetMonitor/output.log 中；如果出现运行错误，将储存在 /opt/NetMonitor/error.log 中。 配置文件详解 在 /opt/NetMonitor 文件夹下，使用vim/nano或者任意编辑器，填写下面内容到 config.json 配置文件中。 1. 需要一个设备名称（即 device 对应的名称），用于在发送消息时区别信息来源，以下的示例的名称为 test.example.com 。 2. 使用 ip a 查找需要监控的网卡（即 interface 对应的网卡名称），输出内容示例如下，一般是 lo 下的第一个网卡，名称一般是 eth0 或 enp3s0 之类的，以下示例是 eth0 ： 3. interval 为更新时间，单位为秒，默认每60秒更新一次流量统计信息。 4. start day 是流量的更新时间，有些VPS的销售系统默认月初更新，有的是根据购买时间更新，按照实际情况即可。示例为每月9号更新一次，只需要填写日期，即1-31的某一天。 5. statistics 的子项是以字节 bytes 为单位的流量统计信息，首次配置的时候，将 last reset 改为上次流量充值时间，采用 yyyy-mm-dd 格式，其他项为0，不需要改动。 6. comparison 中的 category 有四个选项： - upload ：单向统计上传流量 - download ：单向统计下载流量 - upload+download ：双向统计总流量 - anymax ：统计上传和下载中的最大值 limit 是设置的流量限制，单位为GB； threshold 是发消息提醒的阈值，以配置为例，当流量达到200×0.85=170GB的时候，会发送消息提醒； ratio 为自动关机的阈值，以配置为例，当流量达到200×0.95=190GB的时候，系统会自动关机，并在关机的前30秒发送关机提醒。 7. message 中有以下配置项: - service : 指定使用的消息服务，可选值为 telegram 或 gotify - telegram : Telegram相关配置 - token : Telegram机器人的API令牌 - chat id : 接收消息的聊天ID - gotify : Gotify相关配置 - url : Gotify服务器地址，如 https://gotify.example.com - app token : Gotify应用程序令牌 其他的选项，默认false即可，会在月周期之后自动重置，不需要手动修改。 配置文件示例： 常见问题 其他CPU架构 纯 golang ","default_branch":null,"files":null,"tree":[],"storefront":"/r/nodeseeker","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/nodeseeker/netMonitor/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}