Skip to content

Node Metrics

In this tutorial, we demonstrate how to enable live metrics using the Edge Builder CLI. This will cover how to:

Initialise the Edge Builder server components and CLI

To initialize the Edge Builder server components and CLI, complete the following steps:

  1. Set up the environment as described in Tutorials Setup

  2. SSH into the master node:

    vagrant ssh master
    

  3. Start the Edge Builder server components using the following command:

    sudo edgebuilder-server up -a 192.168.56.10
    
    When the server components are up, you should see all server components up and running via the docker ps command:
    vagrant@master:~$ docker ps
    CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS          PORTS                                                                                                                                                     NAMES
    cd848b7cf1b6   iotechsys/dev-eb-controller:1.2.0.dev    "./entrypoint.sh"        15 seconds ago   Up 11 seconds   0.0.0.0:8085->8085/tcp, :::8085->8085/tcp, 0.0.0.0:50000-50100->50000-50100/tcp, :::50000-50100->50000-50100/tcp, 0.0.0.0:1022->22/tcp, :::1022->22/tcp   eb-controller
    58072d82dbc3   chronograf:1.8.8-alpine                  "./custom-entrypoint…"   17 seconds ago   Up 14 seconds   0.0.0.0:8888->8888/tcp, :::8888->8888/tcp                                                                                                                 eb-chronograf
    b40a1ec47019   iotechsys/dev-eb-salt-master:1.2.0.dev   "/bin/sh -c 'sed -i …"   19 seconds ago   Up 15 seconds   0.0.0.0:4505-4506->4505-4506/tcp, :::4505-4506->4505-4506/tcp, 0.0.0.0:8099->8099/tcp, :::8099->8099/tcp                                                  eb-salt-master
    56f1c3bc6ee5   iotechsys/dev-eb-webssh:1.2.0.dev        "wssh --address=0.0.…"   19 seconds ago   Up 15 seconds   0.0.0.0:8989->8989/tcp, :::8989->8989/tcp                                                                                                                 eb-webssh
    5064b0670594   portainer/portainer-ce:2.1.0-alpine      "/portainer -H unix:…"   19 seconds ago   Up 15 seconds   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp                                                                      eb-portainer
    8f5ff8a2e5e7   vault:1.7.1                              "./entrypoint.sh"        19 seconds ago   Up 15 seconds   8200/tcp                                                                                                                                                  eb-vault
    a05e87267db8   iotechsys/dev-eb-redis:1.2.0.dev         "redis-server /etc/r…"   19 seconds ago   Up 16 seconds   6379/tcp                                                                                                                                                  eb-redis
    161101640ff1   influxdb:1.8.1-alpine                    "./custom-entrypoint…"   19 seconds ago   Up 16 seconds   0.0.0.0:8086->8086/tcp, :::8086->8086/tcp                                                                                                                 eb-influxdb
    dd24648ebb7b   grafana/grafana:7.4.2                    "/run.sh"                19 seconds ago   Up 15 seconds   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp                                                                                                                 eb-grafana
    71749e615a76   postgres:alpine                          "./entrypoint.sh"        19 seconds ago   Up 16 seconds   5432/tcp                                                                                                                                                  eb-db
    5cae5e428799   kapacitor:1.5-alpine                     "/entrypoint.sh kapa…"   19 seconds ago   Up 17 seconds   9092/tcp                                                                                                                                                  eb-kapacitor
    

  4. Log in to Edge Builder with the default user credentials using the following command:

    edgebuilder-cli user login -u iotech -p EdgeBuilder123 -c "http://192.168.56.10:8085"
    
    You should see the following INFO message:
    INFO: User "iotech" logged in successfully
    

  5. Confirm that you have a valid license in the Vagrant project directory (edgebuilder-vagrant)

  6. Add the license using the following command:
    edgebuilder-cli license add -l DemoLicense -f /vagrant/EdgeBuilder_test_Evaluation.lic
    
    You should see the output similar to that shown below:
    INFO: License added successfully
    +-------------+--------------------------------------+---------------------------------+-----------+-----------+
    | NAME        | ID                                   | FILENAME                        | MAX NODES | EXPIRY    |
    +-------------+--------------------------------------+---------------------------------+-----------+-----------+
    | DemoLicense | b65c2ba0-c78b-4031-aaf4-cc030d3d763d | EdgeBuilder_test_Evaluation.lic | 100       | unlimited |
    +-------------+--------------------------------------+---------------------------------+-----------+-----------+
    INFO: Viewing 1 result(s)
    

