V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
luckyning
V2EX  ›  分享创造

分享下最近写的 url 监控 项目,监控 web 服务可用性及访问质量,欢迎提 issue 和讨论哈

  •  
  •   luckyning · 2016-08-06 18:54:23 +08:00 · 6257 次点击
    这是一个创建于 3030 天前的主题,其中的信息可能已经有所发展或是发生改变。

    urlooker

    监控 web 服务可用性及访问质量,采用 go 语言编写,易于安装和二次开发,三个组件都支持水平扩展,一台普通机器可以监控 3000+个 url ,瓶颈在 mysql 存储,分表的话可以监控的更多,欢迎试用和提 issue 哈

    Feature

    • 返回状态码检测
    • 页面响应时间检测
    • 页面关键词匹配检测
    • 带 cookie 访问
    • agent 多机房部署,指定机房访问
    • 检测结果支持向 open-falcon 推送
    • 支持短信和邮件告警

    ScreenShot

    看图

    此处输入图片的描述

    添加监控项

    安装及详细介绍见 github :urlooker

    14 条回复    2017-10-10 18:29:12 +08:00
    ovear
        1
    ovear  
       2016-08-06 18:58:13 +08:00
    前排呲呲,刚准备用 golang 撸个的
    mrjoel
        2
    mrjoel  
       2016-08-06 20:03:25 +08:00 via iPhone
    请教一下, url 监控是检测网页每一个资源的可用性,还是只检测 200 返回?
    luckyning
        3
    luckyning  
    OP
       2016-08-06 20:09:21 +08:00
    @mrjoel 每个资源指的是什么?引用的 js 和 img 文件?网页的内容变化可以通过添加关键字匹配来监控
    lhbc
        4
    lhbc  
       2016-08-06 20:09:57 +08:00 via Android
    支持指定 IP 吗?
    比如一个域名,有做多 IP 或者分线路解析,那监控就需要指定 IP 和主机头。
    Tink
        5
    Tink  
       2016-08-06 20:34:03 +08:00
    提个建议,既然有二进制安装就不如直接 docker
    luckyning
        6
    luckyning  
    OP
       2016-08-06 20:34:52 +08:00
    @lhbc 支持的,探测都是通过 ip 去访问的, web 组件提供了一个接口和自定义函数,可以自定义域名指向的 IP
    luckyning
        7
    luckyning  
    OP
       2016-08-06 20:37:07 +08:00
    @Tink 多谢提醒,回头搞一个 docker 版本的
    Tink
        8
    Tink  
       2016-08-06 23:06:40 +08:00
    @luckyning 另外二进制文件貌似只有 64 位的
    234747005
        9
    234747005  
       2016-08-11 15:51:11 +08:00   ❤️ 1
    不行啊,执行导入 schema.sql 数据库报错
    mysql -u root -p < schema.sql
    ERROR 1046 (3D000) at line 3: No database selected
    然后再执行一次。
    ERROR 1007 (HY000) at line 1: Can't create database 'urlooker'; database exists
    luckyning
        10
    luckyning  
    OP
       2016-08-11 23:18:31 +08:00   ❤️ 1
    @234747005 多谢提醒, sql 文件中少了 use urlooker 已修复: )
    234747005
        11
    234747005  
       2016-08-12 11:55:33 +08:00
    @luckyning 测试过了,新的 schema.sql 顺利导入,没有错误。
    234747005
        12
    234747005  
       2016-08-12 13:23:08 +08:00
    @luckyning
    系统用的是阿里云的 centos 6.5 64 位,刚装好系统就,
    yum update -y
    yum install -y mysql-server redis git go
    然后开始执行,
    在安装 web 的时候,执行到这步,报错。
    怎么样可以联系到你呢?我很想用这个 urlooker
    mkdir -p $GOPATH/src/github.com/urlooker
    cd $GOPATH/src/github.com/urlooker
    git clone https://github.com/URLooker/web.git
    cd web
    go get ./...
    package github.com/urlooker/web/api: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/cron: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/g: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/http: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/http/cookie: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/sender: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/store: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/model: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/utils: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/toolkits/file: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/gorilla/mux: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/toolkits/str: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/toolkits/web: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/http/errors: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/http/param: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/http/render: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/codegangsta/negroni: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/handler: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/http/middleware: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/gorilla/securecookie: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/gorilla/context: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/unrolled/render: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/http/helper: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/go-xorm/xorm: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/toolkits/container/list: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/urlooker/web/backend: cannot download, $GOPATH not set. For more details see: go help gopath
    package stathat.com/c/consistent: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/go-sql-driver/mysql: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/astaxie/beego/httplib: cannot download, $GOPATH not set. For more details see: go help gopath
    package github.com/miekg/dns: cannot download, $GOPATH not set. For more details see: go help gopath
    234747005
        13
    234747005  
       2016-08-12 16:26:59 +08:00
    @luckyning 上面的错误我发现是我的 go 语言环境变量问题,设置好环境变量之后,执行
    go get ./... 有新的错误。
    package stathat.com/c/consistent: unrecognized import path "stathat.com/c/consistent"

    ./control build
    sender/ring.go:4:2: cannot find package "stathat.com/c/consistent" in any of:
    /root/go/src/stathat.com/c/consistent (from $GOROOT)
    /root/gopath/src/stathat.com/c/consistent (from $GOPATH)
    mcdona1d
        14
    mcdona1d  
       2017-10-10 18:29:12 +08:00
    请教一下,这个 url 检测的语法是什么,没有找到相关的说明,
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1501 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 17:14 · PVG 01:14 · LAX 09:14 · JFK 12:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.