telegraf -> influxdb -> grafana 연동을 해보려고 작성해 봤습니다.

root@syslogserver:~# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> show databases
name: databases
name
----
_internal
> create database telegrafdb
> create user telegraf with password 'password0'
>
> grant all on telegrafdb to telegraf
> show databaes
ERR: error parsing query: found databaes, expected CONTINUOUS, DATABASES, DIAGNOSTICS, FIELD, GRANTS, MEASUREMENT, MEASUREMENTS, QUERIES, RETENTION, SERIES, SHARD, SHARDS, STATS, SUBSCRIPTIONS, TAG, USERS at line 1, char 6
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".
> show databases
name: databases
name
----
_internal
telegrafdb
> quit
root@syslogserver:~#
root@syslogserver:~# vi /etc/telegraf/telegraf.conf

#[[outputs.influxdb]]
  ## The full HTTP or UDP URL for your InfluxDB instance.
  ##
  ## Multiple URLs can be specified for a single cluster, only ONE of the
  ## urls will be written to each interval.
  # urls = ["unix:///var/run/influxdb.sock"]
  # urls = ["udp://127.0.0.1:8089"]
  urls = ["http://192.168.000.000:8086"]

  ## The target database for metrics; will be created as needed.
  ## For UDP url endpoint database needs to be configured on server side.
  database = "telegrafdb"

  ## The value of this tag will be used to determine the database.  If this
  ## tag is not set the 'database' option is used as the default.
  # database_tag = ""

  ## If true, the 'database_tag' will not be included in the written metric.
  # exclude_database_tag = false

  ## If true, no CREATE DATABASE queries will be sent.  Set to true when using
  ## Telegraf with a user without permissions to create databases or when the
  ## database already exists.
  # skip_database_creation = false

  ## Name of existing retention policy to write to.  Empty string writes to
  ## the default retention policy.  Only takes effect when using HTTP.
  retention_policy = ""

  ## The value of this tag will be used to determine the retention policy.  If this
  ## tag is not set the 'retention_policy' option is used as the default.
  # retention_policy_tag = ""

  ## If true, the 'retention_policy_tag' will not be included in the written metric.
  # exclude_retention_policy_tag = false

  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all".
  ## Only takes effect when using HTTP.
  # write_consistency = "any"

  ## Timeout for HTTP messages.
  timeout = "5s"

  ## HTTP Basic Auth
  username = "telegraf"
  password = "password0"

 

이후 그라파나의 Data source 추가를 influxdb로 하시면 됩니다.

'기술 노트 > ubuntu' 카테고리의 다른 글

influxdb.conf 설정 파일  (0) 2024.03.18
influxdb v1으로 설치하기  (0) 2024.03.18
MIB search path: mibs  (0) 2024.03.15
influxdb org 확인 하기  (0) 2024.03.15
telegraf 설정하기  (0) 2024.03.15

 

root@syslogserver:~# vi /etc/telegraf/telegraf.conf

# 아래 outputs.influxdb_v2 항목을 내 환경에 맞게 수정

# # Configuration for sending metrics to InfluxDB
  [[outputs.influxdb_v2]]
#   ## The URLs of the InfluxDB cluster nodes.
#   ##
#   ## Multiple URLs can be specified for a single cluster, only ONE of the
#   ## urls will be written to each interval.
#   ##   ex: urls = ["https://us-west-2-1.aws.cloud2.influxdata.com"]
    urls = ["http://127.0.0.1:8086"]
#
#   ## Token for authentication.
    token = "**********************************=="
#
#   ## Organization is the name of the organization you wish to write to; must exist.
    organization = "test"
#
#   ## Destination bucket to write into.
    bucket = "test-bucket"
#
#   ## The value of this tag will be used to determine the bucket.  If this
#   ## tag is not set the 'bucket' option is used as the default.
#   # bucket_tag = ""
#
#   ## If true, the bucket tag will not be added to the metric.
#   # exclude_bucket_tag = false
#
#   ## Timeout for HTTP messages.
    timeout = "5s"

 

위의 정보들을 잘 모를 때에는 아래 게시판 참조 하세요.

[token]

https://dirt-spoon.tistory.com/267

 

[org]

https://dirt-spoon.tistory.com/269

 

'기술 노트 > ubuntu' 카테고리의 다른 글

MIB search path: mibs  (0) 2024.03.15
influxdb org 확인 하기  (0) 2024.03.15
influxdb token 확인하기  (0) 2024.03.15
telegraf 설치하기  (1) 2024.03.15
InfluxDB 2.x 설치하기  (1) 2024.03.15

공식 사이트 정보

https://www.influxdata.com/downloads/

 

InfluxData Downloads

Register your download Get access to the new InfluxDB Open Source Software Onboarding Guide, product updates, and free InfluxDB stickers!

www.influxdata.com

 

설치 방법

# 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

 

root@syslogserver:~# apt install telegraf
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다... 완료
상태 정보를 읽는 중입니다... 완료
다음 새 패키지를 설치할 것입니다:
  telegraf
0개 업그레이드, 1개 새로 설치, 0개 제거 및 5개 업그레이드 안 함.
60.4 M바이트 아카이브를 받아야 합니다.
이 작업 후 225 M바이트의 디스크 공간을 더 사용하게 됩니다.
받기:1 https://repos.influxdata.com/debian stable/main amd64 telegraf amd64 1.30.0-1 [60.4 MB]
내려받기 60.4 M바이트, 소요시간 7초 (8,265 k바이트/초)
Selecting previously unselected package telegraf.
(데이터베이스 읽는중 ...현재 329648개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../telegraf_1.30.0-1_amd64.deb ...
Unpacking telegraf (1.30.0-1) ...
telegraf (1.30.0-1) 설정하는 중입니다 ...
Created symlink /etc/systemd/system/multi-user.target.wants/telegraf.service → /lib/systemd/system/telegraf.service.
root@syslogserver:~# systemctl enable telegraf.service
root@syslogserver:~#

 

'기술 노트 > ubuntu' 카테고리의 다른 글

telegraf 설정하기  (0) 2024.03.15
influxdb token 확인하기  (0) 2024.03.15
InfluxDB 2.x 설치하기  (1) 2024.03.15
sudo 권한 부여하기  (0) 2024.03.11
snmp-exporter에 MIB 등록하기  (1) 2024.02.07

+ Recent posts