/
Managing CloudHub agent configuration

Managing CloudHub agent configuration

๊ฐœ์š”

CloudHub๋Š” SaltStack์„ ํ™œ์šฉํ•œ Collector(Telegraf) installation & configuration provisioning์„ ์ง€์›ํ•˜๋ฉฐ, Salt API๋ฅผ ํ†ตํ•˜์—ฌ ๊ฐ Salt Minion์ด ์„ค์น˜๋˜์–ด ์žˆ๋Š” ํ˜ธ์ŠคํŠธ๋“ค์˜ Collector(Telegraf)๋ฅผ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Minions

Agent Configuration์˜ Minions์€ Salt Minion์„ Accept, Reject, Delete ๊ธฐ๋Šฅ์„ ํ†ตํ•ด Salt Minion์ด ์„ค์น˜๋œ ํ˜ธ์ŠคํŠธ๋ฅผ Salt Master์˜ ์—ฐ๊ฒฐ ๋ฐ ์—ฐ๊ฒฐ ํ•ด์ง€ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

Accept๋œ Host์— ๋Œ€ํ•œ OS, OS Version, IP ์ •๋ณด๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

Salt Minion ์„ค์น˜ : Installing Agent Node

Minions ์ดˆ๊ธฐํ™”๋ฉด

ย 

Accept Minion

1๋‹จ๊ณ„ : Minions ๋ฆฌ์ŠคํŠธ์—์„œ Operation์˜ ๋ฒ„ํŠผ ํด๋ฆญ

Accept, Delete๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋„๋ก ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

ย 

2๋‹จ๊ณ„ : Accept ํด๋ฆญ

Acceptํ•œ Host์˜ ๊ฒฐ๊ณผ๊ฐ€ Console์— ์ถœ๋ ฅ๋˜๊ณ  Minions ๋ฆฌ์ŠคํŠธ๋Š” ์ƒˆ๋กœ ๊ณ ์นจ ๋˜์–ด Status๊ฐ€ Accepted๋กœ ๋ณ€๊ฒฝ๋˜์–ด ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

ย 

Accept๋œ Host์˜ ํ•œํ•ด์„œ OS, OS Version, IP ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜์ง€๋งŒ, Accept ํ›„ ๋ฐ”๋กœ ์กฐํšŒ๋˜์ง€ ์•Š๊ณ  ์•ฝ 5์ดˆ ํ›„ ์žฌ ์กฐํšŒ ์‹œ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

ย 

Reject Minion

1๋‹จ๊ณ„ : Minions ๋ฆฌ์ŠคํŠธ์—์„œ Status๊ฐ€ Accepted์ธ Host์˜ Operation์˜ ๋ฒ„ํŠผ ํด๋ฆญ

Reject, Delete๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋„๋ก ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

2๋‹จ๊ณ„ : Reject ํด๋ฆญ

Rejectํ•œ Host์˜ ๊ฒฐ๊ณผ๊ฐ€ Console์— ์ถœ๋ ฅ๋˜๊ณ  Minions ๋ฆฌ์ŠคํŠธ๋Š” ์ƒˆ๋กœ๊ณ ์นจ ๋˜์–ด Status๊ฐ€ Reject๋กœ ๋ณ€๊ฒฝ๋˜์–ด ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ Reject๋œ Host์˜ OS, OS Version ์€ ์ถœ๋ ฅ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

Delete Minion

1๋‹จ๊ณ„ : Minions ๋ฆฌ์ŠคํŠธ์—์„œ Status๊ฐ€ Accepted, Reject, UnAccept์ธ Host์˜ Operation์˜ ๋ฒ„ํŠผ ํด๋ฆญ

Delete๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋„๋ก ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

ย 

2๋‹จ๊ณ„ : Delete ํด๋ฆญ

Deleteํ•œ Host์˜ ๊ฒฐ๊ณผ๊ฐ€ Console์— ์ถœ๋ ฅ๋˜๊ณ  Minions ๋ฆฌ์ŠคํŠธ์—์„œ ์‚ญ์ œํ•œ Host๋ฅผ ์ œ์™ธํ•œ Host ๋ฆฌ์ŠคํŠธ๊ฐ€ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

