InfluxDB

Calculating request per second using InfluxDB on Grafana

£可爱£侵袭症+ 提交于 2019-12-05 17:36:05
I use telegraf plugin nginx to read Nginx's basic status information (ngx_http_stub_status_module) This is my query raw sql: SELECT derivative(mean("requests"), 1s) FROM "nginx" WHERE $timeFilter GROUP BY time($interval) fill(null) This is my data time accepts active handled host port reading requests server waitingwriting 1464921070000000000 7 1 7 hysm 80 0 17 localhost 0 1 1464921080000000000 8 1 8 hysm 80 0 19 localhost 0 1 1464921090000000000 8 1 8 hysm 80 0 20 localhost 0 1 1464921100000000000 8 1 8 hysm 80 0 21 localhost 0 1 but requestPerSecond is 0.083, what is wrong with my query?

Docker监控套件(Telegraf+Influxdb+Grafana)研究与实践

血红的双手。 提交于 2019-12-05 16:35:13
1. Telegraf相关介绍以及实践 2. Influxdb相关介绍以及实践 3. Grafana相关介绍和实践 4.TIG架构组成以及原理介绍 telegraf为数据采集器,通过监控指标的配置将相应的数据采集并存储到influxdb中,进而进行时间序列化,而grafana最终通过influxdb中提供的源数据进行聚合分析和展示。 telegraf的难点在于理解每个plugin的配置以及采集指标的原理和含义;influxdb的难点在于类SQL语言的优化使用;grafana的难点在于对监控需求以及指标的分析和提取,并通过可视化配置将图标展现。 5.监控效果图 注意:原创著作,转载请联系作者! 来源: oschina 链接: https://my.oschina.net/u/1026229/blog/751325

Docker监控方案(TIG)的研究与实践之Influxdb

ε祈祈猫儿з 提交于 2019-12-05 16:35:00
前言: Influxdb也是有influxdata公司(www.influxdata.com )开发的用于数据存储的时间序列数据库.可用于数据的时间排列。在整个TIG(Telegraf+influxdb+grafana)方案中,influxdb可算作一个中间件,主要负责原始数据的存储,并按照时间序列进行索引构建以提供时间序列查询接口。在整个TIG方案中,应该先构建的就是Influxdb。 Influxdb研究与实践: influxdb介绍: 使用TSM(Time Structured Merge)存储引擎,允许高摄取速度和数据压缩; 使用go编写,无需其他依赖; 简单,高性能写查询httpAPI接口; 支持其他数据获取协议的插件,比如graphite,collected,OpenTSDB; 使用relay构建高可用 https://docs.influxdata.com/influxdb/v1.0/high_availability/relay/ ; 扩展的类sql语言,很容易查询汇总数据; tag的支持,可用让查询变的更加高效和快速; 保留策略有效地自动淘汰过期的数据; 持续所产生的自动计算的数据会使得频繁的查询更加高效; web管理页面的支持 下载安装: github: https://github.com/influxdata/influxdb 源码编译 官网下载:

How to add a plugin to Telegraf?

巧了我就是萌 提交于 2019-12-05 14:03:02
Hello I would to know if someone have all ready add a plugin to telegraf for Influxdb . I have my go code which is working. What do I need next and where to put theses files? I've found that I need to do something like this: type ReadFile struct { //buf []byte //MemoryBytes int64 //PID int } func (s *ReadFile) Description() string { return "This is a test plugin to read data from a file and send them to influxdb" } func (s *ReadFile) SampleConfig() string { return "ok = true # indicate if everything is fine" } func Gather(acc plugins.Accumulator) error { readFile(alarmFile) acc.Add("alarm",

influxdb python: 404 page not found

