ganglia gweb events or "user defined markers"

简介:
在说gweb的event 前, 我先举个例子 : 
在办公室有时会听到NOC的同事大喊, 流量飙升了, 怎么回事?
然后一般会有同事回应可能是在跨机房拷贝一些文件或者数据什么的, 又或者是在做跨机房的数据备份什么的.
如果在流量图上有标记的话, 那么NOC的同事对待这种流量突变的情况也不会一惊一乍.
gweb支持配置event, 这里指的event就是用户定义的时间段标签.

例如 : 
配置文件目录和customize view的目录一样
/data01/web/ganglia-web/conf/events.json
包含的内容举例 : 
[
  { "event_id":"1234",   # 事件 ID
    "start_time":1308496361,  # 开始时间
    "end_time":1308496961,  # 结束时间
    "summary":"DB Backup",    # summary
    "description":"Prod daily db backup",  # 事件描述
    "grid":"*",
    "cluster":"*",
    "host_regex":"centos1"  # 主机名规则表达式
  },
  { "event_id":"2345",  # 第二个事件的内容
    "start_time":1308497211,
    "summary":"FS cleanup",
    "grid":"*",
    "cluster":"*",
    "host_regex":"centos1"
  }
]

当events很多时, 解析JSON可能会增加CPU负载, 可以考虑使用mdb2格式, 即将event存入MYSQL数据库. 需要修改conf.php
默认的conf.php中event相关的配置如下 : 
# What is the provider use to provide events.
# Examples: "json", "mdb2"
$conf['overlay_events_provider'] = "json";
# Where is the Overlay events file stored
$conf['overlay_events_file'] = $conf['conf_dir'] . "/events.json";

# If using MDB2, connection string:
$conf['overlay_events_dsn'] = "mysql://dbuser:dbpassword@localhost/ganglia";

$conf['overlay_events_color_map_file'] = $conf['conf_dir'] . "/event_color.json";


例子, 使用events.json添加event.
获得一个时间, 用于start_time
digoal=# SELECT EXTRACT(EPOCH FROM now()),now();
    date_part     |              now              
------------------+-------------------------------
 1410765863.10149 | 2014-09-15 15:24:23.101488+08
(1 row)

编辑events.json
[root@db-172-16-3-221 conf]# vi events.json
[
  { "event_id":"digoal",
    "start_time":1410765863,
    "end_time":1410765999,
    "summary":"DB Backup",
    "description":"Prod daily db backup",
    "grid":"*",
    "cluster":"*",
    "host_regex":".*"
  }
]

现在在图中就可以看到这个事件了. summary会显示在图中 : 
ganglia gweb events or user defined markers - 德哥@Digoal - PostgreSQL research
通过这个图我们就知道这个时候正在做数据库备份, 如果流量上升的话可以得到合理的解释.
(当然不排除恰巧同时也发生了其他事件到在图形的异常)

除了使用events.json来编辑创建event, 还可以使用web界面或者API来创建event.
使用WEB 界面来创建event.
ganglia gweb events or user defined markers - 德哥@Digoal - PostgreSQL research

也可以使用API来创建event : 
通过HTTP GET或POST请求来创建event.

An easy way to manipulate events is through the Ganglia Events API, which is available
from your gweb interface at  /ganglia/api/events.php. To use it, invoke the URL along
with key/value pairs that define events. Key/value pairs can be supplied as either GET
or POST arguments. The full list of key/value pairs is provided in : 

Key: Value
action: addto add a new event, editto edit, removeor deleteto remove an event.
start_time: Start time of an event. Allowed options are now(uses current system time), UNIX timestamp, or any other well formed date, as supported by PHP’s strtotime function.
end_time: Optional. Same format as start_time.
summary: Summary of an event. It will be shown in the graph legend.
host_regex: Host regular expression, such as web-|app-.

例子 : 
curl "http://mygangliahost.com/ganglia/api/events.php?\
action=add&start_time=now&\
summary=Prod DB Backup&host_regex=db02"

OR

curl -X POST --data " action=add&start_time=now\
&summary=Prod DB Backup&host_regex=db02" \
http://mygangliahost.com/ganglia/api/events.php

返回值 : 
API will return a JSON-encoded status message with either status = ok or status = error.
If you are adding an event, you will also get the  event_idof the event that was just
added in case you want to edit it later, such as to add an end_time.


[参考]
相关文章
|
8月前
|
网络安全 Docker 容器
failed to create network error response from daemon filed to setup ip tables问题
failed to create network error response from daemon filed to setup ip tables问题
116 0
|
网络安全 开发工具
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
778 0
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
|
索引
问题复盘:Kibana did not load properly. Check the server output for more information
问题复盘:Kibana did not load properly. Check the server output for more information
265 0
问题复盘:Kibana did not load properly. Check the server output for more information
|
SQL Windows
Unable to determine if the owner (Domain\UserName) of job JOB_NAME has server access
早上巡检的的时候,发现一数据库的作业报如下错误(作业名等敏感信息已经替换),该作业的OWNER为一个域账号: JOB RUN: 'JOB_NAME' was run on 2016-6-1 at 7:00:00 DURATION: 0 hours, 0 minutes, 1 seconds STATUS: Failed MESSAGES: The job failed.
1400 0