ksh0165 / ReactStudy

업무에 필요한 내용 기록
http://github.com/ksh0165/works.git
0 stars 0 forks source link

20190918 업무 #40

Closed ksh0165 closed 5 years ago

ksh0165 commented 5 years ago

netdata 의 lm-sensors 그래프 그리는 방법 모색

pip install psutil

pip install --upgrade pip

pip install PySensors

https://pypi.org/project/PySensors/

pip install --user --upgrade psutil pip install --user pysensors pip install --user pyqtgraph wget --no-check-certificate https://s3.amazonaws.com/influxdb/influxdb-0.10.0-1.x86_64.rpm

https://www.popit.kr/influxdb_telegraf_grafana_1/

http://wiki.ros.org/arni


redis 설치

wget http://download.redis.io/redis-stable.tar.gz

wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make

sudo make install

redis-server

https://jeong-pro.tistory.com/139

redis 설치 확인

netstat -nlpt | grep 6379

redis-cli을 이용한 기본 명령 https://dejavuqa.tistory.com/155


docker pull tutum/influxdb docker pull grafana/grafana

참고 https://www.popit.kr/influxdb_telegraf_grafana_1/

https://hamait.tistory.com/537

https://swalloow.github.io/influx-grafana1

해결방법:

참고 URL:

ksh0165 commented 5 years ago

도커 커널 설정값 변경

  1. 도커 컨테이너 설정 값 확인 -> docker inspect b24bb0e977d3 "Privileged": false, 값 확인

  2. 해당 컨테이너 중지 + 도커 서비스 중지

  3. 설정 파일 수정 /var/lib/docker/containers/b24bb0e977d3844163fe97ae64290c6b350ec3e0ad51bbea614b51587a937c8f/hostconfig.json -> "Privileged":true 로 변경

  4. 도커 실행 docker exec -u 0 -it b24bb0e977d3 /bin/bash

  5. 도커 컨테이너 안 설정 값 변경

echo 1 >/sys/kernel/mm/ksm/run echo 0 > /proc/sys/kernel/randomize_va_space echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs

[일련의 과정 다시 정리] docker container stop하기 docker service stop하기(service docker stop) docker config file 수정하기(config.v2.json, hostconfig.json) start docker service (service docker start) docker container start하기

참고 https://hyeonbell.tistory.com/142

ksh0165 commented 5 years ago

centos 7 docker 재설치

docker run -it --privileged -p 19999:19999/tcp --name netdata1 -v /etc/localtime:/etc/localtime:ro -e TZ=Asia/Seoul --dns 8.8.8.8 --cap-add=NET_ADMIN --net kafka-docker_default --net-alias nipa --link mysql --link webm --link kafka --link zookeeper -e container=docker -v /sys/fs/cgroup:/sys/fs/cgroup:ro 0702/centos7 /usr/sbin/init

ksh0165 commented 5 years ago

find /sys -maxdepth 11 -name *_input -o -name temp

/usr/lib/netdata/conf.d/charts.d.conf 편집 .../netdata/python.d.conf하고 설정 하여 python.d.plugin에 대한 센서를 비활성화하십시오 sensors: no. 편집 .../netdata/charts.d.conf하고 설정 하여 charts.d.plugin에 센서를 사용하도록 설정하십시오 sensors=force.

netdata install 과정

yum install autoconf automake curl gcc git libmnl-devel libuuid-devel lm-sensors make MySQL-python nc pkgconfig python python-psycopg2 PyYAML zlib-devel -y yum install curl libmnl libuuid lm_sensors nc PyYAML zlib iproute MySQL-python python-psycopg2 make -y yum install -y autoconf automake curl gcc git libmnl-devel libuuid-devel openssl-devel libuv-devel lz4-devel Judy-devel lm_sensors make MySQL-python nc pkgconfig python python-psycopg2 PyYAML zlib-devel git clone https://github.com/firehol/netdata.git --depth=1 cd /etc/netdata ./netdata-installer.sh --install /opt https://kogun82.tistory.com/m/158?category=621790

sudo sensors-detect


find / -type d -name netdata

