Commit graph

237 commits

Author SHA1 Message Date
Simone Mainardi
6053c752f6 Avoids resending notifications for triggered alerts after restarts
Implements #4357
2020-09-03 09:58:46 +02:00
Simone Mainardi
a0097167f4 Fixes active monitoring alerts 2020-09-01 23:03:11 +02:00
Simone Mainardi
230d40abf9 Fixes addition of active monitoring hosts - circular require
Fixes #4345
2020-08-31 19:02:11 +02:00
Simone Mainardi
34b53b8a9b Adds documentation for OO recipients and operator functions 2020-08-28 18:57:59 +02:00
Simone Mainardi
fa00119b56 Adds operator function to evaluate threshold-based alerts 2020-08-28 17:04:25 +02:00
Simone Mainardi
aeecbcce29 Initial implementation of OO recipients with SQLite 2020-08-28 13:19:58 +02:00
Luca Deri
398e25c022 Disabled log 2020-08-17 18:24:05 +02:00
Alfredo Cardigliano
d55e4dc441 Remove alert_endpoints_utils (no longer required). Doc update. 2020-07-28 12:49:06 +02:00
Alfredo Cardigliano
7ffb4df9a6 Handle host pool serialization (exception for backward compatibility).
Fix recipients add
Initial work for alerts dispatching to recipients
2020-07-23 06:22:17 +02:00
Alfredo Cardigliano
f038baf804 Alerts are no longer enqueued if disabled 2020-07-23 00:49:28 +02:00
Simone Mainardi
09eb53a16d Prevents circular dependency in require
Fixes

string stack traceback:
/home/simone/ntopng/scripts/lua/modules/http_lint.lua:2029: in local 'parsePOSTpayload'
/home/simone/ntopng/scripts/lua/modules/http_lint.lua:2081: in main chunk
[C]: in function 'require'
/home/simone/ntopng/scripts/lua/modules/lua_utils.lua:3810: in main chunk
[C]: in function 'require'
...e/simone/ntopng/scripts/lua/modules/pools/base_pools.lua:7: in main chunk
[C]: in function 'require'
...e/ntopng/scripts/lua/modules/pools/pools_alert_utils.lua:10: in main chunk
[C]: in function 'require'
/home/simone/ntopng/scripts/lua/modules/alerts_api.lua:12: in main chunk
...
...b/ntopng/plugins0/modules/active_monitoring/am_utils.lua:11: in main chunk
[C]: in function 'dofile'
/home/simone/ntopng/scripts/lua/modules/plugins_utils.lua:942: in function 'plugins_utils.loadModule'
/var/lib/ntopng/plugins0/http_lint/active_monitoring.lua:17: in field '?'
/home/simone/ntopng/scripts/lua/modules/http_lint.lua:1902: in upvalue 'validateParameter'
/home/simone/ntopng/scripts/lua/modules/http_lint.lua:1989: in local 'lintParams'
/home/simone/ntopng/scripts/lua/modules/http_lint.lua:2085: in main chunk
[C]: in function 'require'
/home/simone/ntopng/scripts/lua/modules/lua_utils.lua:3810: in main chunk
[C]: in function 'require'
.../ntopng/plugins0/scripts/edit_active_monitoring_host.lua:9: in main chunk
2020-07-23 11:58:03 +02:00
Simone Mainardi
dce5623bc2 Fixes pool ids associated with interface alerts 2020-07-21 15:24:19 +02:00
Simone Mainardi
ceba04f92c Fixes to associate pool ids with alerts 2020-07-21 14:59:12 +02:00
Simone Mainardi
42b7d8e7e9 Implements facility to add pool info to alerts 2020-07-21 13:09:27 +02:00
emanuele-f
ba5c64b107 Rework host label getters
This fixes inconsistencies across the ntopng gui

Addresses #3699
2020-05-07 17:47:18 +02:00
Simone Mainardi
290175b16f Refactors alrt builders into creators
Refactors builders into creators: calls
2020-04-27 15:53:56 +02:00
Simone Mainardi
2739aac076 Implements alert builders for each alert definition
[AlertsK] Implements alert consts builder

