Commit graph

529 commits

Author SHA1 Message Date
Simone Mainardi
0050f3b732 Prevents interface switch to default to ifid 0 upon failure 2020-05-20 11:31:41 +02:00
emanuele-f
4460a98afd Fix form submit when ntopng login is disabled 2020-05-18 16:00:19 +02:00
Luca Deri
ccf76ca54d Added "real" intefaceId validation
Initial work towards REST API
2020-05-17 20:47:46 +02:00
emanuele-f
6b4c507492 Move CSRF token from request to session
Now the CSRF token is bound to the user session.
This addresses the issues outlined in #3866 , in particular the CSRF expiration issues.
2020-05-06 13:04:12 +02:00
Luca Deri
f99e184e90 Split LuaEngine.cpp apart (further improvements are necessary) 2020-04-19 12:29:13 +02:00
Simone Mainardi
6ea50fb004 Implements the Elasticsearch alerts endpoint
Implements #3105

Initial work to add elastisearch alerts

Initial implementation of ES alerts

Implements version check

Implements flow alerts format

Changes Elasticsearch index name

Comments the Elasticsearch alert endpoint
2020-04-18 16:35:14 +02:00
emanuele-f
c6b43f1af3 Pass client timezone as a cookie to properly format time 2020-04-15 17:44:08 +02:00
emanuele-f
64ceaa5b89 Fix discarded first RRD point in gauges
The point was discarded because of a bad RRD start time during the RRD creation.
The start time is now computed as "insertion_timestamp - heartbeat".

Fixes #3751
2020-04-15 12:55:31 +02:00
emanuele-f
0ad1b65512 Add plugins support for httpdocs, HTML templates and Lua modules
Such resources can be placed into the following plugin subdirs:

- ./httpdocs: javascript, css and similar, see plugins_utils.getHttpdocsDir
- ./modules: Lua modules, see plugins_utils.loadModule
- ./templates: HTML templates, see plugins_utils.renderTemplate
2020-04-14 17:53:25 +02:00
Luca Deri
f7b1e7d689 Initial work for widget implementation 2020-04-13 14:24:50 +02:00
Luca Deri
edd8715b4a Added ntop.speedtest() API call 2020-04-11 10:47:07 +02:00
emanuele-f
3f5bd04e7a Fix possible lua stack corruptions
Basic rules to avoid corruptions:
  - CONST_LUA_OK must be followed by a lua_push* / lua_newtable
  - CONST_LUA_ERROR must *not* be followed by a lua_push* / lua_newtable

Detailed information can be found at https://www.lua.org/manual/5.2/manual.html#lua_CFunction
2020-04-09 11:26:06 +02:00
Luca Deri
770aae078a Cleanuo 2020-04-07 22:02:28 +02:00
emanuele-f
c66181c3ff Update the ntop_reg API 2020-04-06 12:57:19 +02:00
emanuele-f
f75b84ff33 Remove unused API markers 2020-04-03 18:29:07 +02:00
emanuele-f
151c9581d5 Update interface lua C API 2020-04-03 18:25:59 +02:00
Luca Deri
7eca89e9f5 Merge branch 'dev' of https://github.com/ntop/ntopng into dev 2020-04-02 19:58:56 +02:00
Luca Deri
48b3fbc348 Reworked error messages 2020-04-02 19:50:31 +02:00
emanuele-f
daa8441282 Document the host and network user scripts C API 2020-04-02 18:03:45 +02:00
emanuele-f
a11313c6fd Document the flow user scripts API 2020-04-02 17:10:15 +02:00
Alfredo Cardigliano
a254a3ad6b Support for Enterprise L license 2020-04-02 11:02:56 +00:00
Simone Mainardi
43284e22f8 Fixes crash and removes unused PortContactStats
Class was not used and didn't handle concurrent accesses to strings,
yielding crashes such as

Thread 14 "stats_update.lu" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffb3fff700 (LWP 25268)]
0x00005555556b9183 in IpAddress::intoa (this=0x28c, buf=0x7fffb3ffe030 "", bufLen=64, bitmask=255 '\377') at src/IpAddress.cpp:352
352     src/IpAddress.cpp: No such file or directory.
(gdb)
(gdb) bt
    at src/GenericHash.cpp:222
    #9  0x00005555556c0413 in NetworkInterface::walker (this=0x555556159e70, begin_slot=0x7fffb3ffe454, walk_all=true, wtype=walker_flows, walker=0x5555556c6b79 <host_flow_update_stats(GenericHashEntry*, void*, bool*)>,
        user_data=0x7fffb3ffe458) at src/NetworkInterface.cpp:795
	#10 0x00005555556c6f7c in NetworkInterface::periodicStatsUpdate (this=0x555556159e70, vm=0x7fffac0a5578) at src/NetworkInterface.cpp:2589
	#11 0x0000555555671d62 in ntop_periodic_stats_update (vm=0x7fffac0a5578) at src/LuaEngine.cpp:6304
	#12 0x000055555576c2f6 in luaD_precall ()
	#13 0x0000555555777acd in luaV_execute ()
	#14 0x000055555576c5cf in luaD_call ()
	#15 0x000055555576c621 in luaD_callnoyield ()
	#16 0x000055555576ba42 in luaD_rawrunprotected ()
	#17 0x000055555576c91b in luaD_pcall ()
	#18 0x0000555555769cd4 in lua_pcallk ()
	#19 0x0000555555681e8a in LuaEngine::run_loaded_script (this=0x7fffac01fe10) at src/LuaEngine.cpp:12188
	#20 0x000055555563eca2 in ThreadedActivity::runScript (this=0x555562aee4e0, now=1585309410, script_path=0x7fff88002620 "/usr/share/ntopng/scripts/callbacks/interface/stats_update.lua", iface=0x555556159e70, deadline=1585309420)
	    at src/ThreadedActivity.cpp:418
	    #21 0x00005555556ba04d in ThreadPool::run (this=0x5555624525a0) at src/ThreadPool.cpp:103
	    #22 0x00005555556b9c79 in doRun (ptr=0x5555624525a0) at src/ThreadPool.cpp:31
	    #23 0x00007ffff65aa6db in start_thread (arg=0x7fffb3fff700) at pthread_create.c:463
	    #24 0x00007ffff3ea388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
