Experiment Visualization

How to use miniweb - minimega's web-based visualization tool

The minimega miniclass series

Sandia National Laboratories

miniweb - a standalone webserver for minimega

miniweb is a powerful, web-based portal into your emulated environment
miniweb talks to minimega using the domain socket in minimega's -base directory. For this reason, it must be run on a node that runs minimega, preferably the head node.

miniweb allows you to:

* View VMs
* View Host information
* Connect to, and interact with, VMs
* Record/play back those interactions with VMs
* Display a graph view of your environment
* Interact with minimega via web console

We will cover each of these topics in this module, including some of the launch options you'll find. Please use the -h flag when running to see a complete list of launch options.

$ bin/miniweb -h

This will print the available options for miniweb

options

usage: miniweb [option]...
  -addr string
    	listen address (default ":9001")
  -base string
    	base path for minimega (default "/tmp/minimega")
  -bootstrap
    	create password file for auth
  -cert string
    	cert file for TLS in PEM format
  -console
    	enable console and commands
  -key string
    	key file for TLS in PEM format
  -namespace string
    	limit miniweb to a namespace
  -passwords string
    	password file for auth
  -root string
    	base path for web files (default "misc/web")
  -v, -verbose
    	log on stderr (default true)

of note...

$ ./miniweb -root /path/to/web/

Assuming minimega is located in /opt/bin/minimega, use:

$ ./miniweb -root /opt/misc/web -console -base /opt &

VMs

VMs Info View

There are a variety of views into your experiment that miniweb provides.

The /vms page shows VMs in the active namespace and can be prefixed with a namespace.

The table can be customized to show all the VMs, or only a subset broken across pages.

A search feature is also provided, and VMs can be located by any table property, whether or not it is visible in the table.

There are numerous table properties that can be toggled to show information about the VMs.

In particular, the VNC column includes a link that will launch an interactive console into the VM. More on this later in the module.

In the VM info table (State), there are buttons to update the state of VMs. You may start, pause, or kill VMs through this interface. Once a VM is killed, it is no longer shown in the list but can be restarted via the CLI.

VM Top view

The 'Toggle top view' link will show a set of information similar to the 'top' command in linux:

VM Screenshots

VM Screenshots

Host

Information about the host can be found in the Hosts tab. Example:

Graph

Graph

Files

This tab displays a list of the files in the minimega directory.
By default, this directory is located in /tmp/minimega/files
From this tab, you can download each file by clicking on the filename link.

Namespaces

This tab shows information about the namespaces in your experiment:

Namespaces in miniweb

miniweb interacts with namespaces in two ways: the -namespace flag and via URL paths.

When -namespace is set, miniweb only interacts with the specified namespace. This disables the URL path-based method.

The URL path-method allows you to prefix URLs with the desired namespace, for example, /foo/vms shows the VMs page for the foo namespace. /vms shows VMs for whatever namespace the head node is currently in. The /namespaces page displays a list of the available namespaces with links to the VMs and VLAN pages.

/vlans shows the active VLAN aliases. It may be prefixed with a namespace to see aliases for that namespace.

/files/ shows a directory listing for hosts in the active namespace. It may be prefixed with a namespace to see listings for hosts in that namespace. Additional subdirectories can be appended to the path such as /files/foo/.

For more information on namespaces see module 13

Console

VNC Console

VNC Console

The VNC console is a NoVNC session which lets you control the keyboard, mouse, and see the video in your browser.

miniweb supports VNC for KVM VMs and xterm.js for containers. These are both accessed via the /vm/<name>/<connect> path.

The container's web console allows multiple users to view the same console at the same time. minimega stores some "scrollback" from the container's console, so when a new console connects it can re-play recent output rather than present a blank screen.

minimega allows a user to record and playback mouse and keyboard actions in the VNC console.

For more information on leveraging these features, please see Module 10

Authentication is configured using the -bootstrap and -passwords flags:

$ bin/miniweb -bootstrap -passwords minimega.passwd
Configure /
Username: jon
Password:
Confirm Password:

Add additional users (Ctrl-D when finished):
Path: /vm/fritz
Username: fritz
Password:
Confirm Password:

Add additional users (Ctrl-D when finished):
Path: /vm/john
Username: john
Password:
Confirm Password:

Add additional users (Ctrl-D when finished):
Path:

This generates a password file with bcrypt hashed passwords:

$ cat minimega.passwd
[
    {
        "path": "/",
        "username": "jon",
        "password": "<password_hash>"
    },
    {
        "path": "/vm/fritz",
        "username": "fritz",
        "password": "<password_hash>"
    },
    {
        "path": "/vm/john",
        "username": "john",
        "password": "<password_hash>"
    }
]

To run miniweb with this password file, simply drop the -bootstrap flag:

$ bin/miniweb -passwords minimega.passwd

miniweb also supports TLS to protect the usernames and passwords. It accepts a PEM encoded key and certificate. To generate a key and self-signed certificate, you can use:

$ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365

And then start miniweb with:

$ bin/miniweb -key key.pem -cert cert.pem

Next up…

Module 05: VM Networking

Thank you

The minimega miniclass series

Sandia National Laboratories