sudo sensors-detect find / -name python.d.conf vi /opt/netdata/usr/lib/netdata/conf.d/python.d.conf vi /netdata/collectors/python.d.plugin/python.d.conf find / -name charts.d.conf vi /opt/netdata/usr/lib/netdata/conf.d/charts.d.conf vi /netdata/collectors/charts.d.plugin/charts.d.conf cat /var/log/netdata/error.log | grep sensors find /sys -maxdepth 11 -name *_input -o -name temp /opt/netdata/usr/sbin/netdata ./netdata-installer.sh --install /opt

ksh0165 commented 5 years ago

--- Read installation options from netdata.conf --- Netdata user and group is finally set to: netdata/netdata

Permissions
- netdata user             : netdata
- netdata group            : netdata
- web files user           : netdata
- web files group          : netdata
- root user                : root

Directories
- netdata user config dir  : /opt/netdata/etc/netdata
- netdata stock config dir : /opt/netdata/usr/lib/netdata/conf.d
- netdata log dir          : /opt/netdata/var/log/netdata
- netdata run dir          : /opt/netdata/var/run
- netdata lib dir          : /opt/netdata/var/lib/netdata
- netdata web dir          : /opt/netdata/usr/share/netdata/web
- netdata cache dir        : /opt/netdata/var/cache/netdata

Other
- netdata port             : 19999

--- Telemetry configuration --- You can opt out from anonymous statistics via the --disable-telemetry option, or by creating an empty file /opt/netdata/etc/netdata/.opt-out-from-anonymous-statistics

--- Install netdata at system init --- We are running within a docker container, will not be installing netdata service

--- Restarting netdata instance ---

Stopping all netdata threads [/root/netdata]# stop_all_netdata


--- Check KSM (kernel memory deduper) ---

Memory de-duplication instructions

You have kernel memory de-duper (called Kernel Same-page Merging, or KSM) available, but it is not currently enabled.

To enable it run:

echo 1 >/sys/kernel/mm/ksm/run
echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs

If you enable it, you will save 40-60% of netdata memory.

--- Check version.txt --- --- Check apps.plugin --- --- Copy uninstaller --- --- Basic netdata instructions ---

netdata by default listens on all IPs on port 19999, so you can access it with:

http://this.machine.ip:19999/

To stop netdata run:

killall netdata

To start netdata run:

/opt/netdata/usr/sbin/netdata


Uninstall script copied to: /opt/netdata/usr/libexec/netdata/netdata-uninstaller.sh

--- Install netdata updater tool --- Update script is located at /opt/netdata/usr/libexec/netdata/netdata-updater.sh

Cannot figure out the cron directory to handle netdata-updater.sh activation/deactivation --- Wrap up environment set up --- Preparing .environment file Setting netdata.tarball.checksum to 'new_installation'

--- We are done! ---

ksh0165 commented 5 years ago

find 명령어

find /sys -maxdepth 11 -name *_input -o -name temp

/usr/lib/netdata/conf.d/charts.d.conf 편집 .../netdata/python.d.conf하고 설정 하여 python.d.plugin에 대한 센서를 비활성화하십시오 sensors: no. 편집 .../netdata/charts.d.conf하고 설정 하여 charts.d.plugin에 센서를 사용하도록 설정하십시오 sensors=force.

https://github.com/netdata/netdata/issues/858

ksh0165 commented 5 years ago

센서 탭 off 상황 확인

cat /var/log/netdata/error.log | grep sensors

netdata start

/opt/netdata/usr/sbin/netdata

set sensors=force to /etc/netdata/charts.d.conf

cat /var/log/netdata/error.log | grep python

확인 순서

sensors find /sys -maxdepth 11 -name *_input -o -name temp

export NETDATA_HOST_PREFIX="/host" /usr/libexec/netdata/plugins.d/python.d.plugin debug trace 1 cpufreq

sensors 탭 안보일 경우

charts.d.conf 에서 sensors=force 항목 주석 제거 후

.../netdata/netdata-installer.sh 재실행

ksh0165 commented 5 years ago

1) Python3.6 버전을 설치

yum install -y https://centos7.iuscommunity.org/ius-release.rpm

yum install -y python36u

yum install -y python36u-devel

yum install -y python36u-pip

Python3 설치를 위한 IUS Repository1 등록

yum install -y https://centos7.iuscommunity.org/ius-release.rpm

yum update

2) resolv.conf

nameserver 168.126.63.1 nameserver 168.126.63.2