From 2a6e7ae0385dd619ce182f1bcf805432d9242cbd Mon Sep 17 00:00:00 2001 From: kerwenwwer Date: Sat, 6 Apr 2024 18:18:56 +0800 Subject: [PATCH] Delete monitor dir. --- monitor/dashboard.json | 686 ------------------------------------- monitor/datasources.yml | 6 - monitor/default.yaml | 8 - monitor/docker-compose.yml | 50 --- monitor/prometheus.yml | 13 - monitor/veth.sh | 12 - 6 files changed, 775 deletions(-) delete mode 100644 monitor/dashboard.json delete mode 100644 monitor/datasources.yml delete mode 100644 monitor/default.yaml delete mode 100644 monitor/docker-compose.yml delete mode 100644 monitor/prometheus.yml delete mode 100755 monitor/veth.sh diff --git a/monitor/dashboard.json b/monitor/dashboard.json deleted file mode 100644 index 78742f9..0000000 --- a/monitor/dashboard.json +++ /dev/null @@ -1,686 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "description": "Docker monitoring with Prometheus and cAdvisor", - "editable": true, - "fiscalYearStartMonth": 0, - "gnetId": 193, - "graphTooltip": 1, - "id": 3, - "links": [], - "liveNow": false, - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 8, - "x": 0, - "y": 0 - }, - "id": 7, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "mean" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "count(container_last_seen{image!=\"\"})", - "intervalFactor": 2, - "legendFormat": "", - "metric": "container_last_seen", - "refId": "A", - "step": 240 - } - ], - "title": "Running containers", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "mbytes" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 8, - "x": 8, - "y": 0 - }, - "id": 5, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(container_memory_usage_bytes{image!=\"\"})/1024/1024", - "intervalFactor": 2, - "legendFormat": "", - "metric": "container_memory_usage_bytes", - "refId": "A", - "step": 240 - } - ], - "title": "Total Memory Usage", - "transparent": true, - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "match": "null", - "result": { - "text": "N/A" - } - }, - "type": "special" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 8, - "x": 16, - "y": 0 - }, - "id": 6, - "links": [], - "maxDataPoints": 100, - "options": { - "colorMode": "none", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "horizontal", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.0.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(rate(container_cpu_user_seconds_total{name!~\"cadvisor|prometheus|grafana|bpfpgpool-bpf-proxy|bpfpgpool-rpoxy\",image!=\"\"}[5s]) * 100)", - "intervalFactor": 2, - "legendFormat": "", - "metric": "container_memory_usage_bytes", - "refId": "A", - "step": 240 - } - ], - "title": "Total CPU Usage", - "transparent": true, - "type": "stat" - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "decimals": 2, - "editable": true, - "error": false, - "fill": 1, - "fillGradient": 0, - "grid": {}, - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 3 - }, - "hiddenSeries": false, - "id": 2, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": false, - "min": false, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.2", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "rate(container_cpu_user_seconds_total{name!~\"cadvisor|prometheus|grafana|bpfpgpool-bpf-proxy|bpfpgpool-rpoxy\",image!=\"\"}[5s]) * 100", - "intervalFactor": 2, - "legendFormat": "{{name}}", - "metric": "cpu", - "refId": "A", - "step": 10 - } - ], - "thresholds": [], - "timeRegions": [], - "title": "CPU Usage", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "percent", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "decimals": 2, - "editable": true, - "error": false, - "fill": 1, - "fillGradient": 0, - "grid": {}, - "gridPos": { - "h": 7, - "w": 24, - "x": 0, - "y": 10 - }, - "hiddenSeries": false, - "id": 1, - "legend": { - "alignAsTable": true, - "avg": true, - "current": true, - "max": false, - "min": false, - "rightSide": true, - "show": true, - "total": false, - "values": true - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.2", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "container_memory_usage_bytes{name!~\"cadvisor|prometheus|grafana\",image!=\"\"}", - "hide": false, - "intervalFactor": 2, - "legendFormat": "{{name}}", - "metric": "container_memory_usage_bytes", - "refId": "A", - "step": 10 - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Memory Usage", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "bytes", - "label": "", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": false - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "editable": true, - "error": false, - "fill": 1, - "fillGradient": 0, - "grid": {}, - "gridPos": { - "h": 7, - "w": 12, - "x": 0, - "y": 17 - }, - "hiddenSeries": false, - "id": 3, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.2", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "irate(container_network_receive_bytes_total{name!~\"cadvisor|prometheus|grafana\",image!=\"\"}[5s])", - "intervalFactor": 2, - "legendFormat": "{{name}}", - "metric": "container_network_receive_bytes_total", - "refId": "A", - "step": 20 - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Network Rx", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "Bps", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - }, - { - "aliasColors": {}, - "bars": false, - "dashLength": 10, - "dashes": false, - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "editable": true, - "error": false, - "fill": 1, - "fillGradient": 0, - "grid": {}, - "gridPos": { - "h": 7, - "w": 12, - "x": 12, - "y": 17 - }, - "hiddenSeries": false, - "id": 4, - "legend": { - "avg": false, - "current": false, - "max": false, - "min": false, - "show": true, - "total": false, - "values": false - }, - "lines": true, - "linewidth": 2, - "links": [], - "nullPointMode": "connected", - "options": { - "alertThreshold": true - }, - "percentage": false, - "pluginVersion": "10.0.2", - "pointradius": 5, - "points": false, - "renderer": "flot", - "seriesOverrides": [], - "spaceLength": 10, - "stack": false, - "steppedLine": false, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "irate(container_network_transmit_bytes_total{name!~\"cadvisor|prometheus|grafana\",image!=\"\"}[5s])", - "intervalFactor": 2, - "legendFormat": "{{name}}", - "refId": "A", - "step": 20 - } - ], - "thresholds": [], - "timeRegions": [], - "title": "Network Tx", - "tooltip": { - "msResolution": false, - "shared": true, - "sort": 0, - "value_type": "cumulative" - }, - "type": "graph", - "xaxis": { - "mode": "time", - "show": true, - "values": [] - }, - "yaxes": [ - { - "format": "Bps", - "logBase": 1, - "show": true - }, - { - "format": "short", - "logBase": 1, - "show": true - } - ], - "yaxis": { - "align": false - } - } - ], - "refresh": "10s", - "schemaVersion": 38, - "style": "dark", - "tags": [ - "docker" - ], - "templating": { - "list": [] - }, - "time": { - "from": "now-5m", - "to": "now" - }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, - "timezone": "browser", - "title": "Docker Monitoring Test", - "uid": "ee75b6b8-f1c6-4ef1-9d39-fe50cc55a274", - "version": 1, - "weekStart": "" -} \ No newline at end of file diff --git a/monitor/datasources.yml b/monitor/datasources.yml deleted file mode 100644 index 8e24127..0000000 --- a/monitor/datasources.yml +++ /dev/null @@ -1,6 +0,0 @@ -datasources: - - name: prometheus - type: prometheus - url: http://prometheus:9090 - access: proxy - isDefault: true diff --git a/monitor/default.yaml b/monitor/default.yaml deleted file mode 100644 index 159715d..0000000 --- a/monitor/default.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: 1 - -providers: -- name: Default # A uniquely identifiable name for the provider - folder: Services # The folder where to place the dashboards - type: file - options: - path: /var/lib/grafana/dashboards/dashboard.json \ No newline at end of file diff --git a/monitor/docker-compose.yml b/monitor/docker-compose.yml deleted file mode 100644 index ccb7abb..0000000 --- a/monitor/docker-compose.yml +++ /dev/null @@ -1,50 +0,0 @@ -version: "3" -services: - cadvisor: - container_name: cadvisor - image: gcr.io/cadvisor/cadvisor:latest - # network_mode: "host" - ports: - - "8080:8080" - volumes: - - "/:/rootfs" - - "/var/run:/var/run" - - "/sys:/sys" - - "/var/lib/docker/:/var/lib/docker" - - "/dev/disk/:/dev/disk" - privileged: true - devices: - - "/dev/kmsg" - - prometheus: - container_name: prometheus - image: prom/prometheus:latest - # network_mode: "host" - ports: - - "9090:9090" - volumes: - - "./prometheus.yml:/etc/prometheus/prometheus.yml" - privileged: true - depends_on: - - cadvisor - - grafana: - container_name: grafana - image: grafana/grafana:latest - # network_mode: "host" - ports: - - "3000:3000" - environment: - - GF_PATHS_PROVISIONING=/etc/grafana/provisioning - - DS_PROMETHEUS=prometheus - volumes: - - "grafana-data:/var/lib/grafana" - - "./datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml" - - "./dashboard.json:/var/lib/grafana/dashboards/dashboard.json" - - "./default.yaml:/etc/grafana/provisioning/dashboards/default.yaml" - privileged: true - depends_on: - - prometheus - -volumes: - grafana-data: \ No newline at end of file diff --git a/monitor/prometheus.yml b/monitor/prometheus.yml deleted file mode 100644 index f5cf2f6..0000000 --- a/monitor/prometheus.yml +++ /dev/null @@ -1,13 +0,0 @@ -global: - scrape_interval: 1s #Scrape interval to every 15 seconds. - evaluation_interval: 1s #Evaluate rules every 15 seconds. - -scrape_configs: - - job_name: "prometheus" - # metrics_path defaults to '/metrics' - static_configs: - - targets: ["prometheus:9090"] - - - job_name: "cadvisor" - static_configs: - - targets: ["cadvisor:8080"] diff --git a/monitor/veth.sh b/monitor/veth.sh deleted file mode 100755 index 39d9a18..0000000 --- a/monitor/veth.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Usage: veth.sh -# Description: Get the veth interface of a container - -NAME=$1 -PID=$(docker inspect $NAME --format "{{.State.Pid}}") -while read iface id; do - [[ "$iface" == lo ]] && continue - veth=$(ip -br addr | sed -nre "s/(veth.*)@if$id.*/\1/p") - echo -e "$NAME $iface $veth" -done < <(