Giter VIP home page Giter VIP logo

satori's Introduction

介绍

Satori 是一个由 LeanCloud 维护的监控系统。

起初在 LeanCloud 内部是直接使用了 Open-Falcon 。 后续的使用过程中因为自己的需求开始做修改,形成的现在的这样的结构。

截图

Nodes Events BitBar

文档

完整文档麻烦看这里

交流

如果你有什么建议,欢迎在 issue 里面说一下。 也有 QQ 群可以参与讨论:554765935

怎么安装?

请找一个干净的虚拟机,内存大一点,要有 SSD,不要部署其他的服务。 LeanCloud 用了一个 2 cores, 8GB 的内存的 VM,目测这个配置可以撑住大概 2000 个左右的节点(InfluxDB 查询不多的情况下)。

执行下面的命令:

$ git clone https://github.com/leancloud/satori
$ cd satori/satori
$ ./install

satori 子目录中有一个 install 脚本,以一个可以 ssh 并且 sudo 的用户执行它就可以了。 不要用 root,因为安装后会以当前用户的身份配置规则仓库。

install 时会问你几个问题,填好以后会自动的生成配置,build 出 docker image 并启动。这之后设置好DNS和防火墙就可以用了。 在仓库的第一层会有编译好的 satori-agentagent-cfg.json 可以用来部署,命令行如下:

/usr/bin/satori-agent -c /etc/satori-agent/agent-cfg.json

agent 不会自己 daemonize,如果用了传统的 /etc/init.d 脚本的方式部署,需要注意这个问题。

如果需要无人工干预安装,请创建一个配置文件:

USE_MIRROR=1  # 或者留空,是否使用国内的镜像
DOMAIN="www.example.com"  # 外网可以访问的域名
INTERNAL_DOMAIN="satori01"  # 内网可以访问的域名
RULES_REPO="/home/app/satori-conf"  # 规则仓库的地址
RULES_REPO_SSH="[email protected]:/home/app/satori-conf"  # 外网可以访问的 git 仓库地址

保存为 /tmp/install.conf

然后执行:

$ git clone https://github.com/leancloud/satori
$ cd satori/satori
$ ./install -f /tmp/install.conf

设计思路

  • Satori 希望最大程度的减少监控系统的部署维护难度。如果在任何的部署、增删维护报警的时候觉得好麻烦,那么这是个 bug。
  • 监控时的需求很多样,Satori 希望做到『让简单的事情简单,让复杂的事情可能』。常用的监控项都会有模板,可以用 Copy & Paste 解决。略复杂的监控需求可以阅读 riemann 的文档,来得知怎么编写复杂的监控规则。
  • 因为 LeanCloud 的机器规模不大,另外再加上现在机器的性能也足够强劲了,所以放弃了 Open-Falcon 中横向扩展目标。如果你的机器数量或者指标数目确实很大,可以将 transfer、 InfluxDB、 riemann 分开部署。这样的结构支撑 5k 左右的节点应该是没问题的。
  • 在考察了原有的 Open-Falcon 的架构后,发现实质上高可用只有 transfer 实现了,graph、judge 任何一个实例挂掉都会影响可用性。对于 graph,如果一个实例挂掉的话,还必须要将那个节点恢复,不能通过新加节点改配置的方式来恢复;judge 尽管可以起新节点,但是还是要依赖外部的工具来实现 failover,否则是需要修改 transfer 的配置的。因此 Satori 中坚持用单点的方式来部署,然后通过配合公网提供的 APM 服务保证可用性。真的希望有高可用的话,riemann 和 alarm 可以部署两份,通过 keepalived 的方式来实现,InfluxDB 可以官方的 Relay 来实现。

1 minute taste

简单需求(通用模板,Copy & Paste 改参数可以实现)

完整版请看 satori-rules/rules/infra/mongodb.clj