Add a node

In this section of the tutorial, we will add a node to Edge Builder. It is accessible on 192.168.56.11.

To add an edge node, complete the following steps:

  1. Confirm that the example node configuration file is avaliable using the cat command:

    cat /vagrant/examples/single-node-config.json
    
    Expected output:
    {
      "NodeConfig": [
          {
              "name": "node1",
              "description": "virtual node 1",
              "nodeaddress": "192.168.56.11",
              "nodesshport": "22",
              "username" : "vagrant",
              "password" : "vagrant",
              "serveraddress": "192.168.56.10",
              "labels" : ["label1", "label2"]
          }
      ]
    }
    

  2. Add the node to Edge Builder using the following command:

     edgebuilder-cli node add -f /vagrant/examples/single-node-config.json
    
    Expected output:
    INFO: SSH Node(s) added successfully:
    +-------+--------------------------------------+----------------+
    | NODE  | ID                                   | LABELS         |
    +-------+--------------------------------------+----------------+
    | node1 | db95f08f-c0ae-47ea-ad1d-8cbe73532eb7 | label1, label2 |
    +-------+--------------------------------------+----------------+
    INFO: Viewing 1 result(s)
    

  3. Confirm that the node has been added using the following command:

    edgebuilder-cli node view --all
    
    Expected output:
    INFO: Finding all nodes...
    INFO: *** Node View Results ***
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | NAME  | ID                                   | STATUS | DEBUG MODE | METRICS MODE | LABELS                                   | DESCRIPTION    |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | node1 | db95f08f-c0ae-47ea-ad1d-8cbe73532eb7 | Up     | Off        | Local        | Virtual:VirtualBox, Timezone:UTC, Kernel | virtual node 1 |
    |       |                                      |        |            |              | :Linux, OSFamily:Debian, label2, CPUArch |                |
    |       |                                      |        |            |              | :x86_64, label1, UserName:root, ProductN |                |
    |       |                                      |        |            |              | ame:VirtualBox, GroupName:root, CPUModel |                |
    |       |                                      |        |            |              | :11thGenIntel(R)Core(TM)i7-11800H@2.30GH |                |
    |       |                                      |        |            |              | z, Language:en_US, OSArch:amd64, Hostnam |                |
    |       |                                      |        |            |              | e:node1, Manufacturer:innotekGmbH, OSFin |                |
    |       |                                      |        |            |              | ger:Ubuntu-20.04                         |                |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    INFO: Viewing 1 result(s)
    

    Note

    • The status of the node is initially shown as Deploying. After a few minutes, you can re-issue the command and the status will have changed to Up
    • You can also use the watch command with the node view above to automatically track the status changes

Enable live metrics for node monitoring

In this section of the tutorial, we demonstrate how to enable live metrics on an edge node and how to view them in the dashboard.

  1. Enable live metrics for the edge node using the following command:
    edgebuilder-cli node metrics -n node1 -m live
    
    Expected output:
    INFO: Setting metrics mode to 'Live' on 1 node(s)
    INFO: Access metrics dashboards here:
    INFO: (name = node1, ID = c4ea4ea3-23c4-4a4d-8ca5-b7fbf8d33914): "http://192.168.50.188:3000/d/4MGFhG1Gz/edge-node-metrics?orgId=1&refresh=5s&var-Node=node1"
    INFO: Opening URL in default web browser
    

