From f7f9bdea91ff0628b9ee17e94b4d5189b3618756 Mon Sep 17 00:00:00 2001
From: Matthias Loibl <mail@matthiasloibl.com>
Date: Tue, 4 Jun 2019 11:47:05 +0200
Subject: [PATCH] Generate correct manifests/

---
 manifests/alertmanager-alertmanager.yaml    |  2 +-
 manifests/grafana-dashboardDatasources.yaml |  2 +-
 manifests/grafana-dashboardDefinitions.yaml | 39 ++++++++-------------
 manifests/node-exporter-daemonset.yaml      |  2 +-
 manifests/prometheus-rules.yaml             |  4 +--
 5 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/manifests/alertmanager-alertmanager.yaml b/manifests/alertmanager-alertmanager.yaml
index 09cb6004..448ac484 100644
--- a/manifests/alertmanager-alertmanager.yaml
+++ b/manifests/alertmanager-alertmanager.yaml
@@ -15,4 +15,4 @@ spec:
     runAsNonRoot: true
     runAsUser: 1000
   serviceAccountName: alertmanager-main
-  version: v0.16.2
+  version: v0.17.0
diff --git a/manifests/grafana-dashboardDatasources.yaml b/manifests/grafana-dashboardDatasources.yaml
index 446c6864..22d47488 100644
--- a/manifests/grafana-dashboardDatasources.yaml
+++ b/manifests/grafana-dashboardDatasources.yaml
@@ -1,6 +1,6 @@
 apiVersion: v1
 data:
-  prometheus.yaml: ewogICAgImFwaVZlcnNpb24iOiAxLAogICAgImRhdGFzb3VyY2VzIjogWwogICAgICAgIHsKICAgICAgICAgICAgImFjY2VzcyI6ICJwcm94eSIsCiAgICAgICAgICAgICJlZGl0YWJsZSI6IGZhbHNlLAogICAgICAgICAgICAibmFtZSI6ICJwcm9tZXRoZXVzIiwKICAgICAgICAgICAgIm9yZ0lkIjogMSwKICAgICAgICAgICAgInR5cGUiOiAicHJvbWV0aGV1cyIsCiAgICAgICAgICAgICJ1cmwiOiAiaHR0cDovL3Byb21ldGhldXMtazhzLm1vbml0b3Jpbmcuc3ZjOjkwOTAiLAogICAgICAgICAgICAidmVyc2lvbiI6IDEKICAgICAgICB9CiAgICBdCn0=
+  datasources.yaml: ewogICAgImFwaVZlcnNpb24iOiAxLAogICAgImRhdGFzb3VyY2VzIjogWwogICAgICAgIHsKICAgICAgICAgICAgImFjY2VzcyI6ICJwcm94eSIsCiAgICAgICAgICAgICJlZGl0YWJsZSI6IGZhbHNlLAogICAgICAgICAgICAibmFtZSI6ICJwcm9tZXRoZXVzIiwKICAgICAgICAgICAgIm9yZ0lkIjogMSwKICAgICAgICAgICAgInR5cGUiOiAicHJvbWV0aGV1cyIsCiAgICAgICAgICAgICJ1cmwiOiAiaHR0cDovL3Byb21ldGhldXMtazhzLm1vbml0b3Jpbmcuc3ZjOjkwOTAiLAogICAgICAgICAgICAidmVyc2lvbiI6IDEKICAgICAgICB9CiAgICBdCn0=
 kind: Secret
 metadata:
   name: grafana-datasources
diff --git a/manifests/grafana-dashboardDefinitions.yaml b/manifests/grafana-dashboardDefinitions.yaml
index abd59cf6..1a51fd48 100644
--- a/manifests/grafana-dashboardDefinitions.yaml
+++ b/manifests/grafana-dashboardDefinitions.yaml
@@ -3047,24 +3047,6 @@ items:
                                   "type": "number",
                                   "unit": "short"
                               },
