通过elk获取到的java jvm中ygc的时间如下:
现在讲ygc字段的值,发送到influxdb中
首先安装logstash的插件
logstash-output-influxdb
安装完成后,查看:
https://www.elastic.co/guide/en/logstash/current/plugins-outputs-influxdb.html#plugins-outputs-influxdb-exclude_fields
http://blog.csdn.net/julykobe/article/details/44002687
http://www.mamicode.com/info-detail-1720352.html
然后配置服务器端的logstash_server.conf文件:
if [type] == "pcweb_gc" { #stdout{codec => json} influxdb { db => "htxk" #influxDB数据库名 host => "192.168.12.244" #influxDB服务地址 port => "8086" #influxDB端口 user => "admin" #influxDB初始化的用户名 password => "admin" #influxDB初始化的秘密 retention_policy => "default" measurement => "pcweb_gc" allow_time_override => true #允许覆盖time事件中的列 coerce_values => {"ygc" => "float"} #转换类型 data_points => { #键/值对的哈希表示要发送到指定数据库的数据 #"client" => "%{client}" #"request" => "%{request}" "ygc" => "%{ygc}" } } }
https://www.elastic.co/guide/en/logstash/current/plugins-outputs-influxdb.html#plugins-outputs-influxdb-exclude_fields
查看数据如下:
influxDB名词
- time:每条数据记录的时间,也是数据库自动生成的主索引;
- fields:各种记录的值;
- tags:各种有索引的属性。
- measurement:数据库中的表;
删除表:
retention_policy
数据保存策略(retention_policy)
influxDB是没有提供直接删除数据记录的方法,但是提供数据保存策略,主要用于指定数据保留时间,超过指定时间,就删除这部分数据。
创建新的Retention Policies
CREATE RETENTION POLICY "default" ON "htxk" DURATION 30d REPLICATION 1 DEFAULT
查看当前数据库Retention Policies
压测停止后,数据也停止显示:
SELECT mean("ygc") FROM "pcweb_gc" WHERE $timeFilter GROUP BY time(1s) fill(null)
select ygc from pcweb_gc
上面是实时数据:
重点是sql的写法:
SELECT mean("ygc") FROM "pcweb_gc" WHERE $timeFilter GROUP BY time($interval) fill(null)
http://blog.csdn.net/u010185262/article/details/53158786
https://segmentfault.com/a/1190000008838604
http://blog.csdn.net/u010185262/article/details/53158786
https://www.cnblogs.com/shhnwangjian/p/6893862.html
https://www.cnblogs.com/qiniu/p/6182679.html
https://www.jianshu.com/p/d2935e99006e
http://blog.csdn.net/tomorrowmorningj/article/details/65448841
https://www.cnblogs.com/MikeZhang/p/InfluxDB20171229.html
http://blog.csdn.net/u014087707/article/details/52700946
https://www.cnblogs.com/mafeng/p/6848166.html