Note

  • While the node is changing from local metrics mode to live, you may see another state called Transitioning. Simply run the node view command again to get an updated metrics mode state.
  • You can disable the opening of the web browser by using the --disableWebBrowser flag

  • Confirm that live metrics have been enabled using the following command:
    edgebuilder-cli node view -n node1
    
    You should see output similar to the following with the METRICS MODE set to Live:
    INFO: Finding nodes: ["node1"]
    INFO: *** Node View Results ***
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | NAME  | ID                                   | STATUS | DEBUG MODE | METRICS MODE | LABELS                                   | DESCRIPTION    |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | node1 | db95f08f-c0ae-47ea-ad1d-8cbe73532eb7 | Up     | Off        | Live         | Virtual:VirtualBox, Timezone:UTC, Kernel | virtual node 1 |
    |       |                                      |        |            |              | :Linux, OSFamily:Debian, label2, CPUArch |                |
    |       |                                      |        |            |              | :x86_64, label1, UserName:root, ProductN |                |
    |       |                                      |        |            |              | ame:VirtualBox, GroupName:root, CPUModel |                |
    |       |                                      |        |            |              | :11thGenIntel(R)Core(TM)i7-11800H@2.30GH |                |
    |       |                                      |        |            |              | z, Language:en_US, OSArch:amd64, Hostnam |                |
    |       |                                      |        |            |              | e:node1, Manufacturer:innotekGmbH, OSFin |                |
    |       |                                      |        |            |              | ger:Ubuntu-20.04                         |                |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    INFO: Viewing 1 result(s)
    
  • If your browser has not opened on the Grafana login page, enter http://<server-ip>:3000

  • Log in to Grafana using the default credentials, as follows:

    username: admin
    password: Grafana123
    

  • In Grafana, navigate to the metrics dashboard for node1, you should be able to see a dashboard similar to the following:

    Grafana1

Note

  • Metric dashboards are enabled by default when setting an edge node's metric mode to live or forward. They can be disabled using the node dashboard command.

  • Set node metrics mode back to local using the following command:
    edgebuilder-cli node metrics -n node1 -m local
    
    Expected output:
    INFO: Setting metrics mode to 'Local' on 1 node(s)
    
  • Confirm that the edge node is back to the local mode using the following command:
    edgebuilder-cli node view -n node1
    
    You should see output similar to the following with the METRICS MODE set to Local:
    INFO: Finding nodes: ["node1"]
    INFO: *** Node View Results ***
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | NAME  | ID                                   | STATUS | DEBUG MODE | METRICS MODE | LABELS                                   | DESCRIPTION    |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    | node1 | db95f08f-c0ae-47ea-ad1d-8cbe73532eb7 | Up     | Off        | Local        | Virtual:VirtualBox, Timezone:UTC, Kernel | virtual node 1 |
    |       |                                      |        |            |              | :Linux, OSFamily:Debian, label2, CPUArch |                |
    |       |                                      |        |            |              | :x86_64, label1, UserName:root, ProductN |                |
    |       |                                      |        |            |              | ame:VirtualBox, GroupName:root, CPUModel |                |
    |       |                                      |        |            |              | :11thGenIntel(R)Core(TM)i7-11800H@2.30GH |                |
    |       |                                      |        |            |              | z, Language:en_US, OSArch:amd64, Hostnam |                |
    |       |                                      |        |            |              | e:node1, Manufacturer:innotekGmbH, OSFin |                |
    |       |                                      |        |            |              | ger:Ubuntu-20.04                         |                |
    +-------+--------------------------------------+--------+------------+--------------+------------------------------------------+----------------+
    INFO: Viewing 1 result(s)
    
  • Disable the node metrics dashboard using the following command:
    edgebuilder-cli node dashboard -n node1 --disable
    
    Expected output:
    INFO: disabling dashboards on 1 node(s)
    
  • Confirm that the dashboard was disabled using the following command:
    edgebuilder-cli node inspect -n node1
    
    There shouldn't be a DashboardURL field in the response and the Grafana dashboard should show no data.

Remove the node

To remove an edge node, complete the following steps:

  1. Remove the edge node node1 using the following command:

    edgebuilder-cli node rm -n node1 -y
    
    Expected output:
    INFO: Processing nodes: ["node1"]
    INFO: Attempting to remove 1 node(s)
    INFO: Removal request for 1 node(s) accepted for processing by Edge Builder. Use 'node view' command to get updated status
    

  2. Confirm that the node has been removed using the following command:

    edgebuilder-cli node view -n node1
    
    Expected output:
    INFO: Finding nodes: ["node1"]
    WARN: node "node1" not found
    WARN: 0 results to view