-                              {
-                                  "alias": "CPU Usage",
-                                  "colorMode": null,
-                                  "colors": [
-
-                                  ],
-                                  "dateFormat": "YYYY-MM-DD HH:mm:ss",
-                                  "decimals": 2,
-                                  "link": false,
-                                  "linkTooltip": "Drill down",
-                                  "linkUrl": "",
-                                  "pattern": "Value #C",
-                                  "thresholds": [
-
-                                  ],
-                                  "type": "number",
-                                  "unit": "short"
-                              },
                               {
                                   "alias": "Memory Usage",
                                   "colorMode": null,
@@ -3076,7 +3058,7 @@ items:
                                   "link": false,
                                   "linkTooltip": "Drill down",
                                   "linkUrl": "",
-                                  "pattern": "Value #D",
+                                  "pattern": "Value #C",
                                   "thresholds": [
 
                                   ],
@@ -3094,7 +3076,7 @@ items:
                                   "link": false,
                                   "linkTooltip": "Drill down",
                                   "linkUrl": "",
-                                  "pattern": "Value #E",
+                                  "pattern": "Value #D",
                                   "thresholds": [
 
                                   ],
@@ -3112,7 +3094,7 @@ items:
                                   "link": false,
                                   "linkTooltip": "Drill down",
                                   "linkUrl": "",
-                                  "pattern": "Value #F",
+                                  "pattern": "Value #E",
                                   "thresholds": [
 
                                   ],
@@ -3130,7 +3112,7 @@ items:
                                   "link": false,
                                   "linkTooltip": "Drill down",
                                   "linkUrl": "",
-                                  "pattern": "Value #G",
+                                  "pattern": "Value #F",
                                   "thresholds": [
 
                                   ],
@@ -3148,7 +3130,7 @@ items:
                                   "link": false,
                                   "linkTooltip": "Drill down",
                                   "linkUrl": "",
-                                  "pattern": "Value #H",
+                                  "pattern": "Value #G",
                                   "thresholds": [
 
                                   ],
@@ -8005,11 +7987,18 @@ items:
                           "steppedLine": false,
                           "targets": [
                               {
-                                  "expr": "node:node_filesystem_usage:{cluster=\"$cluster\"}",
+                                  "expr": "max by (namespace, pod, device) ((node_filesystem_size_bytes{cluster=\"$cluster\", fstype=~\"ext[234]|btrfs|xfs|zfs\", instance=\"$instance\", job=\"node-exporter\"} - node_filesystem_avail_bytes{cluster=\"$cluster\", fstype=~\"ext[234]|btrfs|xfs|zfs\", instance=\"$instance\", job=\"node-exporter\"}) / node_filesystem_size_bytes{cluster=\"$cluster\", fstype=~\"ext[234]|btrfs|xfs|zfs\", instance=\"$instance\", job=\"node-exporter\"})",
                                   "format": "time_series",
                                   "intervalFactor": 2,
-                                  "legendFormat": "{{device}}",
+                                  "legendFormat": "disk used",
                                   "refId": "A"
+                              },
+                              {
+                                  "expr": "max by (namespace, pod, device) (node_filesystem_avail_bytes{cluster=\"$cluster\", fstype=~\"ext[234]|btrfs|xfs|zfs\", instance=\"$instance\", job=\"node-exporter\"} / node_filesystem_size_bytes{cluster=\"$cluster\", fstype=~\"ext[234]|btrfs|xfs|zfs\", instance=\"$instance\", job=\"node-exporter\"})",
+                                  "format": "time_series",
+                                  "intervalFactor": 2,
+                                  "legendFormat": "disk free",
+                                  "refId": "B"
                               }
                           ],
                           "thresholds": [
diff --git a/manifests/node-exporter-daemonset.yaml b/manifests/node-exporter-daemonset.yaml
index e75b44f4..8213bc11 100644
--- a/manifests/node-exporter-daemonset.yaml
+++ b/manifests/node-exporter-daemonset.yaml
@@ -61,7 +61,7 @@ spec:
         resources:
           limits:
             cpu: 20m
-            memory: 40Mi
+            memory: 60Mi
           requests:
             cpu: 10m
             memory: 20Mi
diff --git a/manifests/prometheus-rules.yaml b/manifests/prometheus-rules.yaml
index 5bdfefe4..33359312 100644
--- a/manifests/prometheus-rules.yaml
+++ b/manifests/prometheus-rules.yaml
@@ -278,12 +278,12 @@ spec:
         )
       record: node:node_disk_saturation:avg_irate
     - expr: |
-        max by (namespace, pod, device) ((node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}
+        max by (instance, namespace, pod, device) ((node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"}
         - node_filesystem_avail_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"})
         / node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"})
       record: 'node:node_filesystem_usage:'
     - expr: |
-        max by (namespace, pod, device) (node_filesystem_avail_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"} / node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"})
+        max by (instance, namespace, pod, device) (node_filesystem_avail_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"} / node_filesystem_size_bytes{fstype=~"ext[234]|btrfs|xfs|zfs"})
       record: 'node:node_filesystem_avail:'
     - expr: |
         sum(irate(node_network_receive_bytes_total{job="node-exporter",device!~"veth.+"}[1m])) +
-- 
GitLab