[AlertsK] alert_threshold_cross.lua

[AlertsK] too_many_drops.lua

[AlertsK] alert_test_failed.lua

[AlertsK] alert_flows_flood.lua alert_tcp_syn_flood.lua lert_tcp_syn_scan.lua

[AlertsK] alert_snmp_topology_changed.lua

[AlertsK] snmp_device_reset.lua

[AlertsK] alert_slow_periodic_activity.lua

[AlertsK] alert_port_status_change.lua

[AlertsK] alert_port_status_change.lua

[AlertsK] alert_port_load_threshold_exceeded.lua

[AlertsK] alert_port_errors.lua

[AlertsK] alert_port_duplexstatus_change.lua

[AlertsK] alert_periodic_activity_not_executed.lua

[AlertsK] alert_misbehaving_flows_ratio.lua

[AlertsK] alert_influxdb_error.lua

[AlertsK] alert_influxdb_dropped_points.lua

[AlertsK] alert_dropped_alerts.lua

[AlertsK] alert_am_threshold_cross.lua

[AlertsK] alert_broadcast_domain_too_large.lua

[AlertsK] alert_device_connection.lua

[AlertsK] alert_device_connection.lua

[AlertsK] alert_host_pool_connection.lua alert_host_pool_disconnection.lua

[AlertsK] alert_ghost_network.lua

[AlertsK] alert_ip_outsite_dhcp_range.lua

[AlertsK] alert_list_download_failed.lua

[AlertsK] alert_login_failed.lua

[AlertsK] alert_mac_ip_association_change.lua

[AlertsK] alert_slow_purge.lua

[AlertsK] alert_request_reply_ratio.lua

[AlertsK] alert_quota_exceeded.lua

[AlertsK] alert_process_notification.lua

[AlertsK] alert_nfq_flushed.lua

[AlertsK] alert_misconfigured_app.lua alert_new_device.lua

[AlertsK] alert_influxdb_export_failure.lua

[AlertsK] alert_unresponsive_device.lua

[AlertsK] alert_user_activity.lua

[AlertsK] alert_user_script_calls_drops.lua

[AlertsK] minor fix
2020-04-24 15:35:44 +02:00
Simone Mainardi
bc154394e9 Cleanup unused code 2020-04-23 12:21:32 +02:00
emanuele-f
0be2da4f57 Cleanup remaining references to RTT 2020-04-20 12:21:39 +02:00
Simone Mainardi
1eb02b2c2b Unifies alert_id and alert_key 2020-04-15 14:29:03 +02:00
Simone Mainardi
e487427aab Refactors alert_utils and enterprise_alert_utils
Addresses #3720

Alerts Refactor: alert_utils as module

Alerts Refactor: notify_ntopng_start and notify_ntopng_stop

Alerts Refactor: processAlertNotifications

Alerts Refactor: checkStoreAlertsFromC

Alerts Refactor: formatAlertNotification

Alerts Refactor: notification_timestamp_rev

Alerts Refactor: formatAlertMessage

Alerts Refactor: getConfigsetAlertLink

Alerts Refactor: alertNotificationActionToLabel

Alerts Refactor: flushAlertsData

Alerts Refactor: disableAlertsGeneration

Alerts Refactor: newAlertsWorkingStatus and other

Alerts Refactor: drawAlerts

Alerts Refactor: drawAlertTables

Alerts Refactor: printAlertTables

Alerts Refactor: checkDeleteStoredAlerts

Alerts Refactor: getUnpagedAlertOptions

Alerts Refactor: getTabParameters

Alerts Refactor: getAlerts

Alerts Refactor: getNumAlerts

Alerts Refactor: performAlertsQuery

Alerts Refactor: sec2granularity

Alerts Refactor: granularity2id

Alerts Refactor: granularity2sec

Alerts Refactor: alertEngineLabel

Alerts Refactor: alertEngine

Alerts Refactor: alertEngineRaw

Alerts Refactor: alertTypeDescription

