/
MWA (Machbase Web Analytics)

MWA (Machbase Web Analytics)

Machbase Web Analytics (MWA) is a Web application developed with Python 2.7 and Flask-based Werkzeug and Jinja2.

Configuration

The MWA uses the 5001 port to communicate with the client. To verify that the port is available, the linux operating system should use the iptables command and windows should consult the firewall settings to resolve the communication problem.
In addition, you must add the $MACHBASE_HOME/lib folder to $LD_LIBRARY_PATH and make sure that the libmachbasecli_dll.so file is in that folder.

How to Run the Server

The MWA server is executed using the $ MACHBASE_HOME/bin/MWAserver script file. This script uses $ MACHBASE_HOME environment variable, so you must set the environment variable. This script supports the START, STOP, RESTART, RESET, and PORT command options. You can run the server with the 'MWAserver start' command. The port command option allows you to configure the MWA to work using a port other than the default port number 5001 used by the MWAserver.

Example:

[mach@localhost ]$./MWAserver port 1234
WEBSERVER PORT CHANGED : 1234

List of commands

[mach@localhost flask]$./MWAserver help
List of commands:
  * MWAserver start; Startup WebServer
  * MWAserver restart; Restart WebServer
  * MWAserver stop; Shutdown WebServer
  * MWAserver reset; Reset WebServer database
  * MWAserver port NUMBER; Change WebServer port.

Connect to MWA with Web Browser

You can connect to the MWA by entering the MWA server IP and port number (ex: http: 127.0.0.1: 5001) through your web browser. We recommend the latest Chrome browser as a web browser. If the connection is successful, the login screen will be displayed. The default login and password are "admin"/"machbase".

.

How to Use MWA

The main menus of MWA are Dashboard, Query, Collection, DB Admin, and Preferences.

Overview

User Authentication

There are two types of users in MWA: ADMIN and USER. The ADMIN user account can use all menus and functions, and the USER account can only use functions authorized by the ADMIN user.

Group 

To facilitate user authorization and configuration, multiple users can be grouped. You can select the desired group category in the upper left of the screen. Group categories can be set in the "Available Groups" menu of the "Users" menu. The ADMIN account user has full control. Only ADMIN account users can register groups.

Permission 

Set permissions for resources such as saved bookmark queries, grids, and dashboards. There are three permissions: ALL, USER, and OWNER. 

ALL: All users can access the resource without logging in.

USER: Only the logged in user can access the resource.

OWNER: Only the user who created the resource can access it.

Only a user with ADMIN authority can change without permission unless it is a resource creator.

Changing Server

You can see the list of registered servers in the right corner of the screen, and you can connect to another server according to your selection. The server list shows only the servers that are running normally. You can check the connection server by using the IP address and port number of the server.

Dashboard

MWA has the ability to display query results as grid and charts and to display the results in a dashboard form. To create a dashboard, you first create and register a grid, a chart, create a dashboard, place the charts and grids you want, and register your dashboard. Once you register a dashboard, you can change the original grid or chart, but the charts and grids registered on that dashboard will not change.

The user can create, change, delete or select information associated with the dashboard on the right. You can enter an external page in the dashboard by typing the external url in the "Link URL" field at the bottom right of the dashboard. Each user may have different dashboard entries that can be displayed depending on their permissions, so you need to set the permissions to ALL to display the data without logging in.


Creating and Editing Dashboard

To create a dashboard and add a chart or grid, you can create a row using the "Row +" button on the dashboard editing screen, and delete the row from the bottom using the "Row-" button. If you have created a panel in a row, you can delete the row after deleting the panel. You can add panels to the row using Chart +, Grid +, HTML +, and URL + buttons. You can select the chart or grid you have saved as the contents of the panel. However, charts and grids with input parameters that receive input from the user can not be registered in the panel.

HTML + buttons can be used to display HTML or JavaScript, jquery data using chart.js. If you set the ID attribute, it can be set to the same value as another dashboard component, so you can specify the ID as "_ID".

