---
# System prepended metadata

title: Telemetry
tags: [QCT, Data Center]

---

Telemetry
===

###### tags: `QCT` `Data Center`

## Grafana
* Install Grafana
```
docker run -d -p 3000:3000 --name grafana grafana/grafana:6.3.2
```
* [Grafana Play Home](https://play.grafana.org/d/000000012/grafana-play-home?orgId=1)
* Data Sources 
  * Prometheus
    * [Querying Prometheus](https://prometheus.io/docs/prometheus/latest/querying/basics/)
  * Elasticsearch
    * [Lucene Query](https://www.elastic.co/guide/en/elasticsearch/reference/7.1/query-dsl-query-string-query.html#query-string-syntax)
  * InfluxDB 
    * [InfluxQL](https://docs.influxdata.com/influxdb/v1.7/query_language/spec/#notation)
    * ```SELECT "<field_key>"::field,"<tag_key>"::tag FROM <database_name>.<retention_policy_name>.<measurement_name>```
    * [InfluxDB glossary of terms](https://docs.influxdata.com/influxdb/v1.7/concepts/glossary/#tag-key)
    * [InfluxDB key concepts](https://docs.influxdata.com/influxdb/v1.7/concepts/key_concepts)
    * Field vs. Tag
      * Queries on field values scan all points that match the specified time range and, as a result, are not performant relative to tags.
      * Query tip: Compare fields to tags; tags are indexed.
    * Measurement
      * The part of InfluxDB’s structure that describes the data stored in the associated fields.
      * A single measurement can belong to different retention policies.
    * Retention Policy
      * The part of InfluxDB’s data structure that describes for how long InfluxDB keeps data (duration), how many copies of this data is stored in the cluster (replication factor), and the time range covered by shard groups (shard group duration).
      * RPs are unique per database.
    * Series
      * A series is the collection of data that share a retention policy, measurement, and tag set.
    * Point
      * A point is the field set in the same series with the same timestamp.
    * Shard
      * A shard contains the actual encoded and compressed data, and is represented by a TSM file on disk.
      * Every shard belongs to one and only one shard group.

## Fluentd
* [Fluentd](https://docs.fluentd.org/)
* What is td-agent?
  * The stable distribution of Fluentd, called td-agent.
  * td-agent v3 uses fluentd v1.0 in the core.
* [Command Line Option](https://docs.fluentd.org/deployment/command-line-option)
* [Plugin Management](https://docs.fluentd.org/deployment/plugin-management)
  * If you are using td-agent, please make sure to use td-agent's **td-agent-gem** command. td-agent has own Ruby so you should install gems into td-agent's Ruby, not other Ruby.
  * [Plugins](https://www.fluentd.org/plugins/all)
* [QCT Fluentd Developing](https://hackmd.io/@derailment/fluentd)

## Telegraf
* Install on CentOS 7
```
vi /etc/yum/repos.d/influxdb.repo

[influxdb]
name = InfluxDB Repository - RHEL\$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
```
```
yum install telegraf
```
* Usage
  - [Telegraf](https://github.com/influxdata/telegraf)
  - [Configuration](https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md)
  - [telegraf 安裝使用](https://www.itread01.com/content/1535778649.html)
* [Telegraf Helm Chart](https://github.com/helm/charts/tree/master/stable/telegraf)
* [QCT Telegraf Developing](https://hackmd.io/@derailment/telegraf)