Alerts Refactor: alertType

Alerts Refactor: alertTypeLabel

Alerts Refactor: alertTypeRaw

Alerts Refactor: alertSeverity

Alerts Refactor: alertSeverityLabel

Alerts Refactor: alertSeverityRaw

Alerts Refactor: get_make_room_keys

Alerts Refactor: enterprise_alert_utils
2020-04-10 14:03:20 +02:00
emanuele-f
02c36d4140 Replace calls to getResolvedAddress with host2name 2020-03-31 11:52:50 +02:00
emanuele-f
983fea5701 Fix bad SNMP interface formatter
Fixes #3659
2020-03-27 17:40:51 +01:00
Simone Mainardi
3144bc8bdf Renames alert_config to user_script_config 2020-03-26 14:51:53 +01:00
emanuele-f
1862b684ed Fix for alerts_api doc generation
Do not document local functions!
2020-03-26 09:39:31 +01:00
Simone Mainardi
755b6f1e47 Adds subtype to collapse macIpAssociationChangeType alerts 2020-02-25 18:49:05 +01:00
Simone Mainardi
9383dfd2b1 Adds subtype to collapse ipOutsideDHCPRangeType alerts 2020-02-25 18:39:32 +01:00
Simone Mainardi
4ed8cfecc3 Implements merge of multiple identical alerts
Implements #3430
2020-02-25 18:14:28 +01:00
Simone Mainardi
55d5912729 Moves unused slow_stats_update alert to attic 2020-02-21 14:14:01 +01:00
Simone Mainardi
bd46b7268e Implements system alerts for not executed activities 2020-02-21 14:00:06 +01:00
emanuele-f
8edee160ed Add missing alert type 2020-02-20 17:09:38 +01:00
emanuele-f
96299661b3 Implement periodic activities status monitor 2020-02-20 16:59:11 +01:00
Simone Mainardi
0e64fd94d6 Implements deadlines for periodic and user scripts 2020-02-18 18:44:41 +01:00
emanuele-f
aca088ea13 Add hyperlink to jump to the alert configuration
Closes #2936
2020-01-17 19:11:15 +01:00
Luca Deri
170bc60f19 Updated (C) 2020-01-08 23:52:51 +01:00
emanuele-f
6ba9052e3b Add debug trace 2020-01-02 14:59:21 +01:00
emanuele-f
4621a8f409 Reload the periodic scripts when the configuration changes 2019-12-31 19:31:03 +01:00
Alfredo Cardigliano
5a17736801 Remove double json encode 2019-12-27 11:25:28 +01:00
emanuele-f
26c80529aa Add example plugin with documentation 2019-12-17 16:23:15 +01:00
emanuele-f
c95473d659 Add snmpDevice hook and improve SNMP user scripts API
Closes #3097
2019-12-16 15:30:15 +01:00
emanuele-f
f998b7fafd Fix automatic alert release skipping some alerts 2019-12-10 09:27:01 +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
Simone Mainardi
188ec66c25 Implements scriptable SNMP devices alerts 2019-11-22 18:00:31 +01:00
emanuele-f
2df9b34201 Add flow user scripts drops alert 2019-11-19 17:37:58 +01:00
emanuele-f
b2d804c123 Fix bugs in existing alert detection with default values
Using alerts with default values caused the already_triggered function to miss the existing alert, which
was automatically released. Moreover, the alerts_api.releaseEntityAlerts passed a nil cur_alerts,
breaking releaseEntityAlerts.
2019-11-19 17:37:31 +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
emanuele-f
a57049f3dc Fix invalid cli2srv.packets field 2019-11-11 15:51:32 +01:00
emanuele-f
d9fd30b9e6 Reduce redis load due to queue rating algorithmn 2019-11-11 10:49:08 +01:00
emanuele-f
23e427e361 Reduce llen number of calls for alerts queue rating 2019-11-08 11:51:49 +01:00
emanuele-f
af1dc8a05e Limit alerts insertions if the queues are full 2019-11-08 11:26:49 +01:00