Kaynağa Gözat

20171025 dashboard/groups.prom.in (status-group Dashboards über labels aus ...groups.prom templatisieren)

Altlast 7 yıl önce
ebeveyn
işleme
7f83fefd6a

+ 1 - 0
conf/substitutions.conf.FreeBSD

@@ -6,6 +6,7 @@ PROM_PREFIX		ffdo_nodes
 PROM_SUMMARY_PREFIX	ffdo_nodes_summary
 PROM_INFO_PREFIX	ffdo_nodes_info
 PROM_STATS_PREFIX	ffdo_nodes_detail
+PROM_GROUPS_PREFIX	ffdo_groups
 EXPORT_DIR		/var/tmp/node_exporter
 RUN_SML			/usr/local/smlnj/bin/.run-sml
 HEAP_SUFFIX		x86-bsd

+ 1 - 0
conf/substitutions.conf.Linux

@@ -6,6 +6,7 @@ PROM_PREFIX		ffdo_nodes
 PROM_SUMMARY_PREFIX	ffdo_nodes_summary
 PROM_INFO_PREFIX	ffdo_nodes_info
 PROM_STATS_PREFIX	ffdo_nodes_detail
+PROM_GROUPS_PREFIX	ffdo_groups
 EXPORT_DIR		/var/tmp/node_exporter
 RUN_SML			/usr/lib/smlnj/bin/.run-sml
 HEAP_SUFFIX		x86-linux

+ 9 - 2
dashboard/Makefile.in

@@ -1,4 +1,7 @@
-all:	dashboard
+all:	%%PROM_GROUPS_PREFIX%%.prom dashboard
+
+%%PROM_GROUPS_PREFIX%%.prom: groups.prom.in
+	../conf/substitute.sh $> $@
 
 dashboard: %%DASHBOARD_PREFIX%%status.json %%DASHBOARD_PREFIX%%status-render.json %%DASHBOARD_PREFIX%%status-group.json %%DASHBOARD_PREFIX%%status-group-render.json
 
@@ -14,7 +17,10 @@ dashboard: %%DASHBOARD_PREFIX%%status.json %%DASHBOARD_PREFIX%%status-render.jso
 %%DASHBOARD_PREFIX%%status-group-render.json: status-group-render.json.in
 	../conf/substitute.sh $> $@
 
-install: %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status.json %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status-render.json %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status-group.json %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status-group-render.json
+install: %%EXPORT_DIR%%/%%PROM_GROUPS_PREFIX%%.prom %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status.json %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status-render.json %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status-group.json %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status-group-render.json
+
+%%EXPORT_DIR%%/%%PROM_GROUPS_PREFIX%%.prom: %%PROM_GROUPS_PREFIX%%.prom
+	%%INSTALL_DATA_CMD%% $> $@
 
 %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status.json: %%DASHBOARD_PREFIX%%status.json
 	%%INSTALL_DATA_CMD%% $> $@
@@ -29,6 +35,7 @@ install: %%DASHBOARD_DIR%%/%%DASHBOARD_PREFIX%%status.json %%DASHBOARD_DIR%%/%%D
 	%%INSTALL_DATA_CMD%% $> $@
 
 clean:
+	rm -f %%PROM_GROUPS_PREFIX%%.prom
 	rm -f %%DASHBOARD_PREFIX%%status.json
 	rm -f %%DASHBOARD_PREFIX%%status-render.json
 	rm -f %%DASHBOARD_PREFIX%%status-group.json

+ 6 - 0
dashboard/groups.prom.in

@@ -0,0 +1,6 @@
+# HELP %%PROM_GROUPS_PREFIX%% named groups of nodes, selected by regex
+# TYPE %%PROM_GROUPS_PREFIX%% counter
+%%PROM_GROUPS_PREFIX%%{group="Braunschweiger Str. 31-33",regex="FF-DO-(BB-)?Braunschweiger31.*"} 0
+%%PROM_GROUPS_PREFIX%%{group="Café Aufbruch",regex="FF-DO-CafeAufbruch.*"} 0
+%%PROM_GROUPS_PREFIX%%{group="Hörde Fußgängerzone",regex="FF-DO-(SchlankeMathilde.*|(Hoerde-)?FW(f|F)H(-01a|2a|-03.|-08)|Grobe-Baeckerei-08)"} 1
+%%PROM_GROUPS_PREFIX%%{group="Langer August",regex="FF-DO-(BB-)?LA.*"} 0

