CSIRT-MU / Stream4Flow

A framework for the real-time network traffic analysis based on world-leading technologies for distributed stream processing, network traffic monitoring, and visualization.
https://csirt.muni.cz/?lang=en
MIT License
100 stars 36 forks source link

Webportal development #18

Closed severinsimko closed 4 years ago

severinsimko commented 7 years ago

There are 2 main Sections: Cluster and Applications

Cluster:

  1. Start Cluster
  1. Stop Cluster

Applications

Every application is started on a particular port Protocols Statistics on 4051 Traffic Profiles on 4050 At the moment, this particular port is only set in the REST API script

DB

The frontend needs to periodically execute and get the statistical information about applications and store them in the DB.

On which server is the DB running? Don't know yet how to test this on my computer. @tomjirsa

What to do with the data in DB when the application is stopped? Do we need to delete all of them ? @tomjirsa

Application overview

tomjirsa commented 7 years ago

On which server is the DB running? Don't know yet how to test this on my computer.

The DB is running on the same server as web (is part of web2py framework). Use database of the web application stream4flow.sqlite

What to do with the data in DB when the application is stopped? Do we need to delete all of them?

Yes, after an application is stopped, the data in DB should be deleted.

tomjirsa commented 7 years ago

For overview - please check, when the functionality is ready:

Cluster:

Applications

tomjirsa commented 7 years ago

Adding @cermmik for following the issue and discussing the subject.

severinsimko commented 7 years ago

Progress bars for Start and Stop cluster implemented - the "cluster" section is done, only design changes are needed.

Design changes planned after the implementation

severinsimko commented 7 years ago

Nestretli ste sa pocas vyvoja s podobnou chybou?

2017-03-12_19-41-58

cermmik commented 7 years ago

Unfortunately, no. Have you tried to download a new database file?

severinsimko commented 7 years ago

I did, it solved the problem but, on the other hand, it looks like I'm not able to define the new table in the DB.

I added db.define_table('dbtest', Field('application_id', 'string', required=True, notnull=True), Field('application_ave', 'integer', required=False, notnull=False) ) in the /models/db.py

And then, I tried to insert some values into this table. and it says that "no such table exists". Multiple restarts of the application didn't have any effect on it.

cermmik commented 7 years ago

It is necessary to update the file directly. Use sqlite3 (Linux) or SQLite Adminsitrator (Windows).

severinsimko commented 7 years ago

Thank you, problem solved!

severinsimko commented 7 years ago

Backend scripts modified that it runs everything under the "spark" user instead of "root"

severinsimko commented 7 years ago

Graph/Detail for a particular application is implemented. Kill application + database data deletion implemented. Running multiple application with the same name, but with different #cores and #memory is implemented.

severinsimko commented 7 years ago

I'm going to work on following tasks now:

  1. Adding and running newly created applications
  2. Need to reimplement the cluster stop/start output
  3. I would like to add more configuration and monitoring options to the web portal - SNMP status, REST status
  4. Still having performance issues - need to fix

    Tasks:

tomjirsa commented 7 years ago

Good job.

3, I would like to add more configuration and monitoring options to the web portal - SNMP status, REST status

For the overall monitoring, we plan to use Graphana and Graphite, or some other monitoring tool. This task is going to be assigned to to @simkosvorad .

severinsimko commented 7 years ago

The option to run random application was implemented.

Summary: When you have a new application, there are only 2 things needed to do in order to be able to run the application through the web interface. First, you have to put the application on MASTER server ( on whatever path you want). Secondly, you have to add the FULL PATH through the web interface. When you do this, you are able to run this application.

You also have the option to delete the application if you want. So you have full control over the applications that you can or you want to run.

I added new DB table: application_available(id, application_name), application_name is in this case FULL PATH to the application.

In the web interface it looks like this: image

The design is still missing, but it will be fixed after tests.

severinsimko commented 7 years ago

I can suggest some attributes/services/ports that we need to monitor and that are related to the web interface. @tomjirsa @simkosvorad

severinsimko commented 7 years ago

what is coming next:

severinsimko commented 7 years ago

Sliding window/ application detail graph set for last 2 hours.

I added zookeeper option for application run.

The sqllite DB is now installed on the web server .14.55 in /opt/dbinsert + I dumped the db on this server. Now, I'm going to work on the script that will fill the db - the function for filling the db with data will be different from the one I use now - that's why it takes more time to implement it

tomjirsa commented 7 years ago

Thanks for info. Please sync with @cermmik the date of meeting for branch merge in advance.

severinsimko commented 7 years ago

I created the script that will fill the DB with data, it's located on web server in : /opt/dbinsert/, the script is called insert.py.

I added the record to crontab on this server, this record is still commented out, it's ready for final integration

tomjirsa commented 7 years ago

I have tested portal according to the manual (I have to install appconfig python module) and following error occurs when loading home:

Traceback (most recent call last):
  File "/var/www/web2py/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/var/www/web2py/applications/Stream4Flow/models/db.py", line 18, in <module>
    myconf = AppConfig(reload=True)
TypeError: __init__() got an unexpected keyword argument 'reload'

The current deployment is on server from cesnet

severinsimko commented 7 years ago

Actually, this line "myconf = AppConfig(reload=True)" was in this configuration (db.py) file even before. Please try to ask @cermmik whether this option is required and what is the purpose for this option.

Or just try to use: myconf = AppConfig(), instead of what's there right now.

cermmik commented 7 years ago

In ./models/db.py is loaded following code with a wrong module:

# -------------------------------------------------------------------------
# app configuration made easy. Look inside private/appconfig.ini
# -------------------------------------------------------------------------
from appconfig import AppConfig

The original file uses following module that works well:

# -------------------------------------------------------------------------
# app configuration made easy. Look inside private/appconfig.ini
# -------------------------------------------------------------------------
from gluon.contrib.appconfig import AppConfig

Is there any reason for the first solution?

cermmik commented 4 years ago

There is no free capacity to finish this task.