(def infra-mongodb-rules
  ; 在 mongo1 mongo2 mongo3 ... 上做监控
  (where (host #"^mongo\d+")

    ; 执行 mongodb 目录里的插件(里面有收集 mongodb 指标的脚本)
    (plugin-dir "mongodb")

    ; 每 30s 收集 27018 端口是不是在监听
    (plugin "net.port.listen" 30 {:port 27018})

    ; 过滤一下 mongodb 可用连接数的 metric(上面插件收集的)
    (where (service "mongodb.connections.available")
      ; 按照 host(插件中是 endpoint)分离监控项,并分别判定
      (by :host
        ; 报警在监控值 < 10000 时触发,在 > 50000 时恢复
        (set-state-gapped (< 10000) (> 50000)
          ; 600 秒内只报告一次
          (should-alarm-every 600
            ; 报告的标题、级别(影响报警方式)、报告给 operation 组和 api 组
            (! {:note "mongod 可用连接数 < 10000 !"
                :level 1
                :groups [:operation :api]})))))

    ; 另一个监控项
    (where (service "mongodb.globalLock.currentQueue.total")
      (by :host
        (set-state-gapped (> 250) (< 50)
          (should-alarm-every 600
            (! {:note "MongoDB 队列长度 > 250"
                :level 1
                :groups [:operation :api]})))))))
cd /path/to/rules/repo  # 规则是放在 git 仓库中的
git commit -a -m 'Add mongodb rules'
git push  # 然后就生效了

复杂需求

这是一个监控队列堆积的规则。 队列做过 sharding,分布在多个机器上。 但是有好几个数据中心,要分别报告每个数据中心队列情况。 堆积的定义是:在一定时间内,队列非空,而且队列元素数量没有下降。

提示:这是一个简化了的版本,完整版可以看 satori-rules/rules/infra/kestrel.clj

(def infra-kestrel-rules
 ; 在所有的队列机器上做监控
 (where (host #"kestrel\d+$")
  ; 执行队列相关的监控脚本(插件)
  (plugin-dir "kestrel")

  ; 过滤『队列项目数量』的 metric
  (where (service "kestrel_queue.items")
   ; 按照队列名和数据中心分离监控项,并分别判定
   (by [:queue :region]
    ; 将传递下来的监控项暂存 60 秒,然后打包(变成监控项的数组)再向下传递
    (fixed-time-window 60
     ; 将打包传递下来的监控项做聚集:将所有的 metric 值都加起来。
     ; 因为队列监控的插件是每 60 秒报告一次,并且之前已经按照队列名和数据中心分成子流了,
     ; 所以这里将所有 metric 都加起来以后,获得的是单个数据中心单个队列的项目数量。
     ; 聚集后会由监控项数组变成单个的监控项。
     (aggregate +
      ; 将传递下来的聚集后的监控项放到滑动窗口里,打包向下传递。
      ; 这样传递下去的,就是一个过去 600 秒单个数据中心单个队列的项目数量的监控项数组。
      (moving-event-window 10
       ; 如果已经集满了 10 个,而且这 10 个监控项中都不为 0 (队列非空)
       (where (and (>= (count event) 10)
                   (every? pos? (map :metric event)))
        ; 再次做聚集:比较一下是不是全部 10 个数量都是先来的小于等于后来的(是不是堆积)
        (aggregate <=
         ; 如果结果是 true,那么认为现在是有问题的
         (set-state (= true)
          ; 每 1800 秒告警一次
          (should-alarm-every 1800
           ; 这里 outstanding-tags 是用来区分报警的,
           ; 即如果 region 的值不一样,那么就会被当做不同的报警
           (! {:note #(str "队列 " (:queue %) " 正在堆积!")
               :level 2
               :outstanding-tags [:region]
               :groups [:operation]}))))))))))))

架构

Architecture

与 Open-Falcon 的区别

agent

  • 支持按照正则表达式排除 metric(用例:排除 docker 引入的奇怪的挂载,netns 什么的)
  • 支持从 agent 上附加固定的 tag(用例:region=cn-west)
  • 支持自主的插件更新
  • 支持带参数的插件
  • 支持持续执行(long running)的插件
  • 去除了 push 和 plugin 以外的所有 http 接口
  • 去掉了单机部署的功能,现在强制要求指定一个 transfer 组件
  • 不兼容 open-falcon 的 heartbeat
  • 因为修改了 metric 的数据结构,与 open-falcon 的 transfer 不兼容

transfer:

  • 支持发送到 influxdb(使用了 hitripod 的补丁)
  • 支持发送到 riemann
  • 支持发送到 transfer(gateway 功能集成)
  • 不再支持发送到 graph 和 judge
  • 重构了发送端的代码,现在代码比之前容易维护了

alarm:

  • 弃用了 open-falcon 的 alarm,完全重写
  • 不支持报警合并
  • 支持 EVENT 类型(只报警不记录状态)
  • 支持多种报警后端(电话、短信、BearyChat、OneAlert、PagerDuty、邮件、微信企业号),并且易于扩展
  • Mac 下有好用的 BitBar 插件

sender

集成进了 alarm 中。

links

在 Satori 中移除了。推荐直接使用低优先级的通道(如 BearyChat/其他IM,或者 BitBar),不做报警合并。

graph & query & dashboard

被 Grafana 和 InfluxDB 代替

judge:

  • 被 riemann 代替
  • riemann 较 judge 相比,可以节省 60% 以上的内存,CPU占用要低 50%。

task

在 Satori 中移除了。InfluxDB 自带 task 的功能。

aggregator

在 Satori 中移除了。riemann 中可以轻松的实现 aggregator 的功能。

nodata

在 Satori 中移除了。可以参见规则中的 feed-dog 和 watchdog,实现了相同的功能。

portal

在 Satori 中移除了。报警规则通过 git 仓库管理。

gateway:

合并进了 transfer

hbs

  • 在 Satori 中叫做 master
  • 与 hbs 不兼容
  • 不再将节点数据记录到数据库中,没有数据库的依赖。

uic

Satori 中去除,直接在规则仓库中编辑用户信息。

fe

完全重写,采用了纯前端的方案(frontend 文件夹)。

satori's People

Contributors

feisuzhu avatar jasonyy77 avatar kadashu avatar ym avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

satori's Issues

移植 swcollector

open-falcon是使用 swcollector 来实现交换机监控的 ,不知道这个是否也可以使用 swcollector 来做交换机监控

riemann reload 的时候各种 window 会有问题

image

image
我想在 (->diff 的后面 加个判断. diff 之后的 metric > 0 的值 需占用 count diff event 的一半 才往下流...
好烦呀~~ 每次修改报警 git pull 触发 reloader 后 总是会有类似 这种情况... 其实这个 metric counter 并没有增长 你看它之前的差值都是0. 不知为何最后一个差值突然变成 counter 本身 减去 上一个 差值了..... 所以我想避免这种情况.. 否则每次改规则都会几十次甚至百次的误报警.....

部署alarm时候失败

---> Running in 94a6e9d2c594
Creating directory '/alarm/eggs'.
Creating directory '/alarm/bin'.
Creating directory '/alarm/parts'.
Creating directory '/alarm/develop-eggs'.
Develop: '/alarm/.'
Getting distribution for 'zc.recipe.egg>=2.0.0a3'.
Got zc.recipe.egg 2.0.3.
Getting distribution for 'pbp.recipe.noserunner'.
Got pbp.recipe.noserunner 0.2.6.
Getting distribution for 'nose'.
no previously-included directories found matching 'doc/.build'
Got nose 1.3.7.
Getting distribution for 'plone.recipe.command'.
Got plone.recipe.command 1.1.
Installing app.
Getting distribution for 'ipython'.
error: Setup script exited with error in ipython setup command: Invalid environment marker: sys_platform == "win32" and python_version < "3.6"
An error occurred when trying to install /tmp/tmpDqu6PPget_dist/ipython-5.3.0.tar.gz. Look above this message for any errors that were output by easy_install.
While:
Installing app.
Getting distribution for 'ipython'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/zc.buildout-2.9.2-py2.7.egg/zc/buildout/buildout.py", line 1982, in main
getattr(buildout, command)(args)
File "/usr/local/lib/python2.7/dist-packages/zc.buildout-2.9.2-py2.7.egg/zc/buildout/buildout.py", line 668, in install
installed_files = self[part]._call(recipe.install)
File "/usr/local/lib/python2.7/dist-packages/zc.buildout-2.9.2-py2.7.egg/zc/buildout/buildout.py", line 1419, in _call
return f()
File "/alarm/eggs/zc.recipe.egg-2.0.3-py2.7.egg/zc/recipe/egg/egg.py", line 126, in install
reqs, ws = self.working_set()
File "/alarm/eggs/zc.recipe.egg-2.0.3-py2.7.egg/zc/recipe/egg/egg.py", line 84, in working_set
allow_hosts=self.allow_hosts)
File "/usr/local/lib/python2.7/dist-packages/zc.buildout-2.9.2-py2.7.egg/zc/buildout/easy_install.py", line 913, in install
return installer.install(specs, working_set)
File "/usr/local/lib/python2.7/dist-packages/zc.buildout-2.9.2-py2.7.egg/zc/buildout/easy_install.py", line 665, in install
for dist in self._get_dist(requirement, ws):
File "/usr/local/lib/python2.7/dist-packages/zc.buildout-2.9.2-py2.7.egg/zc/buildout/easy_install.py", line 563, in _get_dist
dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
File "/usr/local/lib/python2.7/dist-packages/zc.buildout-2.9.2-py2.7.egg/zc/buildout/easy_install.py", line 1699, in _move_to_eggs_dir_and_compile
[tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: need more than 0 values to unpack
ERROR: Service 'alarm' failed to build: The command '/bin/sh -c cd /alarm && buildout' returned a non-zero code: 1

agent 支持持续运行的 metric 收集插件

现在的插件都是每一次收集都去执行一下相应的脚本。
有些收集脚本需要在内部保存状态,这个现在的模式就很难处理。
之后需要支持持续运行的脚本,脚本进程不停止,持续向 agent 输出 metric。

Failed to install on Rhel 7.3 - Unable to find image 'daocloud.io/golang:wheezy' locally

Dear,
I got a message blow, could you help me?
:: Preparing docker images
:: - Copy alarm to build dir
:: - Copy frontend to build dir
:: - Build golang executables
Unable to find image 'daocloud.io/golang:wheezy' locally
docker: Error response from daemon: Get https://daocloud.io/v1/_ping: dial tcp: lookup daocloud.io on [::1]:53: read udp [::1]:43387->[::1]:53: read: connection refused.
See 'docker run --help'.

Riemann 增加占比统计

  • 问题描述
    汇报metric 是关于 Nginx response time 相关. 按照时间区间从100ms 以下 到 10s 以上 分为9组. 如: lt.100ms, 100ms-300ms, 300ms-500ms, 500ms-800ms, .......
    我希望能够获取最近5分钟平均每分钟当响应时间在1s 以上的请求量占当前请求总量的5% 的时候报警.
    希望函数可动态传入多值:
    如: perct("1s.3s", "3s.5s", "5s-8s") 则计算 1s-8s 的所有请求占用总请求比例.

3ks

install时error,请问怎么解决?

Installing collected packages: pip, six, pyparsing, packaging, appdirs, setuptools, wheel
Found existing installation: six 1.8.0
Uninstalling six-1.8.0:
Exception:
Traceback (most recent call last):
File "/tmp/tmpdVDOcH/pip.zip/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/tmp/tmpdVDOcH/pip.zip/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/tmp/tmpdVDOcH/pip.zip/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/tmp/tmpdVDOcH/pip.zip/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/tmp/tmpdVDOcH/pip.zip/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/tmp/tmpdVDOcH/pip.zip/pip/utils/init.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib/python2.7/shutil.py", line 300, in move
rmtree(src)
File "/usr/lib/python2.7/shutil.py", line 256, in rmtree
onerror(os.rmdir, path, sys.exc_info())
File "/usr/lib/python2.7/shutil.py", line 254, in rmtree
os.rmdir(path)
OSError: [Errno 39] Directory not empty: '/usr/lib/python2.7/dist-packages/six-1.8.0.egg-info'
ERROR: Service 'alarm' failed to build: The command '/bin/sh -c python /alarm/get-pip.py' returned a non-zero code: 2

执行了install,输出有点错误

现在nginx访问页面打得开.似乎安装好了.

Got pyaml 17.8.0.                                                                                                                                                     
Getting distribution for 'redis'.                                                                                                                                     
warning: no previously-included files found matching '__pycache__'                                                                                                    
warning: no previously-included files matching '*.pyc' found under directory 'tests'                                                                                  
zip_safe flag not set; analyzing archive contents...                                                                                                                  
Got redis 2.10.6.                                                                                                                                                     
Getting distribution for 'gevent'.                                                                                                                                    
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'cffi_modules'                                                                    
  warnings.warn(msg)                                                                                                                                                  
warning: no files found matching 'changelog.rst'                                                                                                                      
warning: no files found matching 'known_failures.py'                                                                                                                  
warning: no files found matching '.pep8'                                                                                                                              
no previously-included directories found matching '*/__pycache__'                                                                                                     
warning: no previously-included files matching '*.so' found anywhere in distribution                                                                                  
warning: no previously-included files matching '*.o' found anywhere in distribution                                                                                   
warning: no previously-included files matching '*.lo' found anywhere in distribution                                                                                  
warning: no previously-included files matching '*.la' found anywhere in distribution                                                                                  
warning: no previously-included files matching 'config.log' found anywhere in distribution                                                                            
warning: no previously-included files matching 'config.status' found anywhere in distribution                                                                         
no previously-included directories found matching 'doc/_build'                                                                                                        
warning: no previously-included files matching '*.pyc' found anywhere in distribution                                                                                 
warning: no previously-included files matching '.coverage' found under directory 'src/greentest'                                                                      
no previously-included directories found matching 'src/greentest/htmlcov'                                                                                             
warning: no previously-included files matching 'stamp-h?' found under directory 'deps/c-ares'                                                                         
warning: no previously-included files matching 'ares_build.h.orig' found under directory 'deps/c-ares'                                                                
no previously-included directories found matching 'deps/libev/.deps'                                                                                                  
warning: no previously-included files matching 'Makefile' found under directory 'deps/libev'                                                                          
warning: no previously-included files matching 'libtool' found under directory 'deps/libev'                                                                           
warning: no previously-included files matching 'stamp-h?' found under directory 'deps/libev'                                                                          
warning: no previously-included files matching 'config.h' found under directory 'deps/libev'                                                                          
warning: no previously-included files matching '_corecffi.c' found under directory 'src/gevent'                                                                       
warning: no previously-included files found matching 'Makefile'                                                                                                       
warning: no previously-included files found matching 'configure-output'                                                                                               
./configure: line 6318: /usr/bin/file: No such file or directory                                                                                                      
In file included from src/gevent/libev/libev.h:2:0,                                                                                                                   
                 from src/gevent/libev/gevent.corecext.c:434:                                                                                                         
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:483:48: warning: "/*" within comment [-Wcomment]                                                                
 /*#define MIN_INTERVAL  0.00000095367431640625 /* 1/2**20, good till 2200 */                                                                                         
 ^                                                                                                                                                                    
In file included from src/gevent/libev/libev.h:2:0,                                                                                                                   
                 from src/gevent/libev/gevent.corecext.c:434:                                                                                                         
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:1831:31: warning: ‘ev_default_loop_ptr’ initialized and declared ‘extern’                                       
   EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */                                          
                               ^                                                                                                                                      
In file included from src/gevent/libev/libev.h:2:0,                                                                                                                   
                 from src/gevent/libev/gevent.corecext.c:434:                                                                                                         
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c: In function ‘ev_io_start’:                                                                                     
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:3878:34: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]                       
   fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);                                                                                                     
                                  ^                                                                                                                                   
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c: At top level:                                                                                                  
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:5135:27: warning: "/*" within comment [-Wcomment]                                                               
 /* EV_STAT     0x00001000 /* stat data changed */                                                                                                                    
 ^                                                                                                                                                                    
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:5136:27: warning: "/*" within comment [-Wcomment]                                                               
 /* EV_EMBED    0x00010000 /* embedded event loop needs sweep */                                                                                                      
 ^                                                                                                                                                                    
In file included from src/gevent/libev/libev.h:2:0,                                                                                                                   
                 from src/gevent/libev/gevent.corecext.c:434:                                                                                                         
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c: In function ‘evpipe_write’:                                                                                    
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:2468:11: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-resul  
t]                                                                                                                                                                    
           write (evpipe [1], &counter, sizeof (uint64_t));                                                                                                           
           ^                                                                                                                                                          
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:2480:11: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-resul  
t]                                                                                                                                                                    
           write (evpipe [1], &(evpipe [1]), 1);                                                                                                                      
           ^                                                                                                                                                          
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c: In function ‘pipecb’:                                                                                          
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:2501:11: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result  
]                                                                                                                                                                     
           read (evpipe [1], &counter, sizeof (uint64_t));                                                                                                            
           ^                                                                                                                                                          