+ 40 - 66
dashboard/status-group-render.json.in

@@ -1,7 +1,6 @@
 {
  "annotations" : {
   "list" : [
-
    ]
   },
  "editable" : true,
@@ -10,7 +9,6 @@
  "hideControls" : false,
  "id" : null,
  "links" : [
-
   ],
  "rows" : [
   {
@@ -41,7 +39,6 @@
      "lines" : true,
      "linewidth" : 1,
      "links" : [
-
       ],
      "nullPointMode" : "null",
      "percentage" : false,
@@ -49,7 +46,6 @@
      "points" : false,
      "renderer" : "flot",
      "seriesOverrides" : [
-
       ],
      "spaceLength" : 10,
      "span" : 12,
@@ -57,7 +53,7 @@
      "steppedLine" : false,
      "targets" : [
       {
-       "expr" : "%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[select]])\"}",
+       "expr" : "%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[regex]])\"}",
        "format" : "time_series",
        "hide" : false,
        "interval" : "",
@@ -67,7 +63,7 @@
        "step" : 120
        },
       {
-       "expr" : "sum(%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[select]])\"})",
+       "expr" : "sum(%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[regex]])\"})",
        "format" : "time_series",
        "hide" : false,
        "interval" : "",
@@ -78,11 +74,10 @@
        }
       ],
      "thresholds" : [
-
       ],
      "timeFrom" : null,
      "timeShift" : null,
-     "title" : "[[title]] (clients)",
+     "title" : "[[group]] (clients)",
      "tooltip" : {
       "shared" : true,
       "sort" : 1,
@@ -95,7 +90,6 @@
       "name" : null,
       "show" : true,
       "values" : [
-
        ]
       },
      "yaxes" : [
@@ -131,11 +125,10 @@
    "height" : "100",
    "panels" : [
     {
-     "content" : "<p>Links zu Router [[hostname]], Node ID [[node_id]]: <a href=\"/dashboard/file/%%DASHBOARD_PREFIX%%status.json?var-hostname=[[hostname]]&var-node_id=[[node_id]]\">Status Dashboard</a>, <a href=\"%%MAP_NODE_URL%%[[node_id]]\">Map</a>.</p>\n",
+     "content" : "<p>Links zu Router [[hostname]], Node ID [[node_id]]: <a href=\"\/dashboard\/file\/%%DASHBOARD_PREFIX%%status.json?var-hostname=[[hostname]]&var-node_id=[[node_id]]\">Status Dashboard<\/a>, <a href=\"%%MAP_NODE_URL%%[[node_id]]\">Map<\/a>.<\/p>\n",
      "height" : "80px",
      "id" : 4,
      "links" : [
-
       ],
      "mode" : "html",
      "repeat" : null,
@@ -155,81 +148,64 @@
  "schemaVersion" : 14,
  "style" : "dark",
  "tags" : [
-
   ],
  "templating" : {
   "list" : [
    {
     "allValue" : null,
     "current" : {
-     "tags" : [
-
-      ],
-     "text" : "FF-DO-LA.*|FF-DO-BB-LA.*",
-     "value" : "FF-DO-LA.*|FF-DO-BB-LA.*"
+     "text" : " - noch keine Auswahl -",
+     "value" : null
      },
+    "datasource" : null,
     "hide" : 0,
     "includeAll" : false,
-    "label" : null,
+    "label" : "Routergruppe",
     "multi" : false,
-    "name" : "select",
+    "name" : "group",
     "options" : [
-     {
-      "selected" : false,
-      "text" : "FF-DO-LA.*|FF-DO-BB-LA.*",
-      "value" : "FF-DO-LA.*|FF-DO-BB-LA.*"
-      },
-     {
-      "selected" : false,
-      "text" : "FF-DO-Braunschweiger31-.*|FF-DO-BB-Braunschweiger31-.*",
-      "value" : "FF-DO-Braunschweiger31-.*|FF-DO-BB-Braunschweiger31-.*"
-      },
-     {
-      "selected" : false,
-      "text" : "FF-DO-CafeAufbruch.*",
-      "value" : "FF-DO-CafeAufbruch.*"
-      }
      ],
-    "query" : "FF-DO-LA.*|FF-DO-BB-LA.*, FF-DO-Braunschweiger31-.*|FF-DO-BB-Braunschweiger31-.*,FF-DO-CafeAufbruch.*",
-    "type" : "custom"
+    "query" : "label_values(%%PROM_GROUPS_PREFIX%%,group)",
+    "refresh" : 2,
+    "regex" : "",
+    "sort" : 1,
+    "tagValuesQuery" : "",
+    "tags" : [
+     ],
+    "tagsQuery" : "",
+    "type" : "query",
+    "useTags" : false
     },
    {
     "allValue" : null,
     "current" : {
-     "tags" : [
-
-      ],
-     "text" : "Langer August",
-     "value" : "Langer August"
+     "text" : null,
+     "value" : null
      },
-    "hide" : 0,
+    "datasource" : null,
+    "hide" : 2,
     "includeAll" : false,
     "label" : null,
     "multi" : false,
-    "name" : "title",
+    "name" : "regex",
     "options" : [
-     {
-      "selected" : true,
-      "text" : "Langer August",
-      "value" : "Langer August"
-      },
-     {
-      "selected" : false,
-      "text" : "Braunschweiger Str. 31-33",
-      "value" : "Braunschweiger Str. 31-33"
-      },
-     {
-      "selected" : false,
-      "text" : "CaféAufbruch",
-      "value" : "CaféAufbruch"
-      }
      ],
-    "query" : "Langer August,Braunschweiger Str. 31-33,CaféAufbruch",
-    "type" : "custom"
+    "query" : "query_result(max(%%PROM_GROUPS_PREFIX%%{group=\"[[group]]\"}) by (regex))",
+    "refresh" : 2,
+    "regex" : "\/.*regex=\"(.*)\".*\/",
+    "sort" : 1,
+    "tagValuesQuery" : "",
+    "tags" : [
+     ],
+    "tagsQuery" : "",
+    "type" : "query",
+    "useTags" : false
     },
    {
     "allValue" : null,
     "current" : {
+     "text" : " - noch keine Auswahl -",
+     "value" : null
      },
     "datasource" : null,
     "hide" : 0,
@@ -238,15 +214,13 @@
     "multi" : false,
     "name" : "hostname",
     "options" : [
-
      ],
-    "query" : "label_values(%%PROM_INFO_PREFIX%%{hostname=~\"([[select]])\"},hostname)",
+    "query" : "label_values(%%PROM_INFO_PREFIX%%{hostname=~\"[[regex]]\"},hostname)",
     "refresh" : 2,
     "regex" : "",
     "sort" : 1,
     "tagValuesQuery" : "",
     "tags" : [
-
      ],
     "tagsQuery" : "",
     "type" : "query",
@@ -255,6 +229,8 @@
    {
     "allValue" : null,
     "current" : {
+     "text" : null,
+     "value" : null
      },
     "datasource" : null,
     "hide" : 0,
@@ -263,7 +239,6 @@
     "multi" : false,
     "name" : "node_id",
     "options" : [
-
      ],
     "query" : "label_values(%%PROM_INFO_PREFIX%%{hostname=\"[[hostname]]\"},node_id)",
     "refresh" : 2,
@@ -271,7 +246,6 @@
     "sort" : 1,
     "tagValuesQuery" : "",
     "tags" : [
-
      ],
     "tagsQuery" : "",
     "type" : "query",
@@ -310,5 +284,5 @@
   },
  "timezone" : "",
  "title" : "%%DASHBOARD_PREFIX%%status-group",
- "version" : 8
+ "version" : 9
  }

+ 40 - 66
dashboard/status-group.json.in

@@ -1,7 +1,6 @@
 {
  "annotations" : {
   "list" : [
-
    ]
   },
  "editable" : true,
@@ -10,7 +9,6 @@
  "hideControls" : false,
  "id" : null,
  "links" : [
-
   ],
  "rows" : [
   {
@@ -41,7 +39,6 @@
      "lines" : true,
      "linewidth" : 1,
      "links" : [
-
       ],
      "nullPointMode" : "null",
      "percentage" : false,
@@ -49,7 +46,6 @@
      "points" : false,
      "renderer" : "flot",
      "seriesOverrides" : [
-
       ],
      "spaceLength" : 10,
      "span" : 12,
@@ -57,7 +53,7 @@
      "steppedLine" : false,
      "targets" : [
       {
-       "expr" : "%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[select]])\"}",
+       "expr" : "%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[regex]])\"}",
        "format" : "time_series",
        "hide" : false,
        "interval" : "",
@@ -67,7 +63,7 @@
        "step" : 120
        },
       {
-       "expr" : "sum(%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[select]])\"})",
+       "expr" : "sum(%%PROM_STATS_PREFIX%%%%PROM_SEPERATOR%%clients{hostname=~\"([[regex]])\"})",
        "format" : "time_series",
        "hide" : false,
        "interval" : "",
@@ -78,11 +74,10 @@
        }
       ],
      "thresholds" : [
-
       ],
      "timeFrom" : null,
      "timeShift" : null,
-     "title" : "[[title]] (clients)",
+     "title" : "[[group]] (clients)",
      "tooltip" : {
       "shared" : true,
       "sort" : 1,
@@ -95,7 +90,6 @@
       "name" : null,
       "show" : true,
       "values" : [
-
        ]
       },
      "yaxes" : [
@@ -131,11 +125,10 @@
    "height" : "100",
    "panels" : [
     {
-     "content" : "<p>Links zu Router [[hostname]], Node ID [[node_id]]: <a href=\"/dashboard/file/%%DASHBOARD_PREFIX%%status.json?var-hostname=[[hostname]]&var-node_id=[[node_id]]\">Status Dashboard</a>, <a href=\"%%MAP_NODE_URL%%[[node_id]]\">Map</a>.</p>\n",
+     "content" : "<p>Links zu Router [[hostname]], Node ID [[node_id]]: <a href=\"\/dashboard\/file\/%%DASHBOARD_PREFIX%%status.json?var-hostname=[[hostname]]&var-node_id=[[node_id]]\">Status Dashboard<\/a>, <a href=\"%%MAP_NODE_URL%%[[node_id]]\">Map<\/a>.<\/p>\n",
      "height" : "80px",
      "id" : 4,
      "links" : [
-
       ],
      "mode" : "html",
      "repeat" : null,
@@ -155,81 +148,64 @@
  "schemaVersion" : 14,
  "style" : "dark",
  "tags" : [
-
   ],
  "templating" : {
   "list" : [
    {
     "allValue" : null,
     "current" : {
-     "tags" : [
-
-      ],
-     "text" : "FF-DO-LA.*|FF-DO-BB-LA.*",
-     "value" : "FF-DO-LA.*|FF-DO-BB-LA.*"
+     "text" : " - noch keine Auswahl -",
+     "value" : null
      },
+    "datasource" : null,
     "hide" : 0,
     "includeAll" : false,
-    "label" : null,
+    "label" : "Routergruppe",
     "multi" : false,
-    "name" : "select",
+    "name" : "group",
     "options" : [
-     {
-      "selected" : false,
-      "text" : "FF-DO-LA.*|FF-DO-BB-LA.*",
-      "value" : "FF-DO-LA.*|FF-DO-BB-LA.*"
-      },
-     {
-      "selected" : false,
-      "text" : "FF-DO-Braunschweiger31-.*|FF-DO-BB-Braunschweiger31-.*",
-      "value" : "FF-DO-Braunschweiger31-.*|FF-DO-BB-Braunschweiger31-.*"
-      },
-     {
-      "selected" : false,
-      "text" : "FF-DO-CafeAufbruch.*",
-      "value" : "FF-DO-CafeAufbruch.*"
-      }
      ],
-    "query" : "FF-DO-LA.*|FF-DO-BB-LA.*, FF-DO-Braunschweiger31-.*|FF-DO-BB-Braunschweiger31-.*,FF-DO-CafeAufbruch.*",
-    "type" : "custom"
+    "query" : "label_values(%%PROM_GROUPS_PREFIX%%,group)",
+    "refresh" : 2,
+    "regex" : "",
+    "sort" : 1,
+    "tagValuesQuery" : "",
+    "tags" : [
+     ],
+    "tagsQuery" : "",
+    "type" : "query",
+    "useTags" : false
     },
    {
     "allValue" : null,
     "current" : {
-     "tags" : [
-
-      ],
-     "text" : "Langer August",
-     "value" : "Langer August"
+     "text" : null,
+     "value" : null
      },
-    "hide" : 0,
+    "datasource" : null,
+    "hide" : 2,
     "includeAll" : false,
     "label" : null,
     "multi" : false,
-    "name" : "title",
+    "name" : "regex",
     "options" : [
-     {
-      "selected" : true,
-      "text" : "Langer August",
-      "value" : "Langer August"
-      },
-     {
-      "selected" : false,
-      "text" : "Braunschweiger Str. 31-33",
-      "value" : "Braunschweiger Str. 31-33"
-      },
-     {
-      "selected" : false,
-      "text" : "CaféAufbruch",
-      "value" : "CaféAufbruch"
-      }
      ],
-    "query" : "Langer August,Braunschweiger Str. 31-33,CaféAufbruch",
-    "type" : "custom"
+    "query" : "query_result(max(%%PROM_GROUPS_PREFIX%%{group=\"[[group]]\"}) by (regex))",
+    "refresh" : 2,
+    "regex" : "\/.*regex=\"(.*)\".*\/",
+    "sort" : 1,
+    "tagValuesQuery" : "",
+    "tags" : [
+     ],
+    "tagsQuery" : "",
+    "type" : "query",
+    "useTags" : false
     },
    {
     "allValue" : null,
     "current" : {
+     "text" : " - noch keine Auswahl -",
+     "value" : null
      },
     "datasource" : null,
     "hide" : 0,
@@ -238,15 +214,13 @@
     "multi" : false,
     "name" : "hostname",
     "options" : [
-
      ],
-    "query" : "label_values(%%PROM_INFO_PREFIX%%{hostname=~\"([[select]])\"},hostname)",
+    "query" : "label_values(%%PROM_INFO_PREFIX%%{hostname=~\"[[regex]]\"},hostname)",
     "refresh" : 2,
     "regex" : "",
     "sort" : 1,
     "tagValuesQuery" : "",
     "tags" : [
-
      ],
     "tagsQuery" : "",
     "type" : "query",
@@ -255,6 +229,8 @@
    {
     "allValue" : null,
     "current" : {
+     "text" : null,
+     "value" : null
      },
     "datasource" : null,
     "hide" : 0,
@@ -263,7 +239,6 @@
     "multi" : false,
     "name" : "node_id",
     "options" : [
-
      ],
     "query" : "label_values(%%PROM_INFO_PREFIX%%{hostname=\"[[hostname]]\"},node_id)",
     "refresh" : 2,
@@ -271,7 +246,6 @@
     "sort" : 1,
     "tagValuesQuery" : "",
     "tags" : [
-
      ],
     "tagsQuery" : "",
     "type" : "query",
@@ -310,5 +284,5 @@
   },
  "timezone" : "",
  "title" : "%%DASHBOARD_PREFIX%%status-group",
- "version" : 8
+ "version" : 9
  }