ย 

Host Delete ์‹œ ํ•ด๋‹น Host๋ฅผ Minions์—์„œ ์žฌํ™œ์šฉํ•˜๋ ค๋ฉด Host์˜ Salt Minion์˜ Service๋ฅผ ์žฌ์‹œ์ž‘ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Host ์‹œ์Šคํ…œ ์ •๋ณด ์กฐํšŒ

1๋‹จ๊ณ„ : Minions ๋ฆฌ์ŠคํŠธ์—์„œ Accepted ํด๋ฆญ

์•„๋ž˜์™€ ๊ฐ™์ด ํ•ด๋‹น Host์˜ ๊ธฐ๋ณธ ์‹œ์Šคํ…œ ์ •๋ณด๋ฅผ ์กฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

saltversion: '3001.1' master: 192.168.34.59 os_family: RedHat os: CentOS osrelease: 7.8.2003 kernel: Linux kernelrelease: 3.10.0-1127.10.1.el7.x86_64 kernelversion: '#1 SMP Wed Jun 3 14:28:03 UTC 2020' virtual: VirtualBox cpuarch: x86_64 cpu_model: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz localhost: master-node ip_interfaces: lo: - 127.0.0.1 - '::1' enp0s3: - 192.168.34.59 - 'fe80::4950:5197:f54a:a40a' - 'fe80::33f6:4558:84d0:d45b' - 'fe80::2de:4527:4cc5:fb1f' enp0s8: - 10.0.2.97 - 'fe80::7631:a2d3:1c41:ecf3' docker0: - 172.17.0.1 ip6_interfaces: lo: - '::1' enp0s3: - 'fe80::4950:5197:f54a:a40a' - 'fe80::33f6:4558:84d0:d45b' - 'fe80::2de:4527:4cc5:fb1f' enp0s8: - 'fe80::7631:a2d3:1c41:ecf3' docker0: [] ip4_gw: 10.0.2.1 ip6_gw: false 'dns:nameservers': - 208.67.220.220 - 8.8.8.8 - 168.126.63.1 locale_info: defaultlanguage: en_US defaultencoding: UTF-8 detectedencoding: UTF-8 timezone: unknown biosversion: VirtualBox mem_total: 990 swap_total: 819 gpus: - vendor: vmware model: SVGA II Adapter selinux: enabled: true enforced: Enforcing path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin'

Client SSH

Client SSH๋ฅผ ์ˆ™์ง€ํ•˜์„ธ์š”. (์ฝ๋Š” ์‹œ๊ฐ„: 5๋ถ„ ๋ฏธ๋งŒ)

1๋‹จ๊ณ„ : Minions ๋ฆฌ์ŠคํŠธ์—์„œ Operation์˜ ๋ฒ„ํŠผ ํด๋ฆญํ•˜๋ฉด ํ„ฐ๋ฏธ๋„ ์ž…๋ ฅ์ฐฝ์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. ์ž…๋ ฅ์ฐฝ์˜ ADDRESS ํ•„๋“œ๋Š” ๋ฏธ๋‹ˆ์–ธ์ด ๊ฐ€์ง€๊ณ  ์žˆ๋Š” IP์„ ๊ธฐ๋ณธ์œผ๋กœ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

ย 

2๋‹จ๊ณ„ : ํ„ฐ๋ฏธ๋„ ์ž…๋ ฅ์ฐฝ์— ์ ‘์† ์ •๋ณด๋ฅผ ์ž…๋ ฅ๋ฅผ ์ž…๋ ฅํ•˜๊ณ , [Connect] ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

ย 

3๋‹จ๊ณ„ : ์ •์ƒ ์ ‘์†์ด ๋˜๋Š” ๊ฒฝ์šฐ ํ•˜๋‹จ์˜ ์ด๋ฏธ์ง€์™€ ๋น„์Šทํ•˜๊ฒŒ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

