Skip to content

The plugin-driven server agent for collecting & reporting metrics.

License

Notifications You must be signed in to change notification settings

cnosdb/cnos-telegraf

This branch is 9 commits ahead of, 1651 commits behind influxdata/telegraf:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

97d2d7c · Jul 25, 2023
Jul 14, 2023
Jul 14, 2023
Jul 25, 2023
Mar 28, 2022
Jun 27, 2023
Jul 25, 2023
Jul 24, 2023
Mar 1, 2023
Jul 25, 2023
Sep 8, 2022
Jul 24, 2023
Jun 9, 2023
Jul 25, 2023
Jul 5, 2023
Jul 25, 2023
Mar 1, 2023
Jul 25, 2023
Jul 14, 2023
Apr 3, 2023
Jul 25, 2023
Jul 13, 2023
Mar 7, 2023
Jun 2, 2023
Jun 14, 2023
Dec 1, 2021
Oct 24, 2022
Jul 10, 2023
Jun 14, 2023
May 30, 2023
Jul 25, 2023
Mar 17, 2023
Jun 30, 2020
Jul 14, 2023
Jul 25, 2023
Jul 25, 2023
Jun 14, 2023
Jul 25, 2023
Jun 5, 2020
Jun 12, 2023
Jul 25, 2023
Jul 25, 2023
Mar 5, 2021
Jul 25, 2023
Jul 25, 2023
Mar 14, 2023
Sep 26, 2022
Mar 1, 2023
Oct 26, 2022
Dec 8, 2022
Apr 11, 2023

Cnos-Telegraf

CnosDB-Telegraf 基于 Telegraf 进行开发,增加了一些功能与插件。

原版 Telegraf 文档

README.md

Cnos-Telegraf 的改动说明

Parser Plugin

增加 Parser 插件 OpenTSDB 和 OpenTSDB-Telnet,用于采集 OpenTSDB 的写入请求。

  • OpenTSDB

    通过使用 Input 插件 http_listener_v2 并配置 data_format"opentsdb",将能够解析 OpenTSDB 格式的写入请求。

  • Linux kernel version 2.6.23 or later

  • Windows 7 or later

  • FreeBSD 11.2 or later

  • MacOS 10.11 El Capitan or later

Obtaining Telegraf

View the changelog for the latest updates and changes by version.

Binary Downloads

Binary downloads are available from the InfluxData downloads page or from each GitHub Releases page.

Package Repository

InfluxData also provides a package repo that contains both DEB and RPM downloads.

For deb-based platforms (e.g. Ubuntu and Debian) run the following to add the repo key and setup a new sources.list entry:

# influxdata-archive_compat.key GPG fingerprint:
#     9D53 9D90 D332 8DC7 D6C8 D3B9 D8FF 8E1F 7DF8 B07E
wget -q https://repos.influxdata.com/influxdata-archive_compat.key
echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
sudo apt-get update && sudo apt-get install telegraf
```toml
[[inputs.http_listener_v2]]
service_address = ":8080"
paths = ["/api/put"]
methods = ["POST", "PUT"]
data_format = "opentsdb"
[[inputs.http_listener_v2]]
service_address = ":8080"
paths = ["/api/put"]
methods = ["POST", "PUT"]
data_format = "opentsdb"
  • OpenTSDB-Telnet
# influxdata-archive_compat.key GPG fingerprint:
#     9D53 9D90 D332 8DC7 D6C8 D3B9 D8FF 8E1F 7DF8 B07E
cat <<EOF | sudo tee /etc/yum.repos.d/influxdata.repo
[influxdata]
name = InfluxData Repository - Stable
baseurl = https://repos.influxdata.com/stable/\$basearch/main
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key
EOF
sudo yum install telegraf
通过使用 Input 插件 socket_listener,并配置 `data_format` 为 opentsdbtelnet,将能够解析 OpenTSDB-Telnet 格式的写入请求。
通过使用 Input 插件 socket_listener,并配置 `data_format``"opentsdbtelnet"`,将能够解析 OpenTSDB-Telnet 格式的写入请求。
  通过使用 Input 插件 socket_listener,并配置 `data_format``"opentsdbtelnet"`,将能够解析 OpenTSDB-Telnet 格式的写入请求。

   ```toml
   [[inputs.socket_listener]]
   service_address = "tcp://:8081"
   data_format = "opentsdbtelnet"

Output Plugin

Telegraf requires Go version 1.20 or newer and the Makefile requires GNU make.

On Windows, the makefile requires the use of a bash terminal to support all makefile targets. An easy option to get bash for windows is using the version that comes with git for windows.

  1. Install Go

  2. Clone the Telegraf repository:

    git clone https://github.com/influxdata/telegraf.git
  3. Run make build from the source directory

    cd telegraf
    make build

Nightly Builds

Nightly builds are available, generated from the master branch.

3rd Party Builds

Builds for other platforms or package formats are provided by members of theTelegraf community. These packages are not built, tested, or supported by the Telegraf project or InfluxData. Please get in touch with the package author if support is needed:

Getting Started

See usage with:

telegraf --help
增加 Output 插件 CnosDBG,用于将指标输出到 CnosDB。
增加 Output 插件 CnosDB,用于将指标输出到 CnosDB。

```toml
[[outputs.cnosdb]]
url = "localhost:31006"
user = "user"
password = "pass"
database = "telegraf"
  • 配置介绍
参数 说明
url CnosDB GRpc 服务地址
user 用户名
password 密码
database CnosDB 数据库

Input Plugin

增加配置参数 high_priority_io,用于开启端到端模式。

当设置为 true 时,写入的数据将立即发送到 Output 插件,并根据 Output 插件的返回参数来决定返回值。

[[inputs.http_listener_v2]]
service_address = ":8080"
paths = ["/api/put"]
methods = ["POST", "PUT"]
data_format = "opentsdb"
high_priority_io = true

以上配置与在 Output 章节中的配置相比,增加了 high_priority_io = true 配置项。

构建

  1. 安装 Go >=1.18 (推荐 1.18.0 版本)

  2. 从 Github 克隆仓库:

    git clone https://github.com/cnosdb/cnos-telegraf.git
  3. 在仓库目录下执行 make build

    cd cnos-telegraf
    make build

启动

执行以下指令,查看用例:

telegraf --help

生成一份标准的 telegraf 配置文件

telegraf config > telegraf.conf

生成一份 telegraf 配置文件,仅包含 cpu 指标采集 & influxdb 输出两个插件

telegraf config --section-filter agent:inputs:outputs --input-filter cpu --output-filter influxdb

运行 telegraf 但是将采集指标输出到标准输出

telegraf --config telegraf.conf --test

运行 telegraf 并通过配置文件来管理加载的插件

telegraf --config telegraf.conf

运行 telegraf,仅加载 cpu & memory 指标采集,和 influxdb 输出插件

telegraf --config telegraf.conf --input-filter cpu:mem --output-filter influxdb

About

The plugin-driven server agent for collecting & reporting metrics.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.5%
  • Shell 0.3%
  • Makefile 0.1%
  • Ragel 0.1%
  • Python 0.0%
  • Ruby 0.0%