Opentsdb + grafana monitoring is summarized based on usage, opentsdbgrafana
1. OpenTSDB introduction OpenTSDB, an Open Source Monitoring System, uses hbase to store all time sequences (without sampling) to build a distributed and scalable Time Series database. It supports second-level data collection of all metrics, permanent storage, capacity planning, and easy access to the existing alarm system. OpenTSDB can obtain the corresponding metrics from a large-scale cluster (including network devices, operating systems, and applications in the cluster) for storage, indexing, and services, this makes the data easier to understand, such as web and graphical. For O & M engineers, OpenTSDB can obtain real-time status information about infrastructure and services, and display various hardware and software errors, performance changes, and performance bottlenecks of the cluster. For managers, OpenTSDB can measure the SLA of the system, understand the interaction between complex systems, and display resource consumption. The overall job status of the cluster, which can be used to assist in budget and cluster resource coordination. For developers, OpenTSDB can demonstrate the major performance bottlenecks and Common Errors of the cluster, so as to focus on solving important problems. Here are a few articles for OpenTSDB introduction is very detailed: http://liubin.org/blog/2016/03/05/tsdb-opentsdb/http://www.jianshu.com/p/0bafd0168647https://yq.aliyun.com/articles/54785 This is a detailed introduction to the table structure of https://zhengheng.me/2016/03/07/opentsdb-hbase-tuning/ optimization 2, OpenTSDB installation Configuration1. Basic Environment ConstructionFirst, make sure that your system meets the following conditions: jdk 1.6 and later, and configure the environment variable hbase 0.92 or later, gnuplot 4.2 or higher (install yum) autotools (it seems that only autoconf and automake are needed)
#1. reinstall the new version autoconf/automake # Remove the old version yum erase autoconf # install the new version autoconfwget http://mirrors.ustc.edu.cn/gnu/autoconf/autoconf-2.68.tar.gztar-zxvf autoconf-2.68.tar.gzcd autoconf-2.68. /configuremakemake installln-s/usr/local/bin/autoconf/usr/bin/autoconf # install the new version automakewget http://mirrors.ustc.edu.cn/gnu/automake/automake-1.11.2.tar.gztar-zxvf automake-1.11.2.tar.gzcd automake-1.11.2. /configuremakemake installln-s/usr/local/bin/automake/usr/bin/automakeln-s/usr/local/bin/aclocal/usr/bin/aclocal #2. install gnuplot-4.4.0wget http://nchc.dl.sourceforge.net/project/gnuplot/gnuplot/4.4.0/gnuplot-4.4.0.tar.gztar-zxvf gnuplot-4.4.0.tar.gzcd gnuplot-4.4.0. /configuremakemake installln-s/usr/local/bin/gnuplot/usr/bin/gnuplot
2. Install OpenTSDBThe following is the installation process through the source code. I hope it can be used for reference:
1 git clone https://github.com/OpenTSDB/opentsdb.git2 cd opentsdb3./build. sh4 # When build. sh is finished, you should see opentsdb. jar in the opentsdb/build folder
The installation is successful. Here we will summarize: first, java should be installed and various variables should be configured. Second, the tools of autotools should also be installed; the gnuplot required by opentsdb must also be installed. Additionally, because the backend of OpenTSDB is hbase, a brief introduction to the hbase I configured is also added here: 1. install and configure hbase, after decompression, add HBASE_HOME = path/to/hbase-0.94.X without HBASE_HOME in/etc/profile, the following command needs to manually add after the completion of source/etc/profile; then, configure the zookeeper attribute of hbase, which is related to the hbase-env.sh file. The HBASE_MANAGES_ZK environment variable in the file is used to set whether to use the Zookeeper that comes with hbase by default or to use the independent ZooKeeper. HBASE_MANAGES_ZK = false is used independently. If it is set to true, the default value is used. Manually start hbase:./start-hbasmcm opentsdb build directory & HBASE_HOME =/home/xxx/hbase-1.2.5./src/create_table.sh./tsdb tsd
3. Configuration File
Configuration file and parameters:
Zookeeper (hbase depends on zookeeper. Therefore, zookeeper is ensured when hbase is available)
There is an opentsdb in the opentsdb/src folder. conf configuration file, which has three main attributes to be configured: tsd. http. cachedir opentsdb's cache data storage directory. Find a path to configure tsd. http. the root path of the staticroot opentsdb web static file, usually in opentsdb/build/staticroot tsd. network. under the port bound to the port, the common optional configuration is tsd. network. bind = 0.0.0.0 web page binding IP address, usually configured as 0.0.0.0 to ensure that other IP addresses can access the opentsdb web page. Tsd. storage. hbase. zk_quorum = localhost: the address of zookeeper. Generally, hbase of standalone version does not need to be configured on the local machine by default. If zookeeper is independent or distributed on other machines, separate multiple IP addresses by commas. there are also some other configurations, see the official documentation: After the http://opentsdb.net/docs/build/html/user_guide/configuration.html configuration file is filled out, copy it to/etc/start opentsdb will search for the configuration file from the following places :. /opentsdb. conf/etc/opentsdb. conf/etc/opentsdb. conf/opt/opentsdb. conf if you have a configuration file in multiple places, make sure that the content of these configuration files is consistent. That is to say, You need to modify a configuration file to synchronize all data. Otherwise, different configuration files may be searched based on the path in which you run the command. It is recommended to put only one file in/etc.
Note!To automatically update the result of the tag_values () function of opentsdb, you need to set four parameters in the configuration file.
- Tsd. core. meta. enable_realtime_uid
- Tsd. core. meta. enable_tsuid_tracking
- Tsd. core. meta. enable_tsuid_incrementing
- Tsd. core. meta. enable_realtime_ts
Opentsdb configuration file Description: http://opentsdb.net/docs/build/html/user_guide/stats.html
Parameter Name |
Type |
Required |
Default Value |
Details |
Tsd. core. auto_create_metrics |
Boolean |
Optional |
False |
Whether the UID is specified for the new metric data point. If the value is false, data points that do not have metric in the database will be rejected and an exception will be thrown. |
Tsd. core. auto_create_tagks (2.1) |
Boolean |
Optional |
True |
Whether a data point with a new tag name will allocate a UID to the tagk. If the value is false, data points with tags not in the database will be rejected and an exception will be thrown. |
Tsd. core. auto_create_tagvs (2.1) |
Boolean |
Optional |
True |
Indicates whether a data point with a new tag value is assigned to the UID of the tagv. If this parameter is set to false, data points with value not in the database will be rejected and an exception will be thrown. |
4. Start OPENTSDB:First, create hbase table: Under opentsdb/src There Is A create_tab.sh script to execute: env COMPRESSION = NONE HBASE_HOME = path/to/hbase-0.94.X. /src/create_table.shCOMPRESSION = NONE specifies the compression mode of the hbase table. Optional values: NONE, LZO, GZIP or SNAPPYHBASE_HOME. If the data is configured, skip this field in the environment variable. The last one is to execute the table creation script. After the table is created, the tsdb script is executed in the opentsdb/build folder. /tsdb tsd can start opentsdb to open the corresponding ip address and port page to see the page, such as to be executed in the background: nohup. /tsdb tsd &
5. simple use of OpenTSDBTelnet the client to send data to opentsdb to create metric :. /tsdb mkmetric metricNametelnet ip port connected to opentsd Syntax: put sys. cpu. user 1356998400 42.5 host = webserver01 cpu = 0 post: Send a post request to ip: port/api/put. The parameter is json data, as shown below:
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 "} |
Example: {"metric": "sys. cpu. nice "," timestamp ": 1346846400," value ": 18," tags ": {" host ":" web01 "," dc ": "lga"} if the message is sent successfully, status 204 is returned. For details, see: Success. The start time, an optional end time, and one or more queries are provided. The response will be the raw bytes of data that can be stored in the text format used for importing commands or data points. Scanning also provides basic methods for deleting data. The scan command accepts common CLI parameters. Data is sent to standard output. Note that, although the query requires aggregation, it is effectively ignored. If the query contains many time series, the scan output may be very large, so be careful when making the query. Scan [-- delete | -- import] START-DATE [END-DATE] query [queries...]
Name |
Data Type |
Description |
Default |
Example |
-- Delete |
Flag |
Optional flag that deletes data in any row that matches the query. See warning below. Optional. Used to delete data in any row that matches the query. |
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 |
|
H-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 |
Example. /tsdb scan 2014/05/01 sum test_uid ed = endp -- delete. /tsdb scan 2014/05/01 sum TcpExt. arpFilter -- delete 3. grafana installation (an article about grafana's specific introduction and usage will be provided separately) Grafana installation 1. Download The grafana installation package from the official website. After installation, start grafana (grafana-server start) 2 according to the installation output log prompt. After grafana is started, open the machine IP: port 3000 to log on to the grafana interface. The initial password is admin admin3, add a data source to datasource and select opentsdb to fill in ip + port. The default value of opentsdb is port 4242.