ย 

##

Collector Control

Collector Control์€ Accepted ๋œ Host์— ๋Œ€ํ•ด Collector(Telegraf) ์„ค์น˜ ๋ฐ Collector(Telegraf) ์„œ๋น„์Šค๋ฅผ ์‹คํ–‰ ๋ฐ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

INSTALL Collector

1๋‹จ๊ณ„ : Collector Control ํƒญ ๋ฉ”๋‰ด ํด๋ฆญ

  • Minions ํƒญ ๋ฉ”๋‰ด์—์„œ Accept ๋œ Host๊ฐ€ ๋ฆฌ์ŠคํŠธ์— ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

  • ์„ ํƒ๋œ Host๊ฐ€ ์—†์œผ๋ฉด RUN, STOP, INSTALL ๋ฒ„ํŠผ์€ ๋น„ํ™œ์„ฑํ™”๋ฉ๋‹ˆ๋‹ค.

2๋‹จ๊ณ„ : Installํ•  Host์˜ ์ฒดํฌ ๋ฐ•์Šค ์„ ํƒ

Host ์ฒดํฌ ๋ฐ•์Šค ์„ ํƒ์„ ํ•˜๊ฒŒ ๋˜๋ฉด RUN, STOP, INSTALL ๋ฒ„ํŠผ์€ ํ™œ์„ฑํ™”๋ฉ๋‹ˆ๋‹ค.

3๋‹จ๊ณ„ : INSTALL ๋ฒ„ํŠผ ํด๋ฆญ

Collector(Telegraf) Installํ•œ Host์˜ ๊ฒฐ๊ณผ๊ฐ€ Console์— ์ถœ๋ ฅ๋˜๊ณ  Minions ๋ฆฌ์ŠคํŠธ์—์„œ Enabled๊ฐ€ Enable๋กœ ๋ณ€๊ฒฝ๋˜์–ด ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

Installing Server Node | Download telegraf into salt path on salt master์— ๋‹ค์šด๋กœ๋“œ ๋ฐ›์€ Telegraf ๋ฒ„์ „์œผ๋กœ ์„ค์น˜๋˜๋ฉฐ, ํ˜ธํ™˜ ๋ฒ„์ „์€ ์ฐจํ›„ ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

RUN Collector

Collector(Telegraf)๊ฐ€ ์„ค์น˜๋œ Host์˜ ํ•œํ•ด Collector(Telegraf)๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • Minions ๋ฆฌ์ŠคํŠธ์˜ Action์˜ โ–ถ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ Collector(Telegraf)๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • Minions ๋ฆฌ์ŠคํŠธ์—์„œ ์‹คํ–‰ํ•  Host๋ฅผ ์„ ํƒํ•˜๊ณ  RUN์„ ํด๋ฆญํ•ด๋„ Collector(Telegraf)๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹คํ–‰ ๊ฒฐ๊ณผ

STOP Collector

Collector(Telegraf)๊ฐ€ ์„ค์น˜๋œ Host์˜ ํ•œํ•ด Collector(Telegraf)๊ฐ€ ์‹คํ–‰ ์ค‘์ธ ๊ฒฝ์šฐ ์„œ๋น„์Šค๋ฅผ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • Minions ๋ฆฌ์ŠคํŠธ์˜ Action์˜ โ–  ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ Collector(Telegraf)๋ฅผ ์„œ๋น„์Šค๋ฅผ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • Minions ๋ฆฌ์ŠคํŠธ์—์„œ Collector(Telegraf) ์„œ๋น„์Šค๋ฅผ ์ค‘์ง€ํ•  Host๋ฅผ ์„ ํƒํ•˜๊ณ  STOP์„ ํด๋ฆญํ•ด๋„ ์ค‘์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹คํ–‰ ๊ฒฐ๊ณผ

Collector Config