/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev/ev.c:2515:11: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result  
]                                                                                                                                                                     
           read (evpipe [0], &dummy, sizeof (dummy));                                                                                                                 
           ^                                                                                                                                                          
./configure: line 10001: /usr/bin/file: No such file or directory                                                                                                     
In file included from src/gevent/gevent.ares.c:435:0:                                                                                                                 
src/gevent/dnshelper.c:19:0: warning: "PyUnicode_FromString" redefined                                                                                                
   #define PyUnicode_FromString         PyBytes_FromString                                                                                                            
 ^                                                                                                                                                                    
In file included from /usr/include/python2.7/Python.h:85:0,                                                                                                           
                 from src/gevent/gevent.ares.c:4:                                                                                                                     
/usr/include/python2.7/unicodeobject.h:281:0: note: this is the location of the previous definition                                                                   
 # define PyUnicode_FromString PyUnicodeUCS4_FromString                                                                                                               
 ^                                                                                                                                                                    
  File "build/bdist.linux-x86_64/egg/gevent/_socket3.py", line 195                                                                                                    
    def makefile(self, mode="r", buffering=None, *,                                                                                                                   
                                                  ^                                                                                                                   
SyntaxError: invalid syntax                                                                                                                                           
                                                                                                                                                                      
  File "/alarm/eggs/tmpNL6jem/gevent-1.2.2-py2.7-linux-x86_64.egg/gevent/_socket3.py", line 195                                                                       
    def makefile(self, mode="r", buffering=None, *,                                                                                                                   
                                                  ^                                                                                                                   
SyntaxError: invalid syntax                                                                                                                                           
                                                                                                                                                                      
Running '(cd  "/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/libev"  && sh ./configure   && cp config.h "$OLDPWD" ) > configure-output.txt' in /tmp/easy_install-EuLTIE/g
event-1.2.2/build/temp.linux-x86_64-2.7/libev                                                                                                                         
Running '(cd  "/tmp/easy_install-EuLTIE/gevent-1.2.2/deps/c-ares"  && if [ -r ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi   && sh ./configure --disable
-dependency-tracking CONFIG_COMMANDS=   && cp ares_config.h ares_build.h "$OLDPWD"   && mv ares_build.h.orig ares_build.h) > configure-output.txt' in /tmp/easy_instal
l-EuLTIE/gevent-1.2.2/build/temp.linux-x86_64-2.7/c-ares                                                                                                              
Got gevent 1.2.2.                                                                                                                                                     
Getting distribution for 'bottle'.                                                                                                                                    
warning: no files found matching 'LICENSE.txt'                                                                                                                        
zip_safe flag not set; analyzing archive contents...                                                                                                                  
bottle: module references __file__                                                                                                                                    
bottle: module references __path__                                                                                                                                    
Got bottle 0.12.13.                                                                                                                                                   
Getting distribution for 'certifi'.                                                                                                                                   
/usr/local/lib/python2.7/dist-packages/setuptools/dist.py:351: UserWarning: Normalizing '2017.07.27.1' to '2017.7.27.1'                                               
  normalized_version,                                                                                                                                                 
Got certifi 2017.7.27.1.                                                                                                                                              
Getting distribution for 'future>=0.16.0'.                                                                                                                            
warning: no files found matching '*.au' under directory 'tests'                                                                                                       
warning: no files found matching '*.gif' under directory 'tests'                                                                                                      
warning: no files found matching '*.txt' under directory 'tests'                                                                                                      
zip_safe flag not set; analyzing archive contents...                                                                                                                  
future.backports.test.ssl_servers: module references __file__                                                                                                         
future.backports.test.support: module references __file__                                                                                                             
future.standard_library.__init__: module references __file__                                                                                                          
future.standard_library.__init__: module references __path__                                                                                                          
future.utils.__init__: module MAY be using inspect.stack                                                                                                              
past.builtins.misc: module MAY be using inspect.stack                                                                                                                 
past.translation.__init__: module references __file__                                                                                                                 
past.translation.__init__: module references __path__                                                                                                                 
Got future 0.16.0.                                                                                                                                                    
Getting distribution for 'contextlib2'.                                                                                                                               
zip_safe flag not set; analyzing archive contents...                                                                                                                  
Got contextlib2 0.5.5.                                                                                                                                                
Getting distribution for 'urllib3<1.23,>=1.21.1'.                                                                                                                     
warning: no previously-included files matching '*' found under directory 'docs/_build'                                                                                
zip_safe flag not set; analyzing archive contents...                                                                                                                  
urllib3.packages.six: module references __path__                                                                                                                      
Got urllib3 1.22.                                                                                                                                                     
Getting distribution for 'idna<2.7,>=2.5'.                                                                                                                            
warning: no previously-included files matching '*.pyc' found under directory 'tools'                                                                                  
warning: no previously-included files matching '*.pyc' found under directory 'tests'                                                                                  
zip_safe flag not set; analyzing archive contents...                                                                                                                  
Got idna 2.6.                                                                                                                                                         
Getting distribution for 'chardet<3.1.0,>=3.0.2'.                                                                                                                     
warning: no files found matching 'requirements.txt'                                                                                                                   
zip_safe flag not set; analyzing archive contents...                                                                                                                  
Got chardet 3.0.4.                                                                                                                                                    
Getting distribution for 'PyYAML'.                                                                                                                                    
build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory                                                                      
 #include <yaml.h>                                                                                                                                                    
                  ^                                                                                                                                                   
compilation terminated.                                                                                                                                               
                                                                                                                                                                      
libyaml is not found or a compiler error: forcing --without-libyaml                                                                                                   
(if libyaml is installed correctly, you may need to                                                                                                                   
 specify the option --include-dirs or uncomment and                                                                                                                   
 modify the parameter include_dirs in setup.cfg)                                                                                                                      
zip_safe flag not set; analyzing archive contents...                                                                                                                  
Got PyYAML 3.12.                                                                                                                                                      
Getting distribution for 'greenlet>=0.4.10'.                                                                                                                          

ipython 需要指定版本号

默认会安装 ipython 6,然而 ipython 6 并不支持 Python 2.x,所以会报错。

IPython 6 requires Python version 3.3 and above.

IPython 5.x LTS is the compatible release for Python 2.7. If you require Python 2 support, you must use IPython 5.x LTS. Please update your project configurations and requirements as necessary.

eggs = satori-alarm

这边指定一下版本号?

[versions]

ipython = 5.3.0

报警规则需要能附带元信息

比如,在自己开发的工具中看到报警可以直接画出相关的监控图,或者直接跳到相关服务的 web interface 上去

Docker build 退出后重新安装需要再次重新输入所有参数

日志:

Traceback (most recent call last):
  File "/usr/bin/easy_install", line 9, in <module>
    load_entry_point('setuptools==5.5.1', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2199, in main
    lambda: setup(
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2185, in with_ei_usage
    return f()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 2202, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 393, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 636, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 668, in install_item
    self.process_distribution(spec, dist, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 716, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 631, in resolve
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 636, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 666, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 856, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1078, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1063, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 68, in run_setup
    DirectorySandbox(setup_dir).run(runner)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 114, in run
    return func()
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 67, in runner
    _execfile(setup_script, ns)
  File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 43, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-cYPzF0/setuptools-30.2.0/setup.py", line 181, in <module>
  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 266, in __init__
    _Distribution.__init__(self,attrs)
  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
    self.finalize_options()
  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 301, in finalize_options
    ep.load()(self, ep.name, value)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2195, in load
    raise ImportError("%r has no %r attribute" % (entry, attr))
ImportError: <module 'setuptools.dist' from '/usr/lib/python2.7/dist-packages/setuptools/dist.pyc'> has no 'check_specifier' attribute
ERROR: Service 'alarm' failed to build: The command '/bin/sh -c easy_install -U pip zc.buildout setuptools' returned a non-zero code: 1

alarm 这个是 setuptools 的问题 ... pypa/pip#4104

这边 Docker build 退出后,重新安装需要再次重新输入所有参数
另外没有非交互式安装的功能 ...

https://github.com/leancloud/satori/blob/master/satori/install#L306
这边是不是检测到环境变量已定义后不出交互式提示比较好?

Alarm 需要可以自定义规则对发出的报警做变换

针对每个

  • 报警组
  • 个人

可以做

  • 对报警内容做修改(比如,报警级别)
  • 丢弃
users:
  proton:
    name: Proton
    email: [email protected]
    filters:
      - filter: good_night  # 夜晚时间段 1 级以下的报警不要通知我
        mute_at: 0:00 - 8:00
        mute_below_level: 1  
      - filter: threshold  # 至少是 3 级报警才通知我
        level: 3

filters 需要放在规则仓库内,随时可以做自定义

能否实现报警匹配机器分组

hi:
能够把某一类规则挂到某一匹配的机器分组下. 比如 A 机器组是数据库 disk IO 阈值较高. B 机器组是 web 相应阈值就较低.

能否实现last(#3)的判断

hi:
fixed-event-window 3 可以拿到最近的3份数据. 能否在set-state-gapped 中判断所有的 event 是否都满足而报警或恢复.

3ks

如何关闭一条已有的报警规则?

新手问题,请谅解!
我按照“添加规则”文档添加了一条如下的规则,能够正常完成报警,但是我怎么关闭它呢,尝试过均失败:删除这个文件,修改这个文件都没有起作用,并且commit
检查了agent的/var/lib/satori/plugin目录,能够正常同步satori-rules的代码,但是这条规则依旧在持续发挥作用(查看了agent日志,依旧是30s执行一次22端口检查)。
谢谢辛勤的开发者们。

cat rules/test/portlisten.clj

(ns test.portlisten
  (:use riemann.streams
        agent-plugin
        alarm))

(def test-portlisten-rules
  (where (host "some-host-name")
    (plugin-metric "net.port.listen" 30 {:port 22})

    (where (and (service "net.port.listen")
                #(= (:port %) 22))
      (by :host
        (set-state-gapped (< 1) (> 0)
          (should-alarm-every 60
            (! {:note "22 端口不监听了!"
                :level 0
                :groups [:operation :api]})))))))

安装 satori 中需要检测 git 是否配置过 author 信息

下面的问题是由于什么配置不对,请大神们帮忙确认一下:
Run

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'testuser@testserver1.(none)')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.