V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
通过以下 Referral 链接购买 DigitalOcean 主机,你将可以帮助 V2EX 持续发展
DigitalOcean - SSD Cloud Servers
bacon159
V2EX  ›  VPS

[TrafficCop 大更新] 支持 TG 推送!

  •  
  •   bacon159 · 2 天前 · 153 次点击

    项目地址: https://github.com/ypq123456789/TrafficCop 项目前贴: [ TrafficCop ] 监控 VPS 流量使用,到达限制自动限流,保留 SSH 端口可用

    昨晚有坛友提了这个需求,我想想也是,这个需求应该大伙们都需要。所以,肝了昨天一个晚上加今天一天,调试出了这个功能。此中辛苦,不足为外人道也。不多说了,求点赞!求给项目点个 star !愿意赞助的可以看看项目 readme 最后。 目前我暂时使用没啥问题,大伙们多测试使用下。

    Telegram Bot 集成

    TrafficCop 现在集成了 Telegram Bot 功能,可以发送以下通知:

    • 限速警告
    • 限速解除通知
    • 新周期开始通知
    • 关机警告
    • 每日流量报告

    要使用此功能,请在脚本配置过程中提供你的 Telegram Bot Token 和 Chat ID 。

    Telegram Bot Token 在你创建机器人时会显示。

    Chat ID 获取方法: https://api.telegram.org/bot${BOT_TOKEN}/getUpdates

    ${BOT_TOKEN}是你的 Telegram Bot Token

    坛友提醒:chatid 还可以找 bot 获取, 更简单, 比如username_to_id_bot

    支持自定义主机名,一个机器人就可以统一管理你的所有小鸡!

    相关命令

    一键推送脚本

    curl -H "Accept: application/vnd.github.v3.raw" -fsSL "https://api.github.com/repos/ypq123456789/TrafficCop/contents/tg_notifier.sh" | tr -d '\r' > /root/tg_notifier.sh && chmod +x /root/tg_notifier.sh && bash /root/tg_notifier.sh
    

    查看 tg 推送定时执行日志

    tail -f -n 30 /root/tg_notifier_cron.log
    

    查看当前状态

    tail -f -n 30 /tmp/last_traffic_notification
    

    杀死所有 TG 推送进程

    pkill -f tg_notifier.sh && crontab -l | grep -v "tg_notifier.sh" | crontab -
    

    推送示意如下: image

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1964 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 00:49 · PVG 08:49 · LAX 17:49 · JFK 20:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.