wget https://dl.influxdata.com/telegraf/releases/telegraf_1.14.3-1_amd64.deb

 

sudo dpkg -i telegraf_1.14.3-1_amd64.deb

 

cd /etc/telegraf

 

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° sudo mv telegraf.conf telegraf.conf_20200607

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° vi telegraf.conf

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° sudo vi telegraf.conf

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° sudo service telegraf start

 

 

yfkwon@DESKTOP-A0P47SN î‚° ~ î‚° sudo service telegraf stop

telegraf process was stopped [ OK ]

 

 

Telegraf에서 system metric 수집하여 elasticsearch에 적재하기

 

Telegraf는 influxdata(사)에서 opensource로 제공하는 plugin 기반의 metric수집 server agent이다.

github url : https://github.com/influxdata/telegraf 

 

telegraf의 역할이 이해하기 어렵게 느껴질 수 있는데, 간단히 말하자면 아래와 같이 input, process, output이 가능하다.

 

Telegraf로 할 수 있는 일

System의 ram, cpu수치를 elasticsearch에 적재

Redis의 data를 elasticsearch에 적재

File log를 influxdb에 적재

 

즉, input plugin으로 뽑아낸 데이터를 output plugin이 지원하는 곳으로 보낼 수 있다.

 

System metric을 elasticsearch로 보내기

 

엘라스틱서치에 시스템 메트릭을 적재하면 kibana, grafana등의 시각화 도구로 쉽게 조회가 가능

 

 

System metric을 elasticsearch에 보내기 위해서는 아래와 같이 telegraf의 설정이 필요하다.

 

# telegraf agent 셋팅# telegraf가 설치된 폴더의 etc/telegraf.conf 설정[agent]

interval = "10s"

round_interval = true

metric_batch_size = 1000

metric_buffer_limit = 10000

collection_jitter = "0s"

flush_interval = "10s"

flush_jitter = "0s"

precision = ""

debug = false

quiet = false

hostname = ""

omit_hostname = false

 

 

### OUTPUT

[[outputs.elasticsearch]]

## 엘라스틱 서치의 full url을 적는다.(http/https 필수)

urls = [ "http://1.123.123.123:9200" ] # required.

## 엘라스틱 서치 타임아웃 시간

## 반드시 agent interval보다 시간으로 설정한다.

## > 그렇지 않으면 context deadline exceeded 에러가 발생한다.

timeout = "60s"

enable_sniffer = false

health_check_interval = "10s"

## elasticsearch에 사용할 index name 설정

index_name = "my-computer-metric-%Y.%m.%d" # required.

 

## 만약 telegraf가 template를 자동으로 만들게 하고싶다면 true 변경

manage_template = false

template_name = "telegraf"

overwrite_template = false

 

 

### INPUT

## 아래 값들은 system metric을 수집하기 위한 plugin이다.# Read metrics about cpu usage

[[inputs.cpu]]

## Whether to report per-cpu stats or not

percpu = true

## Whether to report total system cpu stats or not

totalcpu = true

## Comment this line if you want the raw CPU time metrics

fielddrop = ["time_*"]

 

 

# Read metrics about disk usage by mount point

[[inputs.disk]]

## By default, telegraf gather stats for all mountpoints.

## Setting mountpoints will restrict the stats to the specified mountpoints.

# mount_points = ["/"]

 

## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually

## present on /run, /var/run, /dev/shm or /dev).

ignore_fs = ["tmpfs", "devtmpfs"]

 

 

# Read metrics about disk IO by device

[[inputs.diskio]]

## By default, telegraf will gather stats for all devices including

## disk partitions.

## Setting devices will restrict the stats to the specified devices.

# devices = ["sda", "sdb"]

## Uncomment the following line if you need disk serial numbers.

# skip_serial_number = false

 

 

# Get kernel statistics from /proc/stat

[[inputs.kernel]]

# no configuration

 

 

# Read metrics about memory usage

[[inputs.mem]]

# no configuration

 

 

