环境版本
- centos7
- mysql5.7
- redis5
- prometheus-2.36.1
- n9e-5.8.0
- telegraf-1.22.4
单机版对于很多中小公司足够用了,简单高效、快速直接,建议使用云主机,性能不够了直接升配,可以应对每秒上报的数据点小于100万的情形,如果只是监控机器(每台机器每个周期大概采集200个数据点)采集周期频率设置10秒的话,支撑上限是5万台。
- 系统架构图
安装n9e
1.开始安装
mkdir -p /data/soft/n9e
cd /data/soft/n9e
wget https://github.com/ccfos/nightingale/releases/download/v5.8.0/n9e-5.8.0.tar.gz
tar xf n9e-5.8.0.tar.gz
mysql -uroot -p123456 < docker/initsql/a-n9e.sql
2.配置
sed -i "s#1234#123456#g" etc/server.conf
sed -i "s#1234#123456#g" etc/webapi.conf
## 生成32位随机数
## cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1
## xgBiP5fwu63QXCqAY9tmxwQ5HNXhLo0N
## cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n1
## zMEgjbh4zYrUniQNDOHKdARghuqqkBxl
sed -i '/^SigningKey/c SigningKey = "xgBiP5fwu63QXCqAY9tmxwQ5HNXhLo0N"' etc/webapi.conf
sed -i '/^user001/c user001 = "zMEgjbh4zYrUniQNDOHKdARghuqqkBxl"' etc/webapi.conf
3.配置启动
sed -i "s#/root/gopath/src/n9e/n9e#/data/soft/n9e/n9e#g" etc/service/n9e-server.service
sed -i "s#/root/gopath/src/n9e#/data/soft/n9e#g" etc/service/n9e-server.service
sed -i "s#/root/gopath/src/n9e/n9e#/data/soft/n9e/n9e#g" etc/service/n9e-webapi.service
sed -i "s#/root/gopath/src/n9e#/data/soft/n9e#g" etc/service/n9e-webapi.service
cp etc/service/n9e-server.service /etc/systemd/system/
cp etc/service/n9e-webapi.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable n9e-server
systemctl restart n9e-server
systemctl status n9e-server
systemctl enable n9e-webapi
systemctl restart n9e-webapi
systemctl status n9e-webapi
server默认会监听在19000端口,webapi会监听在18000端口
4.登录
http://ip:18000默认账号root 密码root.2020
telegraf采集端
1.linux基础模块(centos7安装)
mkdir -p /opt/telegraf
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.22.4_linux_amd64.tar.gz
tar xf telegraf-1.22.4_linux_amd64.tar.gz
cp telegraf-1.22.4/usr/bin/telegraf /opt/telegraf/
cat > /opt/telegraf/telegraf.conf <<EOF
[global_tags]
platform = "39wang"
[agent]
## 默认数据收集间隔10s一次
interval = "60s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
## 默认主机名
hostname = ""
omit_hostname = false
[[outputs.opentsdb]]
host = "http://192.168.31.167"
port = 19000
http_batch_size = 50
http_path = "/opentsdb/put"
debug = false
separator = "_"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = true
[[inputs.disk]]
mount_points = ["/","/data1","/data2"]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
devices = ["sda", "sdb", "vd*"]
[[inputs.kernel]]
[[inputs.mem]]
fieldpass = ["*available", "*total","*percent","*used"]
[[inputs.swap]]
fieldpass = ["*used","*total", "*percent"]
[[inputs.processes]]
[[inputs.system]]
fielddrop = ["uptime_format"]
[[inputs.net]]
interfaces = ["eth0"]
ignore_protocol_stats = true
[[inputs.netstat]]
EOF
cat > /etc/systemd/system/telegraf.service <<EOF
[Unit]
Descriptinotallow="telegraf"
After=network.target
[Service]
Type=simple
ExecStart=/opt/telegraf/telegraf --config telegraf.conf
WorkingDirectory=/opt/telegraf
Restart=on-failure
SuccessExitStatus=0
LimitNOFILE=65536
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=telegraf
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable telegraf
systemctl restart telegraf
systemctl status telegraf
2.linux基础模块(centos6安装)
https://dl.influxdata.com/telegraf/releases/telegraf-1.22.4-1.x86_64.rpm
yum install telegraf-1.22.4-1.x86_64.rpm -y
cat > /etc/telegraf/telegraf.conf<<EOF
[global_tags]
platform = "39wang"
[agent]
## 默认数据收集间隔10s一次
interval = "60s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
## 默认主机名
hostname = ""
omit_hostname = false
[[outputs.opentsdb]]
host = "http://192.168.31.167"
port = 19000
http_batch_size = 50
http_path = "/opentsdb/put"
debug = false
separator = "_"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = true
[[inputs.disk]]
mount_points = ["/","/data1","/data2"]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
devices = ["sda", "sdb", "vd*"]
[[inputs.kernel]]
[[inputs.mem]]
fieldpass = ["*available", "*total","*percent","*used"]
[[inputs.swap]]
fieldpass = ["*used","*total", "*percent"]
[[inputs.processes]]
[[inputs.system]]
fielddrop = ["uptime_format"]
[[inputs.net]]
interfaces = ["eth0"]
ignore_protocol_stats = true
[[inputs.netstat]]
EOF
/etc/init.d/telegraf restart
大盘监控模板
- Linux基础监控大盘模板
{
"name": "Linux基础监控大盘模板-平台版",
"tags": "",
"configs": {
"var": [
{
"name": "platform",
"selected": "39wang",
"definition": "web",
"options": [
"39wang"
],
"multi": false
}
],
"version": "2.0.0",
"panels": [
{
"id": "cbe1edf4-aa58-4473-b889-b575486d7bdd",
"type": "row",
"name": "cpu",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 0,
"i": "cbe1edf4-aa58-4473-b889-b575486d7bdd",
"isResizable": false
},
"collapsed": false,
"panels": [
{
"targets": [
{
"refId": "A",
"expr": "cpu_usage_active{cpu='cpu-total',platform=\"$platform\"}"
}
],
"name": "cpu使用率",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"value": 80
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 24,
"x": 0,
"y": 1,
"i": "7e81f68b-6b21-4b0a-accf-873d9701947f",
"isResizable": true
},
"id": "7e81f68b-6b21-4b0a-accf-873d9701947f"
}
]
},
{
"id": "2a6e29a8-c799-4ae9-ad74-e6c15a5ec749",
"type": "row",
"name": "内存",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 1,
"i": "2a6e29a8-c799-4ae9-ad74-e6c15a5ec749",
"isResizable": false
},
"collapsed": false,
"panels": [
{
"targets": [
{
"refId": "A",
"expr": "(mem_total{platform=\"$platform\"} - mem_available{platform=\"$platform\"})/mem_total{platform=\"$platform\"} * 100"
}
],
"name": "内存使用率",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"value": 88
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 0,
"y": 9,
"i": "ee085a33-8b84-48fa-929b-90fc26e651c3",
"isResizable": true
},
"id": "ee085a33-8b84-48fa-929b-90fc26e651c3"
},
{
"version": "2.0.0",
"name": "内存剩余大小",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 8,
"y": 9,
"i": "0f0123ae-3f9f-4e27-a4fe-a313b32ed7e4",
"isResizable": true
},
"targets": [
{
"refId": "A",
"expr": "mem_available{platform=\"$platform\"}"
}
],
"options": {
"standardOptions": {
"util": "bytesSI"
},
"legend": {
"displayMode": "hidden"
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"thresholds": {
"style": "line",
"steps": []
}
},
"links": [],
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"id": "0f0123ae-3f9f-4e27-a4fe-a313b32ed7e4"
},
{
"version": "2.0.0",
"name": "内存总大小",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 16,
"y": 9,
"i": "0833bac0-8bb1-4e08-832b-3da6f098be63",
"isResizable": true
},
"targets": [
{
"refId": "A",
"expr": "mem_total{platform=\"$platform\"}"
}
],
"options": {
"standardOptions": {
"util": "bytesSI"
},
"legend": {
"displayMode": "hidden"
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"thresholds": {
"style": "line",
"steps": []
}
},
"links": [],
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"id": "0833bac0-8bb1-4e08-832b-3da6f098be63"
}
]
},
{
"id": "9c590ce2-ddd1-4d7e-9d09-22df781bc8e2",
"type": "row",
"name": "磁盘",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 2,
"i": "9c590ce2-ddd1-4d7e-9d09-22df781bc8e2",
"isResizable": false
},
"collapsed": false,
"panels": [
{
"targets": [
{
"refId": "A",
"expr": "disk_used_percent{path='/',platform=\"$platform\"}"
},
{
"refId": "B",
"expr": "disk_used_percent{path='/data1',platform=\"$platform\"}"
},
{
"refId": "C",
"expr": "disk_used_percent{path='/data2',platform=\"$platform\"}"
}
],
"name": "磁盘使用率(%)",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"value": 70
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 0,
"y": 3,
"i": "b3b7373b-b54e-47c5-a3a4-dc07024ab628",
"isResizable": true
},
"id": "b3b7373b-b54e-47c5-a3a4-dc07024ab628"
},
{
"version": "2.0.0",
"name": "磁盘剩余大小",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 8,
"y": 3,
"i": "df88a1d6-12ed-4384-b429-cdea49f2d64a",
"isResizable": true
},
"targets": [
{
"refId": "A",
"expr": "disk_free{path='/',platform=\"$platform\"}"
},
{
"refId": "B",
"expr": "disk_free{path='/data1',platform=\"$platform\"}"
},
{
"refId": "C",
"expr": "disk_free{path='/data2',platform=\"$platform\"}"
}
],
"options": {
"standardOptions": {
"util": "bytesSI"
},
"legend": {
"displayMode": "hidden"
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"thresholds": {
"style": "line",
"steps": []
}
},
"links": [],
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"id": "df88a1d6-12ed-4384-b429-cdea49f2d64a"
},
{
"version": "2.0.0",
"name": "磁盘总大小",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 16,
"y": 3,
"i": "a802277a-3708-4fe0-b553-1b9d88259d71",
"isResizable": true
},
"targets": [
{
"refId": "A",
"expr": "disk_total{path='/',platform=\"$platform\"}"
},
{
"refId": "B",
"expr": "disk_total{path='/data1',platform=\"$platform\"}"
},
{
"refId": "C",
"expr": "disk_total{path='/data2',platform=\"$platform\"}"
}
],
"options": {
"standardOptions": {
"util": "bytesSI"
},
"legend": {
"displayMode": "hidden"
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"thresholds": {
"style": "line",
"steps": []
}
},
"links": [],
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"id": "a802277a-3708-4fe0-b553-1b9d88259d71"
},
{
"targets": [
{
"refId": "A",
"expr": "(disk_inodes_used{path='/',platform=\"$platform\"}/disk_inodes_total{path='/',platform=\"$platform\"})*100"
},
{
"refId": "B",
"expr": "(disk_inodes_used{path='/data1',platform=\"$platform\"}/disk_inodes_total{path='/data1',platform=\"$platform\"})*100",
"legendFormat": ""
},
{
"refId": "C",
"expr": "(disk_inodes_used{path='/data2',platform=\"$platform\"}/disk_inodes_total{path='/data2',platform=\"$platform\"})*100",
"legendFormat": ""
}
],
"name": "磁盘inodes使用率",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"value": 70
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 0,
"y": 10,
"i": "4b182b78-018e-4071-81d6-ca4971130daf",
"isResizable": true
},
"id": "4b182b78-018e-4071-81d6-ca4971130daf"
},
{
"targets": [
{
"refId": "A",
"expr": "rate(diskio_io_time{name='vda',platform=\"$platform\"}[1m])/10"
},
{
"refId": "B",
"expr": "rate(diskio_io_time{name='vdb',platform=\"$platform\"}[1m])/10"
},
{
"expr": "rate(diskio_io_time{name='sda',platform=\"$platform\"}[1m])/10",
"refId": "C"
}
],
"name": "磁盘IO使用率",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"value": 50
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 8,
"y": 10,
"i": "90e720ce-afbd-461b-bdc5-c9cfbc104c72",
"isResizable": true
},
"id": "90e720ce-afbd-461b-bdc5-c9cfbc104c72"
}
]
},
{
"id": "e19ad144-9667-44ca-b252-d234763f4bef",
"type": "row",
"name": "系统负载",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 3,
"i": "e19ad144-9667-44ca-b252-d234763f4bef",
"isResizable": false
},
"collapsed": true,
"panels": []
},
{
"targets": [
{
"refId": "A",
"expr": "system_load1{platform=\"$platform\"}"
}
],
"name": "1分钟负载",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": []
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 0,
"y": 4,
"i": "8b7204e8-f5d4-4ee5-ba59-2fe794bfafbe",
"isResizable": true
},
"id": "8b7204e8-f5d4-4ee5-ba59-2fe794bfafbe"
},
{
"targets": [
{
"refId": "A",
"expr": "system_load5{platform=\"$platform\"}"
}
],
"name": "5分钟负载",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": []
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 8,
"y": 4,
"i": "92f366b2-f5a3-47c0-b875-5f6a25f37a07",
"isResizable": true
},
"id": "92f366b2-f5a3-47c0-b875-5f6a25f37a07"
},
{
"targets": [
{
"refId": "A",
"expr": "system_load15{platform=\"$platform\"}"
}
],
"name": "15分钟负载",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": []
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 8,
"x": 16,
"y": 4,
"i": "e7f3631d-b9ed-4d52-b425-df2f8e31cd01",
"isResizable": true
},
"id": "e7f3631d-b9ed-4d52-b425-df2f8e31cd01"
},
{
"id": "0236b298-79d2-4554-a4c8-37edea35be0e",
"type": "row",
"name": "swap分区",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 11,
"i": "0236b298-79d2-4554-a4c8-37edea35be0e",
"isResizable": false
},
"collapsed": true,
"panels": []
},
{
"targets": [
{
"refId": "A",
"expr": "swap_used_percent{platform=\"$platform\"} "
}
],
"name": "swap分区使用率",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"value": 80
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 24,
"x": 0,
"y": 12,
"i": "e6ef8a87-a816-4256-8920-58251d9084a6",
"isResizable": true
},
"id": "e6ef8a87-a816-4256-8920-58251d9084a6"
},
{
"id": "3c36b76e-1a6f-4f5c-a5aa-cf6898e3e5a8",
"type": "row",
"name": "网络",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 19,
"i": "3c36b76e-1a6f-4f5c-a5aa-cf6898e3e5a8",
"isResizable": false
},
"collapsed": true,
"panels": []
},
{
"version": "2.0.0",
"name": "入站流量(秒)",
"type": "timeseries",
"layout": {
"h": 7,
"w": 12,
"x": 0,
"y": 20,
"i": "f67d63a9-2e71-430d-906b-5bd0cec99612",
"isResizable": true
},
"targets": [
{
"refId": "A",
"expr": "rate(net_bytes_recv{platform=\"$platform\"}[5m])"
}
],
"options": {
"standardOptions": {
"util": "bytesSI"
},
"legend": {
"displayMode": "hidden"
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"thresholds": {
"style": "line",
"steps": []
}
},
"links": [],
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"id": "f67d63a9-2e71-430d-906b-5bd0cec99612"
},
{
"version": "2.0.0",
"name": "出站流量(秒)",
"type": "timeseries",
"layout": {
"h": 7,
"w": 12,
"x": 12,
"y": 20,
"i": "21566ef8-363c-44c1-bd54-4991ab4f3986",
"isResizable": true
},
"targets": [
{
"refId": "A",
"expr": "rate(net_bytes_sent{platform=\"$platform\"}[5m])"
}
],
"options": {
"standardOptions": {
"util": "bytesSI"
},
"legend": {
"displayMode": "hidden"
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"thresholds": {
"style": "line",
"steps": []
}
},
"links": [],
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"id": "21566ef8-363c-44c1-bd54-4991ab4f3986"
},
{
"id": "1a64ee64-26ba-4fcf-a26b-fb0157ec79ed",
"type": "row",
"name": "进程",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 27,
"i": "1a64ee64-26ba-4fcf-a26b-fb0157ec79ed",
"isResizable": false
},
"collapsed": true,
"panels": []
},
{
"targets": [
{
"refId": "A",
"expr": "processes_total{platform=\"$platform\"}"
}
],
"name": "进程总数",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": []
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 12,
"x": 0,
"y": 28,
"i": "a906376d-73d0-4541-b3e3-67b7356eb933",
"isResizable": true
},
"id": "a906376d-73d0-4541-b3e3-67b7356eb933"
},
{
"targets": [
{
"refId": "A",
"expr": "processes_zombies{platform=\"$platform\"}"
}
],
"name": "假死进程数",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": []
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 12,
"x": 12,
"y": 28,
"i": "bc32e03a-fc8a-4ecc-9649-671451d85a88",
"isResizable": true
},
"id": "bc32e03a-fc8a-4ecc-9649-671451d85a88"
},
{
"id": "e3aa88ea-8fa0-46c9-8e4b-d2c9cf5fd65a",
"type": "row",
"name": "连接数",
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 35,
"i": "e3aa88ea-8fa0-46c9-8e4b-d2c9cf5fd65a",
"isResizable": false
},
"collapsed": true,
"panels": []
},
{
"targets": [
{
"refId": "A",
"expr": "netstat_tcp_established{platform=\"$platform\"}"
}
],
"name": "已建立的连接数",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": []
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 12,
"x": 0,
"y": 36,
"i": "142f6260-978c-4414-bd9f-2a7674fd570c",
"isResizable": true
},
"id": "142f6260-978c-4414-bd9f-2a7674fd570c"
},
{
"targets": [
{
"refId": "A",
"expr": "netstat_tcp_close_wait{platform=\"$platform\"}"
}
],
"name": " 等待关闭的连接数",
"links": [],
"options": {
"tooltip": {
"mode": "all",
"sort": "desc"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": []
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"fillOpacity": 0.5,
"stack": "off"
},
"version": "2.0.0",
"type": "timeseries",
"layout": {
"h": 7,
"w": 12,
"x": 12,
"y": 36,
"i": "f0a3f1cd-8e72-4840-9304-e52fbb67308f",
"isResizable": true
},
"id": "f0a3f1cd-8e72-4840-9304-e52fbb67308f"
}
]
}
}
告警模板
[
{
"name": "5分钟系统负载超过CPU核数",
"note": "",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 2,
"disabled": 0,
"prom_for_duration": 120,
"prom_ql": "system_load5{platform=\"web\"}>system_n_cpus{platform=\"web\"}",
"prom_eval_interval": 60,
"enable_stime": "00:00",
"enable_etime": "23:59",
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"email"
],
"notify_repeat_step": 60,
"recover_duration": 0,
"callbacks": [],
"runbook_url": "",
"append_tags": []
},
{
"name": "cpu使用率超过85%,请关注!",
"note": "",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 2,
"disabled": 0,
"prom_for_duration": 120,
"prom_ql": "cpu_usage_active{platform=\"web\",cpu=\"cpu-total\"}>85",
"prom_eval_interval": 60,
"enable_stime": "00:00",
"enable_etime": "23:59",
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"email"
],
"notify_repeat_step": 60,
"recover_duration": 0,
"callbacks": [],
"runbook_url": "",
"append_tags": []
},
{
"name": "swap分区使用率超过50%",
"note": "",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 2,
"disabled": 0,
"prom_for_duration": 120,
"prom_ql": "swap_used_percent{platform=\"web\"} > 50",
"prom_eval_interval": 60,
"enable_stime": "00:00",
"enable_etime": "23:59",
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"email"
],
"notify_repeat_step": 60,
"recover_duration": 0,
"callbacks": [],
"runbook_url": "",
"append_tags": []
},
{
"name": "TCP连接数超过2000",
"note": "",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 2,
"disabled": 0,
"prom_for_duration": 120,
"prom_ql": "netstat_tcp_established{platform=\"web\"} > 2000",
"prom_eval_interval": 60,
"enable_stime": "00:00",
"enable_etime": "23:59",
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"email"
],
"notify_repeat_step": 60,
"recover_duration": 0,
"callbacks": [],
"runbook_url": "",
"append_tags": []
},
{
"name": "内存使用率超过88%,请关注!",
"note": "",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 2,
"disabled": 0,
"prom_for_duration": 120,
"prom_ql": "(mem_total{platform=\"web\"} - mem_available{platform=\"web\"})/mem_total{platform=\"web\"} * 100 >88",
"prom_eval_interval": 60,
"enable_stime": "00:00",
"enable_etime": "23:59",
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"email"
],
"notify_repeat_step": 60,
"recover_duration": 0,
"callbacks": [],
"runbook_url": "",
"append_tags": []
},
{
"name": "根/磁盘inodes使用率超过70%",
"note": "",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 2,
"disabled": 0,
"prom_for_duration": 120,
"prom_ql": "(disk_inodes_used{path='/',platform=\"web\"}/disk_inodes_total{path='/',platform=\"web\"})*100>70",
"prom_eval_interval": 60,
"enable_stime": "00:00",
"enable_etime": "23:59",
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"email"
],
"notify_repeat_step": 60,
"recover_duration": 0,
"callbacks": [],
"runbook_url": "",
"append_tags": []
},
{
"name": "根/磁盘使用率超过70%",
"note": "",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 2,
"disabled": 0,
"prom_for_duration": 120,
"prom_ql": "disk_used_percent{path='/',platform=\"web\"}>70",
"prom_eval_interval": 60,
"enable_stime": "00:00",
"enable_etime": "23:59",
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"email"
],
"notify_repeat_step": 60,
"recover_duration": 0,
"callbacks": [],
"runbook_url": "",
"append_tags": []
}
]