Commit graph

88 commits

Author SHA1 Message Date
Simone Mainardi
2abb8cfde5 Reworks flow scripts deadlines 2019-12-27 20:50:53 +01:00
emanuele-f
c665bc78d7 Make configsets global 2019-12-23 13:25:35 +01:00
emanuele-f
f62aa15117 Load new configsets while loading user scripts
Hosts/SNMP devices will be handled separately
2019-12-20 12:19:49 +01:00
emanuele-f
a3432e00e8 Implement ntopng plugins
Plugins are a convenient way to group together related lua scripts.
Their primary use case is to group user scripts and their alert/status
definition.
The builtin ntopng user scripts and definitions are now
packed into plugins directories. In future, we will support loading of
user created plugins.
Plugins are loaded at startup into some runtime directories and then
used. Other changes provided by this commit include:

- Add sample flow logger plugin
- Initial support for system user scripts
- Rename edge to threshold
- Migrate system probes to user scripts/plugins
- Migrate scripts to more explicit alerts_api.checkThresholdAlert api
2019-12-10 09:25:57 +01:00
emanuele-f
0d48bff069 Implement more flexible user_scripts api
NOTE: The existing alerts configuration of the users will be discarded.

Some code has been added to make the current gui on/off toggle work.
It is marked with the following comment:

-- TODO remove after implementing the new gui
2019-11-28 11:06:14 +01:00
emanuele-f
3dd7d2215d Remove matchesL7 call 2019-11-15 16:58:59 +01:00
emanuele-f
7d0888d302 Flow user scripts optimizations 2019-11-15 15:52:36 +01:00
emanuele-f
60fc7e0cfb Improve flow.lua and add statistics 2019-11-15 10:51:19 +01:00
emanuele-f
bde0a51f9c Add periodic_update_seconds parameter 2019-11-14 16:10:45 +01:00
emanuele-f
df0556cb87 Optimize flow alerts generation
This provides a ~10x speedup by performing the JSON serialization work in C
(and thus avoiding Lua->C overhead). This also implements two in-memory alerts
queues (one for sqlite and one for the notifications) in order to reduce Redis load.
Alerts queue are now global instead of per-interface as there is only 1 dequeing thread.
2019-11-14 11:54:13 +01:00
Simone Mainardi
05e6dc1677 Implements bi- and mono-directional flow callbacks filter
Implements #3055
2019-11-13 18:14:49 +01:00
Simone Mainardi
0fabd87491 Implements TWH-complete flow callbacks filter
Implements #3056
2019-11-13 17:27:41 +01:00
emanuele-f
739c87a52d Initial flow user scripts optimization 2019-11-11 18:04:48 +01:00
Alfredo Cardigliano
acdab024da Enqueueing flow alerts to be stored/notified from Lua, removed DB select to notiy alert (using the alert object directly) 2019-11-05 15:53:10 +01:00
Alfredo Cardigliano
280213e148 Enqueueing alerts as soon as they are detected, instead of using 2-steps (#3038) 2019-11-05 11:04:44 +01:00
emanuele-f
675adcf90e Migrate hosts disabled flow status preference to lua
By loading all the preferences at once in flow.lua setup() the
redis load is reduced and design is simpler.
2019-11-04 16:50:26 +01:00
emanuele-f
b3a8c6d49a Migrate C flow status alerts to Lua user scripts
- Alerts and flow status cleanup
- Community flow user scripts migration
- Implement scripts filters by l7 proto and packet interface only
- Migrate flow2statusinfojson
- Lower flow periodic update to 30 seconds if there is flow activity
- Display flow scripts without a gui section
2019-10-22 10:42:22 +02:00
emanuele-f
9786581526 flow.getInfo now returns minimal information 2019-10-16 13:57:54 +02:00
emanuele-f
7a14a9cf11 Improvements in status definition API 2019-10-16 10:33:19 +02:00
emanuele-f
9ea7ff01b8 Improve flow alert trigger logic and fix support for custom message 2019-10-15 18:36:41 +02:00
emanuele-f
b217909966 Split flow status definitions in multiple files 2019-10-15 17:28:45 +02:00
emanuele-f
2fdc860ed2 Add support for custom flow alerts in user scripts 2019-10-11 19:48:11 +02:00
emanuele-f
0ddc82d7db Port blacklisted flow alerts to new api 2019-10-11 16:32:37 +02:00
emanuele-f
cbfcff9633 Fix missing performed_lua_calls initialization 2019-10-11 14:36:34 +02:00
emanuele-f
b8f1a039fb Fix always_enabled required for non-alert scripts 2019-10-10 18:03:36 +02:00
emanuele-f
75cf795521 Unify teardown function 2019-10-10 17:24:24 +02:00
emanuele-f
e7e2f43646 Fix Flow::isLuaCallPerformed 2019-10-10 15:17:41 +02:00
emanuele-f
09dcf4e7c6 Improve L4 protocol filter 2019-10-10 15:04:58 +02:00
emanuele-f
4c715c7d73 Implement L4 protocol filter in flow user scripts 2019-10-10 13:37:01 +02:00
emanuele-f
ab0094c1c3 Unify syslog with user scripts API 2019-10-09 18:53:19 +02:00
Simone Mainardi
b9fa26174c Implements generalized benchmarks for any user_script 2019-10-09 18:48:01 +02:00
Simone Mainardi
a49e934570 Removes a debug print 2019-10-09 15:19:21 +02:00
Simone Mainardi
816f3819cc Removes overridden metatable in flow.lua 2019-10-09 15:17:43 +02:00
emanuele-f
ffd3b4c1ee Users scripts api changes and initial documentation 2019-10-09 15:12:28 +02:00
emanuele-f
ede9a7940a Generalize periodic and flows callbacks
Now periodic callbacks are properly called even when alerts are disabled
The granularity filter and check_function has been replaced with a more generic hooks list
2019-10-07 19:05:43 +02:00
Simone Mainardi
359599c4eb Removes static Flow::lua_method_id_to_name map moving it in a flow method 2019-10-07 12:32:50 +02:00
Simone Mainardi
3749ffea04 Adds extra comments to flow.lua 2019-10-07 12:23:31 +02:00
emanuele-f
bee1efdded Move callbacks scripts into separate tab 2019-10-04 10:48:13 +02:00
Renamed from scripts/callbacks/interface/alerts/flow.lua (Browse further)