Caution should be used when accessing URLs because they may not be accessible according to the value of 'X-Frame-Options'. Each panel in the dashboard can be set to refresh.


Chart

SQL queries can be displayed as graphs. You can check the query results in the Result tab of the chart, and set the parameters related to the chart display in the Setting tab, and the resulting chart can be found in the Chart tab.

MWA provides a "builder" to easily generate time series charts. The user can set the time interval to be aggregated, and can set data corresponding to the X and Y axes. If the Y axis value is a number, you can use a function such as SUM or AVERAGE. If it is not a number, it can be displayed using the record count. When you create a time series graph, you create a line chart by default. The default settings can be changed on the Setting tab. To display the grid at the bottom of the chart screen, click the Config button and select the desired column from the Columns tab. When column data is displayed on the grid, the left and right widths are set according to the ratio. For example, if Width is set to 1, 2,1, the screen display ratio is set to 25%, 50%, and 25%.

When executing a query, you can set the input parameters. Input parameters must be registered as Config button in the Variables tab. The type of the parameter can be text, number, date, time, datetime, and select query.

In the query statement, the name of the parameter is enclosed in the {} character. When the query is executed, the parameter is replaced with the value entered by the user. Quotation marks should be used when using strings because they are simply replaced. For SELECT statements, you must separate them with the ',' character in the option.


e.g.: SELECT * FROM TEST_TABLE WHERE C3 = '{V3}'

The Preview button allows you to display chart data without saving the chart settings. You can save the results as Excel, JSON, csv, or Tableau data extract (TDE) files with the Output button on the View tab.

Grid 
Use the Grid to display the query results in a table format. You can also display columns that you do not need in the query results. You can use the Builder button to help you create a WHERE clause. However, this function supports only simple conditional statements. To select only specific columns in the result data, click on the Config button, click the "+" button in the Columns tab, and set the title and output width.

The column width is treated as a percentage rate as described in the chart's grid settings. Query parameter setting also performs the same function as Chart. The same function as the chart is also available to save query results in various files in Output.

Query

SQL

Performs the query to display the results. LIMIT or DURATION related settings are displayed in the right panel.

The query can be saved and replayed. You can also invoke the executed queries from the history window. In the query execution window, you can switch the results to a grid or chart screen. The bookmarked query can be found in the "Bookmark Queries" menu.

You can see the list of tables created in the "Tables" tab and the schema of each table. Clicking on a table name displays some data from that table. Rerun the query every 5 seconds and refresh the results. You can see the query results in the "Results" tab. If the "Input selected text at cursor position" check box is selected, the character string at the clicked position is automatically entered in the query input window. You can save query results to files in various formats in the same way as Grid or Chart.

Table Explorer

The table navigator displays the input status of the table data. The sum of the number of data inputs is obtained by the input time and displayed in a graph form. You can see the number of input records during that period by selecting the area of ​​the graph as drag.

There is ON / OFF button of Zoom mode (used for time range adjustment) in the upper right part of the screen.

Bookmark Queries

This is the management screen of query inquiry bookmarked after execution on SQL screen. If you click the query list, you can see the details of the query. You can also switch to the SQL screen using the "to SQL" button.

Collection

Data Collection

The collector manager and collector list registered in the mark base server are displayed in a tree form.

Template files (.tpl), regular expression files (.rgx), and preprocessing script files (.py) must be located in the following path relative to the MACHBASE_HOME path.

  • Template file (.tpl): $MACHBASE_HOME/collector
  • Regular expression file (.tpl): $MACHBASE_HOME/collector/regex
  • Preprocessing script file (.py): $MACHBASE_HOME/collector/preprocess

On the right side of the table displayed on the screen, the number of records to the right of the eye-shaped icon is displayed. Move the mouse cursor over the eye icon to display the "View Table" window. Click on the eye icon to switch to the "Table Explorer" screen and check the table contents. At the bottom of the table, you can see the execution status of the collector and collector manager, and the data collection rate. To the right of each collector name is an icon that executes a run, stop, or delete command on the collector.