假装没事ソ 提交于 2019-12-05 07:26:58
I am trying to use the influxdb-python lib which I found here . But I cant even get the tutorial programm to work. When I run the following example code: $ python >>> from influxdb import InfluxDBClient >>> json_body = [ { "measurement": "cpu_load_short", "tags": { "host": "server01", "region": "us-west" }, "time": "2009-11-10T23:00:00Z", "fields": { "value": 0.64 } } ] >>> client = InfluxDBClient('localhost', 8086, 'root', 'root', 'example') >>> client.create_database('example') I get this error message with the last line: >>> client.create_database('example') Traceback (most recent call last

How do I group by count of a field in InfluxDB?

不羁的心 提交于 2019-12-04 13:32:44
I have some data in InfluxDB that is connected events for certain TCP connections. So the measurement is connection_events with tags being: mac_address of connecting system, and some other metadata. The value is just connected=true|false What I want to do is something like this: select count(mac_address), mac_address from connection_events where count(mac_address) > X group by mac_address In other words, I want to see results like: 28,ABCD 14,EFGH 3,XYZQ However, InfluxDB doesn't like this kind of query. I can't figure out how to parse through the dataset of connection events and aggregate

使用 Metrics.net + influxdb + grafana 搭建项目自动化监控和预警方案

淺唱寂寞╮ 提交于 2019-12-04 11:50:49
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/qq_25042791/article/details/86673581 这次分享使用Metrics.net + influxdb + grafana 构建项目自动化监控和预警方案。通过执行耗时,定位哪些接口拖累了服务的性能;通过请求频次,设置适当的限流和熔断机制,拦截非法或不合理的请求,保障服务的可用性。本次内容较多,部分详细内容将使用链接方式提供。 动手前,需下准备以下工具: 1、influxdb 下载地址: https://portal.influxdata.com/downloads/#influxdb 2、chronograf 下载地址: https://portal.influxdata.com/downloads/#chronograf 3、grafana 下载地址: https://grafana.com/get 正式开始: 1、安装influxdb, 以window环境为例, 下载解压后文件 打开influxdb.conf,修改配置, [meta] # Where the metadata/raft database is stored dir = "E:/influxdb/meta" [data] #

docker 相关问题和快速使用命令

亡梦爱人 提交于 2019-12-04 09:18:27
命令 清理none镜像 docker rmi $(docker images -f "dangling=true" -q) 强制清空 docker rmi $(docker images -q) -f docker时间问题 日志打印时间和系统时间差8个小时 项目中打印日志时间和系统外部用 date 命令打印的时间差了8个小时。 问题原因: 外部虽然修改了时区和时间,但是docker容器中的时间并没有修复,所以需要将外部的文件引入到内部里。 解决的方式在dockerfile 里添加一句 RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 但是docker 好像不能直接从外部copy, 所以上面这个一般不能成功 所以需要将 /usr/share/zoneinfo/Asia/Shanghai , Shanghai拷贝到和Dockerfile同一个目录 然后使用命令 COPY Shanghai /etc/localtime 这个时候docker 里面的utc时间就转换成了中国时间,就不会少了8个小时 使用alpine修改时区问题 上面修改时区的 在使用alpine的时候处理怎么都不能转换成功,google到一个解决方法 Bug #5543 docker run -it --rm alpine /bin/sh /

influxdb 基本概念和操作

旧城冷巷雨未停 提交于 2019-12-04 08:38:29
1、数据格式 在 InfluxDB 中,我们可以粗略的将要存入的一条数据看作 一个虚拟的 key 和其对应的 value(field value) 。格式如下: 1 cpu_usage,host = server01,region = us - west value = 0.64 1434055562000000000 虚拟的 key 包括以下几个部分: database, retention policy, measurement, tag sets, field name, timestamp。 database: 数据库名,在 InfluxDB 中可以创建多个数据库,不同数据库中的数据文件是隔离存放的,存放在磁盘上的不同目录。 retention policy: 存储策略,用于设置数据保留的时间,每个数据库刚开始会自动创建一个默认的存储策略 autogen,数据保留时间为永久,之后用户可以自己设置,例如保留最近2小时的数据。插入和查询数据时如果不指定存储策略,则使用默认存储策略,且默认存储策略可以修改。InfluxDB 会定期清除过期的数据。 measurement: 测量指标名,例如 cpu_usage 表示 cpu 的使用率。 tag sets: tags 在 InfluxDB 中会按照字典序排序,不管是 tagk 还是 tagv,只要不一致就分别属于两个 key,例如

Calculating duration between a start and end event in InfluxDB

时光怂恿深爱的人放手 提交于 2019-12-04 06:05:52
I have two write points for InfluxDB, one is the start and the other is the end. I just need to determine the duration between those two events, and make queries around it. InfluxDB has difference() aggregate method, but it doesn't work on the time meta field. Is supplying a custom timestamp value the only way to accomplish this? If you write only the mentioned two entries then you can follow the below steps - Limit the result to two (Eg: select * from timeseries limit 2) Extract the time from the result set Take the difference between the time As per " Can I perform mathematical operations