Collector Config ํƒญ ๋ฉ”๋‰ด๋Š” Host๊ฐ€ Salt Master์— Accept ๋˜์–ด ์žˆ๊ณ  Collector(Telegraf)๊ฐ€ ์„ค์น˜๋œ Host์— ๋Œ€ํ•œ Measurements ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๊ณ  Collector(Telegraf) Configuration ์ •๋ณด๋ฅผ Editor๋ฅผ ์ด์šฉํ•ด ์ˆ˜์ •ํ•œ ํ›„ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

CloudHub Collector์˜ ๊ฒฝ์šฐ, ์˜คํ”ˆ์†Œ์Šค Telegraf๋ฅผ ํ™œ์šฉํ•˜๋ฉฐ, Telegraf๊ฐ€ ์ง€์›ํ•˜๋Š” ๋ชจ๋“  plugin์„ ์ˆ˜๋™์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (๋‹จ, ์ด ๊ฒฝ์šฐ ๊ธฐ์ˆ  ์ง€์›์— ์ œ์•ฝ์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.)

Telegraf์—์„œ ์ง€์›ํ•˜๋Š” plugin ๋ชฉ๋ก ๋ฐ ์„ค์ • ๋ฐฉ๋ฒ•์€ https://github.com/snetsystems/telegraf#input-plugins ์—์„œ ์ž์„ธํžˆ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋˜ํ•œ, [Online Only] Case Study์—์„œ ์˜ˆ์ œ๋ฅผ ์ฐธ๊ณ  ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Collector.conf ์ˆ˜์ • ๋ฐ ์ ์šฉ

1๋‹จ๊ณ„ : Collector Config ํƒญ ๋ฉ”๋‰ด ํด๋ฆญ

Minions ๋ฆฌ์ŠคํŠธ์— Host๊ฐ€ Salt Master์— Accept ๋˜์–ด ์žˆ๊ณ  Collector(Telegraf)๊ฐ€ ์„ค์น˜๋œ Host๊ฐ€ ๋ฆฌ์ŠคํŠธ์— ์กฐํšŒ๋ฉ๋‹ˆ๋‹ค.

2๋‹จ๊ณ„ : ์กฐํšŒ๋œ Host ํด๋ฆญ

์„ ํƒ๋œ Host์— ํ•ด๋‹นํ•˜๋Š” Measurements ์ •๋ณด์™€ collector์˜ Configuration ์ •๋ณด๊ฐ€ collector.conf Editor์— ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

ย 

3๋‹จ๊ณ„ : collector.conf Editor์˜ Configuration ์ˆ˜์ •

[global_tags] dc = "" rack = "" [agent] interval = "5s" round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "0s" flush_interval = "5s" flush_jitter = "0s" precision = "" debug = false quiet = false logfile = "/var/log/telegraf/telegraf.log" hostname = "minion01" omit_hostname = false [[outputs.influxdb]] urls = ["http://<influxdb_address:port>"] database = "" username = "" password = "" retention_policy = "" write_consistency = "any" timeout = "5s" [[inputs.cpu]] percpu = true totalcpu = true collect_cpu_time = false report_active = false [[inputs.disk]] ignore_fs = [ "tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs" ] [[inputs.diskio]] [[inputs.kernel]] [[inputs.mem]] [[inputs.net]] [[inputs.processes]] [[inputs.procstat]] exe = "salt" [[inputs.swap]] [[inputs.system]] [[inputs.netstat]] [[inputs.influxdb]] urls = [ "http://<influxdb_address:port>/debug/vars" ] [[inputs.kapacitor]] urls = [ "http://<kapacitor_address:port>/kapacitor/v1/debug/vars" ] timeout = "5s"

ํ•ด๋‹น Host์— Host Name๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ [agent]์— hostname๋ฅผ ์ง€์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
hostname = "minion01" (๊ณต๋ฐฑ ๋ฌธ์ž ์ฆ‰, ๋„์–ด์“ฐ๊ธฐ ๋ถˆ๊ฐ€)

4๋‹จ๊ณ„ : โ€œAPPLYโ€ ๋ฒ„ํŠผ ํด๋ฆญ

