起因
為了看機器狀態
使用方法
docker-compose.yml
version: '3'
services:
netdata:
image: netdata/netdata
container_name: netdata
pid: host
network_mode: host
restart: unless-stopped
cap_add:
- SYS_PTRACE
- SYS_ADMIN
security_opt:
- apparmor:unconfined
volumes:
- netdataconfig:/etc/netdata
- netdatalib:/var/lib/netdata
- netdatacache:/var/cache/netdata
- /:/host/root:ro,rslave
- /etc/passwd:/host/etc/passwd:ro
- /etc/group:/host/etc/group:ro
- /etc/localtime:/etc/localtime:ro
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /etc/os-release:/host/etc/os-release:ro
- /var/log:/host/var/log:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes:
netdataconfig:
netdatalib:
netdatacache:
如何使用 dashboard.js 再自行客製化
將以下檔案 {{YOUR_NET_DATA_IP}} 處更換為您自己的netdata docker ip 就可以再將 此index.html 打開 看效果了
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
</head>
<body>
<!-- <div data-netdata="system.processes" data-chart-library="dygraph" data-width="600" data-height="200"
data-after="-600"></div> -->
<div style="margin:30px">
<div class="dash-graph" data-netdata="system.cpu" data-dygraph-valuerange="[0, 100]">
</div>
<!-- <div class="dash-graph" data-netdata="system.load"> -->
</div>
<div class="dash-graph" data-netdata="system.ram">
</div>
<div class="dash-graph" data-netdata="disk_space._">
</div>
<div class="dash-graph" data-netdata="system.net">
</div>
<!-- <div class="dash-graph" data-netdata="system.processes">
</div> -->
<div class="dash-graph" data-netdata="apps.cpu">
</div>
<!-- <div class="dash-graph" data-netdata="apps.mem">
</div> -->
<div class="dash-chart" data-netdata="system.net" data-dimensions="received" data-title="Net Inbound"
data-common-units="dash.net">
</div>
<div class="dash-chart" data-netdata="system.net" data-dimensions="sent" data-title="Net Outbound"
data-common-units="dash.net">
</div>
</div>
</body>
<script type="text/javascript" src="http://{{YOUR_NET_DATA_IP}}/dashboard.js"></script>
</html>