# Get the number of processes and group them by status

[[inputs.processes]]

# no configuration

 

 

# Read metrics about swap memory usage

[[inputs.swap]]

# no configuration

 

 

# Read metrics about system load & uptime

[[inputs.system]]

# no configuration

 

# Read metrics about network interface usage

[[inputs.net]]

# collect data only about specific interfaces

# interfaces = ["eth0"]

 

[[inputs.netstat]]

# no configuration

 

[[inputs.linux_sysctl_fs]]

# no configuration

상기와 같이 설정하고, telegraf를 실행하면 elasticsearch에 data를 전송을 시작한다.

 

Elastic search의 data 확인

elasticsearch에 telegraf가 수집한 데이터가 잘 들어왔는지 확인하기 위해서 kibana를 사용했다.

 

kibana를 사용해서 index template를 'my-computer-metric-*'로 설정하고 나면 조회가 가능하다.

 

cpu, ram 등의 metric이 확인 된다.

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

sudo apt-get install -y apt-transport-https

 

sudo apt-get install -y software-properties-common wget

 

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

 

sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"

 

sudo apt-get update

 

sudo apt-get install grafana

 

sudo service grafana-server start

 

sudo service grafana-server status

 

 yfkwon@DESKTOP-A0P47SN î‚° ~ î‚° sudo service grafana-server stop

[sudo] password for yfkwon:

* Stopping Grafana Server                                                                                         [ OK ]

 

 

 

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

표 1. 다양한 픽셀 밀도의 구성 한정자

밀도 한정자

설명

ldpi

저밀도(ldpi)의 화면(~120dpi)에 대한 리소스입니다.

mdpi

중밀도(mdpi)의 화면(~160dpi)에 대한 리소스입니다. (이것이 기준 밀도입니다.)

hdpi

고밀도(hdpi)의 화면(~240dpi)에 대한 리소스입니다.

xhdpi

초고밀도(xhdpi)의 화면(~320dpi)에 대한 리소스입니다.

xxhdpi

초초고밀도(xxhdpi)의 화면(~480dpi)에 대한 리소스입니다.

xxxhdpi

초초초고밀도(xxxhdpi) 사용(~640dpi)에 대한 리소스입니다.

nodpi

모든 밀도에 대한 리소스입니다. 이들은 밀도 독립적 리소스입니다. 이 한정자 태그가 지정된 리소스의 경우 현재 화면의 밀도에 관계없이 시스템에서 리소스 크기를 조정하지 않습니다.

tvdpi

mdpi와 hdpi 사이의 화면(약 213dpi)에 대한 리소스입니다. 이 값은 '기본' 밀도 그룹으로 간주되지 않습니다. 대개의 경우 텔레비전용이며 앱에서는 대부분 필요하지 않습니다. 앱은 대부분 mdpi 및 hdpi 리소스를 제공하는 것으로 충분하며 시스템에서 필요에 따라 확장합니다. tvdpi 리소스를 제공해야 한다고 생각되는 경우 1.33*mdpi로 크기를 지정합니다. 예를 들어 mdpi 화면의 100px x 100px 이미지가 tvdpi에서는 133px x 133px입니다.

여러 밀도의 대체 비트맵 드로어블을 만들려면 6가지 기본 밀도 간에 3:4:6:8:12:16 크기 조정 비율을 따라야 합니다. 예를 들어 중밀도 화면에 대한 48x48픽셀의 비트맵 드로어블이 있는 경우 모든 다양한 크기는 다음과 같아야 합니다.

      • 저밀도(ldpi)의 경우 36x36(0.75x)

      • 중밀도(mdpi)의 경우 48x48(1.0x 기준)

      • 고밀도(hdpi)의 경우 72x72(1.5x)

      • 초고밀도(xhdpi)의 경우 96x96(2.0x)

      • 초초고밀도(xxhdpi)의 경우 144x144(3.0x)

      • 초초초고밀도(xxxhdpi)의 경우 192x192(4.0x)

 

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,