Collector(Telegraf) ์˜ Configuration ์ด ์ ์šฉ๋˜๊ณ  Collector(Telegraf) Service๊ฐ€ ์žฌ์‹œ์ž‘๋ฉ๋‹ˆ๋‹ค.

  • ๋ฐ์ดํ„ฐ ํ™•์ธ

Visualize ๋ฉ”๋‰ด ํ™•์ธ

Infrastructure ๋ฉ”๋‰ด ํ™•์ธ

Collector.conf Test

1๋‹จ๊ณ„ : Collector Config ํƒญ ๋ฉ”๋‰ด ํด๋ฆญ

Minions ๋ฆฌ์ŠคํŠธ์— Host๊ฐ€ Salt Master์— Accept ๋˜์–ด ์žˆ๊ณ  Collector(Telegraf)๊ฐ€ ์„ค์น˜๋œ Host๊ฐ€ ๋ฆฌ์ŠคํŠธ์— ์กฐํšŒ๋ฉ๋‹ˆ๋‹ค.

ย 

2๋‹จ๊ณ„ : ์กฐํšŒ๋œ Host ํด๋ฆญ

์„ ํƒ๋œ Host์— ํ•ด๋‹นํ•˜๋Š” Measurements ์ •๋ณด์™€ collector์˜ Configuration ์ •๋ณด๊ฐ€ collector.conf Editor์— ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

ย 

3๋‹จ๊ณ„ : collector.conf Editor์˜ Configuration ์ˆ˜์ •

ย 

4๋‹จ๊ณ„ : โ€œTESTโ€ ๋ฒ„ํŠผ ํด๋ฆญ

โ€œTESTโ€ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๊ฒŒ ๋˜๋ฉด 'Input Plugin'์„ ํ…Œ์ŠคํŠธ ํ•  ์ˆ˜ ์žˆ๋Š” ํŒ์—… ์ฐฝ์ด ๋‚˜์˜ต๋‹ˆ๋‹ค.

ย 

5๋‹จ๊ณ„ : ํŒ์—… ์ฐฝ์˜ โ€œTestโ€ ๋ฒ„ํŠผ ํด๋ฆญ

ํ…Œ์ŠคํŠธํ•  'Input Plugins'์€ ๊ธฐ๋ณธ ๊ฐ’ 'All'๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
'Test' ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด 'Configuration'์— ์ž…๋ ฅํ•œ 'Input Plugin' ๋ชจ๋‘๋ฅผ ํ…Œ์ŠคํŠธํ•œ ๊ฒฐ๊ณผ ๊ฐ’์ด ์ถœ๋ ฅ ๋ฉ๋‹ˆ๋‹ค.

ย 

  • ๋“œ๋กญ ๋‹ค์šด ๋ฉ”๋‰ด๋ฅผ ํด๋ฆญํ•˜๊ฒŒ ๋˜๋ฉด 'Configuration'์— ์ž…๋ ฅํ•œ 'Input Pluginโ€™์ด ์กฐํšŒ ๋ฉ๋‹ˆ๋‹ค.

ย 

  • ์ž…๋ ฅ ์ฐฝ์„ ์ด์šฉํ•˜์—ฌ ์›ํ•˜๋Š” 'Input Plugin'์„ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ย 

  • ํ…Œ์ŠคํŠธ๋ฅผ ์›ํ•˜๋Š” 'Input Plugin'์„ ์„ ํƒํ•œ ํ›„ ํŒ์—… ์ฐฝ์˜ 'Test' ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์„ ํƒํ•œ 'Input Plugin'์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ ๊ฐ’์ด ์ถœ๋ ฅ ๋ฉ๋‹ˆ๋‹ค.

ย 

โ€˜Configurationโ€™์„ ์ˆ˜์ •ํ•œ ํ›„ โ€˜TESTโ€™ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋”๋ผ๋„ โ€˜Configurationโ€™์€ ๋ฐ˜์˜๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์ˆ˜์ •ํ•œ โ€˜Configurationโ€™์„ ๋ฐ˜์˜ํ•˜๋ ค๋ฉด โ€˜APPLYโ€™ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Related content