πΊ λͺ©μ°¨ πΊ(보μλ €λ©΄ μλ λ보기 λ₯Ό λλ¬μ£ΌμΈμ.)
1. netdata
- netdataλ μ€νμμ€ λͺ¨λν°λ§ μμ€ν μΌλ‘ μ λͺ νλ€κ³ νλ€μ. μ λ μ΅κ·Όμ μκ² λμμ΅λλ€.
- μ€μΉ λ¬΄μ² μ½μ΅λλ€.
- μμ€ν μ cpu μ¬μ©λ, λ€νΈμν¬ μ¬μ©λ λ±μ νμΈν μ μμ΅λλ€.
- λ컀 컨ν μ΄λ κ°κ°μ λν΄μλ μμ κ°μ μ 보λ₯Ό λ³΄μ€ μ μμ΅λλ€.
- netdata cloudλ₯Ό μ΄μ©νμ¬ μλ²λ₯Ό κ΄λ¦¬ν μλ μμ΅λλ€.
2. μ€μΉ λ°©λ²
λ°λ‘ μ΄μ κ²μκΈμμ μμ ν μμ€λ₯Ό κ·Έλλ‘ μ¬μ©ν©λλ€.
κ°. docker-compose.yml μμ
### μλΆλΆ λμΌ ###
services:
front_nginx:
container_name: front_nginx_cname
image: mungkhs/nginxwaf:1.1 #DockerHubμ μ¬λ €μ§ μ°λ¦¬μ μ΄λ―Έμ§λ₯Ό μ΄μ©ν¨.
restart: always
privileged: true
ports:
- "80:80"
- "81:81"
- "82:82"
- "8685:8685" #vnstat
- "19999:19999" #netdata - π΄μλ‘ μΆκ°λ λΆλΆ
volumes:
- ./docker/front/default.conf:/usr/local/nginx/conf.d/default.conf
### μ€κ° λΆλΆ λμΌ ###
### π΄κΈ°μ‘΄ μλ«μͺ½ volumes: λ°λ‘ μμ μΆκ°π΄ ###
netdata:
image: netdata/netdata
container_name: netdata
hostname: mungmung.kr #hostnameμ μνλλλ‘ μ
λ ₯
expose:
- 19999
#ports:
# - 19999:19999
restart: unless-stopped
cap_add:
- SYS_PTRACE
security_opt:
- apparmor:unconfined
volumes:
- netdataconfig:/etc/netdata
- netdatalib:/var/lib/netdata
- netdatacache:/var/cache/netdata
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /etc/os-release:/host/etc/os-release:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- mung_net
volumes:
vnstatdb:
netdataconfig: #π΄μλ‘ μΆκ°λ λΆλΆ
netdatalib: #π΄μλ‘ μΆκ°λ λΆλΆ
netdatacache: #π΄μλ‘ μΆκ°λ λΆλΆ
λ. docker/front/default.conf νμΌμ μλ λ΄μ© μΆκ°
server {
listen 19999;
location / {
proxy_pass http://netdata:19999;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
}
π΄ λ°©νλ²½μμ 19999 ν¬νΈλ₯Ό μ΄μ΄μ£Όμ΄μΌ ν©λλ€.
λ€. μ΄μ 컨ν μ΄λλ₯Ό μμ± ν 19999λ² ν¬νΈλ‘ μ μμ νλ©΄ μλμ κ°μ΄ μλ²λ₯Ό λͺ¨λν°λ§ ν μ μμ΅λλ€.
3. netdata API
κ°. netdata API λ₯Ό μ΄μ©νλ©΄ μλμ κ°μ΄ μμ λ§μ 컀μ€ν νμ΄μ§λ₯Ό λ§λλ κ²λ κ°λ₯ν©λλ€.
λ. netdata.html μμ€
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<script>var netdataNoBootstrap = true;</script>
<script src="http://μλ²μμ΄νΌ:19999/dashboard.js"></script>
</head>
<body>
<div class="grid grid-cols-4 gap-4">
<div>
<embed src="http://μλ²μμ΄νΌ:19999/api/v1/badge.svg?chart=system.cpu&refresh=auto&scale=150" />
</div>
<div>
<embed
src="http://μλ²μμ΄νΌ:19999/api/v1/badge.svg?chart=system.cpu&alarm=10min_cpu_usage&refresh=auto&scale=150" />
</div>
<div>
<embed
src="http://μλ²μμ΄νΌ:19999/api/v1/badge.svg?chart=system.ram&alarm=ram_in_use&refresh=auto&scale=150" />
</div>
<div>
<embed
src="http://μλ²μμ΄νΌ:19999/api/v1/badge.svg?chart=disk_space._&alarm=disk_space_usage&refresh=auto"
type="image/svg+xml" height="20" />
</div>
</div>
<br/>
<div class="grid grid-cols-5 gap-4">
<div data-netdata="system.cpu" data-host="http://μλ²μμ΄νΌ:19999/" data-gauge-max-value="100"
data-chart-library="gauge" data-width="80%" data-after="-540" data-points="540" data-title="CPU"
data-units="%" data-colors="#2c9588" data-gauge-generate-gradient="[0, 80, 100]"
data-gauge-gradient-percent-color-0="#2c9588" data-gauge-gradient-percent-color-80="#c96667"
data-gauge-gradient-percent-color-100="#ff3300" class="netdata-container">
</div>
<div data-netdata="disk_space._" data-host="http://μλ²μμ΄νΌ:19999/" data-title="disk space"
data-append-options="percentage" data-decimal-digits="0" data-dimensions="used" data-chart-library="gauge"
data-width="100%" data-height="80%" data-after="-300" data-points="300" data-gauge-max-value="100"
data-colors="#ffffff" data-gauge-generate-gradient="[0, 70, 100]"
data-gauge-gradient-percent-color-0="#ffffff" data-gauge-gradient-percent-color-70="d88b2f"
data-gauge-gradient-percent-color-100="#ff3300" data-units="%">
</div>
</div>
<br/>
<div class="grid grid-cols-5 gap-4">
<div class="netdata-container-easypiechart" data-netdata="system.ram" data-host="http://μλ²μμ΄νΌ:19999/"
data-dimensions="used|buffers|active|wired" data-append-options="percentage"
data-chart-library="easypiechart" data-title="Used RAM" data-units="%" data-easypiechart-max-value="100"
data-width="50%" data-after="-540" data-points="540" data-colors="#EE9911" role="application">
</div>
<div data-netdata="system.io" data-host="http://μλ²μμ΄νΌ:19999/" data-dimensions="in"
data-chart-library="easypiechart" data-title="Disk Read" data-width="50%" data-points="540"
data-common-units="system.io.mainhead" role="application">
</div>
<div data-netdata="system.io" data-host="http://μλ²μμ΄νΌ:19999/" data-dimensions="out"
data-chart-library="easypiechart" data-title="Disk Write" data-width="50%" data-points="540"
data-common-units="system.io.mainhead" role="application">
</div>
<div data-netdata="system.net" data-width="50%" data-host="http://μλ²μμ΄νΌ:19999/"
data-dimensions="received" data-chart-library="easypiechart" data-title="Net Inbound" data-width="11%"
data-points="540" data-common-units="system.net.mainhead" role="application">
</div>
<div data-netdata="system.net" data-host="http://μλ²μμ΄νΌ:19999/" data-width="50%" data-dimensions="sent"
data-chart-library="easypiechart" data-title="Net Outbound" data-width="11%" data-points="540"
data-common-units="system.net.mainhead" role="application">
</div>
</div>
<br/>
<div class="grid grid-cols-2 gap-4">
<div data-netdata="system.cpu" data-host="http://μλ²μμ΄νΌ:19999/" data-width="100%" data-height="260px"
data-legend="no" role="application">
</div>
<div data-netdata="cgroup_front_nginx_cname.cpu_limit" data-width="100%"
data-dygraph-valuerange="[0, null]" data-decimal-digits="-1" data-legend-position="bottom">
</div>
</div>
<br/>
<br/>
</body>
</html>
4. netdata cloud
κ°. μλ²μ μ€μΉν netdata μλ£λ₯Ό netdata cloud μμλ νμΈμ΄ κ°λ₯ν©λλ€.
λ¨, μ΄λ₯Ό μν΄μλ netdata cloudμμ ν ν°κ°μ λ°κΈλ°μ μλ²μμ 컨ν μ΄λλ₯Ό λ€μ μμ±ν΄ μ£Όμ΄μΌ ν©λλ€.
λ. netdata cloud μμλ μ¬λ¬κ°μ μλ²λ₯Ό νκΊΌλ²μ κ΄λ¦¬ν μ μμ΅λλ€.
λ€. κ²½κ³ κ° λ°μν κ²½μ° λ±λ‘ν μ΄λ©μΌλ‘ λ΄μ©μ μ¦μ 보λ΄μ€λλ€.
πΊπΊ μμ ν λͺ¨λ μμ€λ μλ λ§ν¬μμ νμΈνμ€ μ μμ΅λλ€. πΊπΊ
https://github.com/mmssem/ServerMonitoring
GitHub - mmssem/ServerMonitoring
Contribute to mmssem/ServerMonitoring development by creating an account on GitHub.
github.com