Pressing the "add Manager" button opens a window that runs the collector manager in a separate window. In this window, you can register new collector manager with "Create Manager" button, and there is a button to execute RENAME, DROP, LIST function on the right side. The LIST button displays a list of collectors managed by the collector manager.

A collector managed by a specific collector manager can be created using the "add Manager" button. Select the collector manager, and then enter the name of the collector to be created. The name of the collector must be unique to the collector manager.

Click the "Template" button to display a new window. You can create a new template file using the "New" button. To the right of each template file name is a button for modifying the template file. Using this function, a new template file can be created using the existing template file. Before creating, modifying, and saving template files, make sure that the DB_ADDR and DB_PORT fields are appropriate values. Hover the mouse cursor over each component displayed on the screen to see a description of the component.

Preprocess

This function is used to manage the preprocessing script file. Select the collector manager in the right corner of the screen to display a list of preprocessing script files. Press the "Reload" button to re-read the file list.

You can edit the file by clicking on the script file name, and you can create a new script file using the "New" button. You can use the "Save" button to record the changed or created file.

Regular Expression

This is a function that manages the regular expression file used in the template file. When you select Collector Manager on the right, it displays a list of regular expression files. You can use the "Reload" button to reload the list.

When you click on a file in the list of regular expression files, the file contents are displayed and you can change the file. You can use the "New" button to create a new regular expression file.

The regular expression file must contain the following components:

  • REGEX: Regular expression for analyzing data.
  • START_REGEX: A regular expression specifying the starting point of the data to be analyzed. This data is included in the REGEX analysis data.
  • END_REGEX: A regular expression that indicates the end of the analysis data. The values ​​after this are not included in the analysis. If this value is not specified, the collector will not work.

On the lower screen, a list of columns of the table into which the analysis data will be input is displayed. Regex No is the serial number generated as a result of machregex, followed by the column name, type, and size. You can run the sample test by clicking the Test tab. If the test is successful, select the desired column in the Columns tab. When you run the test, the window shows whether the test run was successful. After success, set the desired column name, type and size, and hit the "Apply" button to display the column list again.

DB Admin

Tables

This is the screen to manage table and table space. You can see the table schema and the table index.

Running Queries

Displays the currently executing queries. You can interrupt a running query.

System Monitoring

Displays information about the system on which the MWA server is running. If information can not be obtained, it is displayed as blank. To monitor a device that is not currently running an MWA, you must run the MWA on the desired device and register the "Web URL" for that device.

Preferences

Servers

This is a menu for registering a Machbase server. Only users with ADMIN authority can access MWA.

Server Name

Description
Host and Port

Sets the IP address and port number of the Machbase DB server. You can use 127.0.0.1 or localhost if you are running a Machbase DB on the same machine as the MWA server.

Web URL

You can connect using this URL.

UserID and Password

User name and password of the Machbase DB server

You must register at least one server. If the machine running MWA server is running Machbase DB, you can execute commands such as server start and stop, DB creation, etc. by using "Command" button. For the Machbase DB server running on another machine, you can use the functions except the command to execute with the "Command" button. If the MWA server is running in the same way as the DB server, commands of the "Command" button can be executed on other apparatuses other than the currently running MWA server.

Groups

Manages MWA user groups. Only MWA users with ADMIN authority are allowed access. Chart, Grid, Dashboard, and Bookmark queries can be registered and managed for each group.

Users 

Manages user accounts. This user account refers to the MWA user, not the Machbase DB user. In the case of a dashboard, a screen for selecting a previously created dashboard is displayed.

ADMIN users can register and manage each user and server.

Available Groups: set ADMIN / USER to Authority. 
Available Servers: set default server.

Users with the USER privilege can only update the PASSWORD.

Related content