2020-03-27 13:36:51 +01:00
Alfredo Cardigliano
18a15a8b86 Reset host names when setting the name from Lua 2020-03-27 10:58:14 +00:00
Alfredo Cardigliano
081c68d4c7 Add setResolvedAddress lua API 2020-03-26 14:17:28 +00:00
emanuele-f
15c013922d Improve plugins reload to avoid transient errors
A "shadow directory" is now populated when the reload occurs and then swapped as the active directory.
This avoids breaking the directory structure or changing files when other threads are possibly working
on them.

Fixes #3595
2020-03-26 14:21:11 +01:00
Luca Deri
49c80c4615 Win changes 2020-03-20 09:50:36 +01:00
emanuele-f
26520abf34 Add IPv6 support in HTTP monitor and don't follow the redirects
Fixes #3560
Fixes #3554
2020-03-16 11:23:37 +01:00
emanuele-f
0be214cfae Implement HTTP RTT Monitoring 2020-03-13 19:03:33 +01:00
Simone Mainardi
04f5b99342 Calculates and charts RRD queue length 2020-03-09 22:46:35 +01:00
Simone Mainardi
ca48edd07e Removes slow rrd writes status which is no longer used 2020-03-06 18:35:17 +01:00
emanuele-f
94f175194b Initial changes for MUD recording 2020-03-04 17:05:53 +01:00
Simone Mainardi
5a03e1196f Fixes missing timeseries.lua from dropdown menu
Fixes #3476
2020-03-02 10:20:36 +01:00
Simone Mainardi
6fbf5d0bc4 Fix to count drops when the RRD queue is full 2020-03-01 12:31:46 +01:00
Simone Mainardi
cce4dcf568 Implements in-mem RRD writes queue, avoids json enc/dec 2020-02-29 22:30:00 +01:00
Simone Mainardi
9fd86de371 Reworks timeseries export into classes {InfluxDB,RRD}TimeseriesExporter 2020-02-29 18:25:33 +01:00
Simone Mainardi
488165c592 Adds drops counter when the RRD export queue is full 2020-02-29 10:09:02 +01:00
Simone Mainardi
d41c0104d3 Generalizes rrd stats into timeseries stats 2020-02-27 19:11:44 +01:00
emanuele-f
297195abab Add dropped/stored/queries system stats for alerts 2020-02-27 13:27:47 +01:00
emanuele-f
7b6ce10940 Improve empty RRD files detection for faster recovery 2020-02-26 19:09:08 +01:00
emanuele-f
c694035da3 Add check to delete empty RRD files 2020-02-26 18:52:33 +01:00
emanuele-f
a6dab125d5 Improve dropped alerts information
- Add informative label
- Add dropped alerts timeseries and chart
- Generate a system alert whenever alerts are dropped on a network interface
- Add a periodic activity warning when some alerts are dropped on that activity

Closes #3025
2020-02-26 16:05:19 +01:00
emanuele-f
8abdb926cd Handle /proc/net/dev counters wrapping on 32bit platforms.
Fixes #3398
2020-02-25 16:56:58 +01:00
Simone Mainardi
55cdb6c5ea Reworks slow rrd calc for periodic activites 2020-02-25 13:30:10 +01:00
Simone Mainardi
8e9ea63e8b Resets rrd state before checking last updates as documented
Resets RRD states as documented in https://oss.oetiker.ch/rrdtool/prog/rrdthreads.en.html

Affects #3423
2020-02-24 15:26:38 +01:00
Simone Mainardi
a2237266ee Adds total rrd writes and drops to periodic scripts timeseries 2020-02-24 12:54:43 +01:00
emanuele-f
a428bb665f Add work completion indicator to ht_stats/stats/5min dump 2020-02-21 17:43:07 +01:00
Simone Mainardi
a0612895fe Implements slow rrd checks and updates in C 2020-02-19 19:28:07 +01:00
Simone Mainardi
1cd375d756 Implements per-activity rrd writes duration 2020-02-19 15:34:29 +01:00
Simone Mainardi
5b70db90ad Handles deadlines for flow user scripts 2020-02-19 10:46:44 +01:00
Simone Mainardi
0e64fd94d6 Implements deadlines for periodic and user scripts 2020-02-18 18:44:41 +01:00