二、OpenTSDB的安装配置
1、基本环境搭建 首先确保你的系统有以下条件满足: jdk 1.6 以上 并配置好环境变量 hbase 0.92 或更高版本 gnuplot 4.2 或更高(yum安装吧) autotools(好像只需要其中的autoconf和automake即可)#1. 重新安装新版本autoconf/automake #删除旧版本 yum erase autoconf #安装新版本autoconf wget http://mirrors.ustc.edu.cn/gnu/autoconf/autoconf-2.68.tar.gz tar -zxvf autoconf-2.68.tar.gz cd autoconf-2.68 ./configure make make install ln -s /usr/local/bin/autoconf /usr/bin/autoconf #安装新版本automake wget http://mirrors.ustc.edu.cn/gnu/automake/automake-1.11.2.tar.gz tar -zxvf automake-1.11.2.tar.gz cd automake-1.11.2 ./configure make make install ln -s /usr/local/bin/automake /usr/bin/automake ln -s /usr/local/bin/aclocal /usr/bin/aclocal #2.安装gnuplot-4.4.0 wget http://nchc.dl.sourceforge.net/project/gnuplot/gnuplot/4.4.0/gnuplot-4.4.0.tar.gz tar -zxvf gnuplot-4.4.0.tar.gz cd gnuplot-4.4.0 ./configure make make install ln -s /usr/local/bin/gnuplot /usr/bin/gnuplot2、OpenTSDB的安装 然后下面是我通过源码安装的过程,希望能够有借鉴意义:
1 git clone https://github.com/OpenTSDB/opentsdb.git 2 cd opentsdb 3 ./build.sh 4 #当build.sh运行完毕的时候 你应该在opentsdb/build文件夹下看到opentsdb.jar最后安装成功了,这里总结一下: 首先,java要安装好,各变量也要配置好; 其次,autotools的那几个工具也要安装好; opentsdb必须的gnuplot也要安装好; 额外:因为OpenTSDB的后端是hbase,所以这里也加上我配置的hbase的简单介绍: 1、hbase的安装配置,解压完后,在/etc/profile中加上 HBASE_HOME=path/to/hbase-0.94.X 不加的话,后面命令需要自己手动加上 完成后source /etc/profile生效; 然后,配置hbase的zookeeper属性,这与 hbase-env.sh 文件相关,文件中 HBASE_MANAGES_ZK 环境变量用来设置是使用hbase默认自带的 Zookeeper还是使用独立的ZooKeeper。HBASE_MANAGES_ZK=false 时使用独立的,为true时使用默认自带的。 手动启动hbase: ./start-hbase cd opentsdb的build目录 && HBASE_HOME=/home/xxx/hbase-1.2.5 ./src/create_table.sh ./tsdb tsd
3、配置文件
配置文件及参数:
zookeeper(hbase依赖于zookeeper所以保证有hbase的同时就保证了有zookeeper)在opentsdb/src文件夹下有一个opentsdb.conf的配置文件,内有3个主要属性需要配置: tsd.http.cachedir opentsdb的缓存数据存放目录,找个路径配置好 tsd.http.staticroot opentsdb web 静态文件的root路径,一般在opentsdb/build/staticroot tsd.network.port 绑定的端口 下面配置为常用可选配置 tsd.network.bind = 0.0.0.0 web 页面绑定IP,一般配置为0.0.0.0 保证其他IP可以访问opentsdb的web页面。 tsd.storage.hbase.zk_quorum = localhost 这个为zookeeper的地址。一般单机版hbase不需要配置 默认在本机。如果zookeeper是独立的或者分布式在其他机器上请指定IP 多个IP逗号分隔. 还有一些其他配置,请参见官网文档: http://opentsdb.net/docs/build/html/user_guide/configuration.html 配置文件填写好了之后将其复制至/etc/下 启动opentsdb会从以下几个地方搜索配置文件: ./opentsdb.conf /etc/opentsdb.conf /etc/opentsdb/opentsdb.conf /opt/opentsdb/opentsdb.conf 如果你多个地方都有配置文件,请确保这些多个配置文件的内容一致。也就是说修改一个要同步所有,不然根据你启动命令执行的路径不同可能会搜索到不同的配置文件。 建议只弄一个 放在/etc/下就好了。 注意! 若要将opentsdb的tag_values()函数获得的结果自动更新,需要设置四个参数在配置文件中
- tsd.core.meta.enable_realtime_uid
- tsd.core.meta.enable_tsuid_tracking
- tsd.core.meta.enable_tsuid_incrementing
- tsd.core.meta.enable_realtime_ts
| 参数名 | 类型 | 是否必选 | 默认值 | 详细介绍 |
| tsd.core.auto_create_metrics | Boolean | Optional | false | 新metric的数据点是否被指定UID。 当为false时,数据库中不具有metric的数据点将被拒绝并将抛出异常。 |
| tsd.core.auto_create_tagks (2.1) | Boolean | Optional | true | 带有新标签名称的数据点是否会将一个UID分配给tagk。 当为false时,具有不在数据库中的标签名称的数据点将被拒绝并将抛出异常。 |
| tsd.core.auto_create_tagvs (2.1) | Boolean | Optional | true | 是否具有新标签值的数据点将分配给tagv的UID。 当为false时,具有不在数据库中的标记值的数据点将被拒绝并将抛出异常。 |
| Name | Data Type | Required | Description | QS |
| metric | String | Required | The name of the metric you are storing | sys.cpu.nice |
| timestamp | Integer | Required | A Unix epoch style timestamp in seconds or milliseconds. The timestamp must not contain non-numeric characters. | 1365465600 |
| value | Integer, Float, String | Required | The value to record for this data point. It may be quoted or not quoted and must conform to the OpenTSDB value rules: Writing Data |
42.5 |
| tags | Map | Required | A map of tag name/tag value pairs. At least one pair must be supplied. | {"host":"web01"} |
| Name | Data Type | Description | Default | Example |
| --delete | Flag | Optional flag that deletes data in any row that matches the query. See warning below. 可选标记,用于删除与查询匹配的任何行中的数据。 |
Not set | --delete |
| --import | flag | Optional flag that outputs results in a text format useful for importing or storing as a backup. | Not set | --import |
| START-DATE | String or Integer | Starting time for the query. This may be an absolute or relative time. See Dates and Times for details | 1h-ago | |
| END-DATE | String or Integer | Optional end time for the query. If not provided, the current time is used. This may be an absolute or relative time. See Dates and Times for details | Current timestamp | 2014/01/01-00:00:00 |
| query | String | One or more command line queries | sum tsd.hbase.rpcs type=put |
三、grafana安装(grafana的具体介绍及使用方法会单独开一篇文章介绍)
Grafana 安装 1, 在官网下载grafana 安装包,安装好了之后,根据安装输出日志的提示 启动 grafana 即可(grafana-server start) 2,启动 grafana 后 打开机器 IP:3000端口 即可登录 grafana 界面,初始密码 admin admin 3,在 datasource 中添加一个数据源,选择 opentsdb 填入 ip+端口 即可。opentsdb 默认为4242端口。opentsdb+grafana监控系按使用总结
标签:cond 时间序列数据 result 通过 boolean poi 结构 .gz 数据源