Improve dashboard. Update to merged VES Agent design. 45/47545/1
authorBryan Sullivan <bryan.sullivan@att.com>
Tue, 21 Nov 2017 02:04:15 +0000 (18:04 -0800)
committerBryan Sullivan <bryan.sullivan@att.com>
Tue, 21 Nov 2017 02:04:15 +0000 (18:04 -0800)
JIRA: VES-2

Change-Id: I897472b3d753dd1e471536c57cff88ab525bf9c8
Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
tools/grafana/Dashboard.json
tools/ves-setup.sh

index d59e5da..3160296 100644 (file)
@@ -1,5 +1,6 @@
 {
 "dashboard": {
+  "description": "This Dashboard provides a general overview of a host, with templating to select the hostname.",
   "editable": true,
   "gnetId": null,
   "graphTooltip": 0,
           "steppedLine": false,
           "targets": [
             {
-              "alias": "CpuUser",
-              "dsType": "influxdb",
-              "groupBy": [
-                {
-                  "params": [
-                    "system"
-                  ],
-                  "type": "tag"
-                }
-              ],
-              "measurement": "load",
-              "orderByTime": "ASC",
-              "policy": "default",
-              "query": "SELECT mean(\"cpuuser\") FROM \"cpu\" WHERE \"system\" = 'computehost' AND $timeFilter GROUP BY time(1m) fill(null)",
-              "refId": "A",
-              "resultFormat": "time_series",
-              "select": [
-                [
-                  {
-                    "params": [
-                      "load-longterm"
-                    ],
-                    "type": "field"
-                  }
-                ]
-              ],
-              "tags": []
-            },
-            {
-              "alias": "CpuSystem",
+              "alias": "",
               "dsType": "influxdb",
               "groupBy": [
                 {
               "tags": [
                 {
                   "key": "system",
-                  "operator": "=",
-                  "value": "OPNFV01"
-                }
-              ]
-            },
-            {
-              "alias": "CpuIdle",
-              "dsType": "influxdb",
-              "groupBy": [
-                {
-                  "params": [
-                    "system"
-                  ],
-                  "type": "tag"
-                }
-              ],
-              "measurement": "load",
-              "orderByTime": "ASC",
-              "policy": "default",
-              "query": "SELECT mean(\"cpuidle\") FROM \"cpu\" WHERE $timeFilter GROUP BY time(1m) fill(null)",
-              "refId": "C",
-              "resultFormat": "time_series",
-              "select": [
-                [
-                  {
-                    "params": [
-                      "load-midterm"
-                    ],
-                    "type": "field"
-                  }
-                ]
-              ],
-              "tags": [
-                {
-                  "key": "system",
-                  "operator": "=",
-                  "value": "OPNFV01"
+                  "operator": "=~",
+                  "value": "/^$host$/"
                 }
               ]
             }
           "steppedLine": false,
           "targets": [
             {
-              "alias": "Free",
+              "alias": "",
               "dsType": "influxdb",
               "groupBy": [
                 {
                   }
                 ]
               ],
-              "tags": []
-            },
-            {
-              "alias": "Used",
-              "dsType": "influxdb",
-              "groupBy": [
-                {
-                  "params": [
-                    "system"
-                  ],
-                  "type": "tag"
-                }
-              ],
-              "measurement": "memoryUsage",
-              "orderByTime": "ASC",
-              "policy": "autogen",
-              "refId": "B",
-              "resultFormat": "time_series",
-              "select": [
-                [
-                  {
-                    "params": [
-                      "memoryUsed"
-                    ],
-                    "type": "field"
-                  }
-                ]
-              ],
-              "tags": []
-            },
-            {
-              "alias": "Buffered",
-              "dsType": "influxdb",
-              "groupBy": [
-                {
-                  "params": [
-                    "system"
-                  ],
-                  "type": "tag"
-                }
-              ],
-              "measurement": "memoryUsage",
-              "orderByTime": "ASC",
-              "policy": "autogen",
-              "refId": "C",
-              "resultFormat": "time_series",
-              "select": [
-                [
-                  {
-                    "params": [
-                      "memoryBuffered"
-                    ],
-                    "type": "field"
-                  }
-                ]
-              ],
-              "tags": []
-            },
-            {
-              "alias": "Cached",
-              "dsType": "influxdb",
-              "groupBy": [
-                {
-                  "params": [
-                    "system"
-                  ],
-                  "type": "tag"
-                }
-              ],
-              "measurement": "memoryUsage",
-              "orderByTime": "ASC",
-              "policy": "autogen",
-              "refId": "D",
-              "resultFormat": "time_series",
-              "select": [
-                [
-                  {
-                    "params": [
-                      "memoryCached"
-                    ],
-                    "type": "field"
-                  }
-                ]
-              ],
-              "tags": []
-            },
-            {
-              "alias": "SlabRecl",
-              "dsType": "influxdb",
-              "groupBy": [
-                {
-                  "params": [
-                    "system"
-                  ],
-                  "type": "tag"
-                }
-              ],
-              "measurement": "memoryUsage",
-              "orderByTime": "ASC",
-              "policy": "autogen",
-              "refId": "E",
-              "resultFormat": "time_series",
-              "select": [
-                [
-                  {
-                    "params": [
-                      "memorySlabRecl"
-                    ],
-                    "type": "field"
-                  }
-                ]
-              ],
-              "tags": []
-            },
-            {
-              "alias": "SlabUnrecl",
-              "dsType": "influxdb",
-              "groupBy": [
+              "tags": [
                 {
-                  "params": [
-                    "system"
-                  ],
-                  "type": "tag"
+                  "key": "system",
+                  "operator": "=~",
+                  "value": "/^$host$/"
                 }
-              ],
-              "measurement": "memoryUsage",
-              "orderByTime": "ASC",
-              "policy": "autogen",
-              "refId": "F",
-              "resultFormat": "time_series",
-              "select": [
-                [
-                  {
-                    "params": [
-                      "memorySlabUnrecl"
-                    ],
-                    "type": "field"
-                  }
-                ]
-              ],
-              "tags": []
+              ]
             }
           ],
           "thresholds": [],
     },
     {
       "collapse": false,
-      "height": 250,
+      "height": 433,
       "panels": [
         {
-          "alert": {
-            "conditions": [
-              {
-                "evaluator": {
-                  "params": [
-                    15000000
-                  ],
-                  "type": "gt"
-                },
-                "operator": {
-                  "type": "and"
-                },
-                "query": {
-                  "params": [
-                    "A",
-                    "1s",
-                    "now"
-                  ]
-                },
-                "reducer": {
-                  "params": [],
-                  "type": "avg"
-                },
-                "type": "query"
-              }
-            ],
-            "executionErrorState": "alerting",
-            "frequency": "1s",
-            "handler": 1,
-            "message": "Transmitted Traffic Exceeded limits\nClosed Loop Action:Apply Firewall Rules",
-            "name": "VES webserver_1 Network Usage alert",
-            "noDataState": "no_data",
-            "notifications": []
-          },
           "aliasColors": {},
           "bars": false,
           "dashLength": 10,
           "id": 2,
           "interval": "30s",
           "legend": {
-            "alignAsTable": false,
+            "alignAsTable": true,
             "avg": true,
             "current": false,
             "max": false,
           "steppedLine": false,
           "targets": [
             {
-              "alias": "rxOctets",
+              "alias": "",
               "dsType": "influxdb",
               "groupBy": [
                 {
                 [
                   {
                     "params": [
-                      "receivedOctetsAccumulated"
+                      "receivedTotalPacketsAccumulated"
                     ],
                     "type": "field"
                   }
                 ]
               ],
-              "tags": []
+              "tags": [
+                {
+                  "key": "system",
+                  "operator": "=~",
+                  "value": "/^$host$/"
+                }
+              ]
             }
           ],
           "thresholds": [],
           "title": "Received Octets",
           "tooltip": {
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "individual"
           },
           "type": "graph",
           "id": 4,
           "interval": "30s",
           "legend": {
-            "alignAsTable": false,
+            "alignAsTable": true,
             "avg": true,
             "current": false,
             "max": false,
           "steppedLine": false,
           "targets": [
             {
-              "alias": "txOctets",
+              "alias": "",
               "dsType": "influxdb",
               "groupBy": [
                 {
                 [
                   {
                     "params": [
-                      "transmittedOctetsAccumulated"
+                      "receivedOctetsAccumulated"
                     ],
                     "type": "field"
                   }
                 ]
               ],
-              "tags": []
+              "tags": [
+                {
+                  "key": "system",
+                  "operator": "=~",
+                  "value": "/^$host$/"
+                }
+              ]
             }
           ],
           "thresholds": [],
           "title": "Transmitted Octets",
           "tooltip": {
             "shared": true,
-            "sort": 0,
+            "sort": 2,
             "value_type": "individual"
           },
           "type": "graph",
   "style": "dark",
   "tags": [],
   "templating": {
-    "list": []
+    "list": [
+      {
+        "allValue": null,
+        "current": {
+          "tags": [],
+          "text": "All",
+          "value": [
+            "$__all"
+          ]
+        },
+        "datasource": "VESEvents",
+        "hide": 0,
+        "includeAll": true,
+        "label": "host",
+        "multi": true,
+        "name": "host",
+        "options": [
+          {
+            "selected": true,
+            "text": "All",
+            "value": "$__all"
+          },
+          {
+            "selected": false,
+            "text": "4C4C4544-004C-4E10-8054-B6C04F475831",
+            "value": "4C4C4544-004C-4E10-8054-B6C04F475831"
+          },
+          {
+            "selected": false,
+            "text": "4C4C4544-004C-4E10-8057-B6C04F475831",
+            "value": "4C4C4544-004C-4E10-8057-B6C04F475831"
+          },
+          {
+            "selected": false,
+            "text": "4C4C4544-004C-5010-8053-B6C04F475831",
+            "value": "4C4C4544-004C-5010-8053-B6C04F475831"
+          },
+          {
+            "selected": false,
+            "text": "4C4C4544-004E-3110-8051-C3C04F445631",
+            "value": "4C4C4544-004E-3110-8051-C3C04F445631"
+          }
+        ],
+        "query": "SHOW TAG VALUES WITH KEY=system",
+        "refresh": 0,
+        "regex": "",
+        "sort": 0,
+        "tagValuesQuery": "",
+        "tags": [],
+        "tagsQuery": "",
+        "type": "query",
+        "useTags": false
+      }
+    ]
   },
   "time": {
     "from": "now-30m",
   },
   "timezone": "browser",
   "title": "VES Demo",
-  "version": 3
+  "version": 2
 }
 }
index 19932fe..9aeb2ad 100644 (file)
@@ -34,7 +34,7 @@
 #. - Ubuntu Xenial (Centos support to be provided)
 #. - passwordless sudo setup for user running this script
 #. - shell environment variables setup as below (for non-default setting)
-#.   ves_mode: install mode (host|guest) for VES collectd plugin (default: host)
+#.   ves_mode: install mode (node|guest) for VES collectd plugin (default: node)
 #.   ves_host: VES collector IP or hostname (default: 127.0.0.1)
 #.   ves_port: VES collector port (default: 30000)
 #.   ves_path: REST path optionalRoutingPath element (default: empty)
@@ -92,7 +92,7 @@ function setup_env() {
   if [[ ! -f /tmp/ves/ves_env.sh ]]; then
     cat <<EOF >/tmp/ves/ves_env.sh
 #!/bin/bash
-ves_mode="${ves_mode:=host}"
+ves_mode="${ves_mode:=node}"
 ves_host="${ves_host:=127.0.0.1}"
 ves_hostname="${ves_hostname:=localhost}"
 ves_port="${ves_port:=30000}"
@@ -203,7 +203,7 @@ function setup_collectd() {
   sudo systemctl start collectd.service
 
   log "setup VES collectd config for VES $ves_mode mode"
-  if [[ "$ves_mode" == "host" ]]; then
+  if [[ "$ves_mode" == "node" ]]; then
     # TODO: Barometer VES guide to clarify prerequisites install for Ubuntu
     log "setup additional prerequisites for VES host mode"
     sudo apt-get install -y libxml2-dev libpciaccess-dev libyajl-dev \
@@ -213,6 +213,8 @@ function setup_collectd() {
     # http://docs.opnfv.org/en/latest/submodules/barometer/docs/release/userguide/feature.userguide.html#virt-plugin
     sudo systemctl start libvirtd
 
+    # TODO: supposed to be merged with main collectd repo, but without this
+    # collectd still fails "plugin_load: Could not find plugin "virt" in /opt/collectd/lib/collectd" 
     rm -rf /tmp/ves/collectd-virt
     git clone https://github.com/maryamtahhan/collectd /tmp/ves/collectd-virt
     cd /tmp/ves/collectd-virt
@@ -221,17 +223,24 @@ function setup_collectd() {
     make
     sudo make install
 
+    # TODO: fix for journalctl -xe report "... is marked executable"
+    sudo chmod 744 /etc/systemd/system/collectd.service
+
     cat <<EOF | sudo tee -a /opt/collectd/etc/collectd.conf
 # for VES plugin
 LoadPlugin logfile
 <Plugin logfile>
-  LogLevel info
-  File "/opt/collectd/var/log/collectd.log"
+  LogLevel debug
+  File STDOUT
   Timestamp true
   PrintSeverity false
 </Plugin>
 
-LoadPlugin cpu
+LoadPlugin csv
+<Plugin csv>
+ DataDir "/work-dir/collectd/install/var/lib/csv"
+ StoreRates false
+</Plugin>
 
 #LoadPlugin virt
 #<Plugin virt>
@@ -242,6 +251,32 @@ LoadPlugin cpu
 #  ExtraStats "cpu_util"
 #</Plugin>
 
+LoadPlugin target_set
+LoadPlugin match_regex
+<Chain "PreCache">
+  <Rule "mark_memory_as_host">
+    <Match "regex">
+      Plugin "^memory$"
+    </Match>
+    <Target "set">
+      PluginInstance "host"
+    </Target>
+  </Rule>
+</Chain>
+
+LoadPlugin cpu
+<Plugin cpu>
+  ReportByCpu true
+  ReportByState true
+  ValuesPercentage true
+</Plugin>
+
+LoadPlugin interface
+LoadPlugin memory
+LoadPlugin load
+LoadPlugin disk
+LoadPlugin uuid
+
 LoadPlugin write_kafka
 <Plugin write_kafka>
   Property "metadata.broker.list" "$ves_kafka_host:$ves_kafka_port"
@@ -255,13 +290,29 @@ EOF
 # for VES plugin
 LoadPlugin logfile
 <Plugin logfile>
-  LogLevel info
-  File "/opt/collectd/var/log/collectd.log"
+  LogLevel debug
+  File STDOUT
   Timestamp true
   PrintSeverity false
 </Plugin>
 
 LoadPlugin cpu
+<Plugin cpu>
+  ReportByCpu true
+  ReportByState true
+  ValuesPercentage true
+</Plugin>
+
+LoadPlugin csv
+<Plugin csv>
+        DataDir "/tmp"
+</Plugin>
+
+LoadPlugin interface
+LoadPlugin memory
+LoadPlugin load
+LoadPlugin disk
+LoadPlugin uuid
 
 LoadPlugin write_kafka
 <Plugin write_kafka>
@@ -270,6 +321,19 @@ LoadPlugin write_kafka
     Format JSON
   </Topic>
 </Plugin>
+
+LoadPlugin target_set
+LoadPlugin match_regex
+<Chain "PreCache">
+  <Rule "mark_memory_as_guest">
+    <Match "regex">
+      Plugin "^memory$"
+    </Match>
+    <Target "set">
+      PluginInstance "guest"
+    </Target>
+  </Rule>
+</Chain>
 EOF
   fi
 
@@ -301,6 +365,9 @@ function setup_agent() {
     log "clone OPNFV Barometer"
     rm -rf /opt/ves/barometer
     git clone https://gerrit.opnfv.org/gerrit/barometer /opt/ves/barometer
+    # Test patch
+    cd /opt/ves/barometer
+    git fetch https://gerrit.opnfv.org/gerrit/barometer refs/changes/27/47427/1 && git checkout FETCH_HEAD
 
     log "setup ves_app_config.conf"
     source /opt/ves/ves_env.sh