mirror of
https://github.com/ntop/ntopng.git
synced 2026-08-21 14:23:22 +00:00
Reworks alert counters (WIP)
Alert counters are now kept in sync only for engaged alerts. Each host will show the current number of engaged alerts. This alleviates the complexity of constantly keep the numbers synchronized with the database. Todo: see how to handle counters for flow alerts and past alerts.
This commit is contained in:
parent
b5defaa4b8
commit
eca2c41049
15 changed files with 131 additions and 169 deletions
|
|
@ -212,7 +212,6 @@ void NetworkInterface::init() {
|
|||
pkt_dumper = NULL, numL2Devices = 0;
|
||||
checkpointPktCount = checkpointBytesCount = checkpointPktDropCount = 0;
|
||||
pollLoopCreated = false, bridge_interface = false;
|
||||
refresh_num_alerts = refresh_after_init;
|
||||
if(ntop && ntop->getPrefs() && ntop->getPrefs()->are_taps_enabled())
|
||||
pkt_dumper_tap = new PacketDumperTuntap(this);
|
||||
else
|
||||
|
|
@ -1811,16 +1810,6 @@ static bool update_hosts_stats(GenericHashEntry *node, void *user_data) {
|
|||
|
||||
host->updateStats(tv);
|
||||
|
||||
if(!ntop->getPrefs()->are_alerts_disabled()) {
|
||||
if((host->getInterface()->getRefreshNumAlerts() == refresh_all_after_delete
|
||||
&& host->getNumAlerts() > 0)
|
||||
|| host->getRefreshNumAlerts() == refresh_after_delete
|
||||
|| host->getRefreshNumAlerts() == refresh_after_init) {
|
||||
host->getNumAlerts(true /* refresh alert counter from the database */);
|
||||
host->setRefreshNumAlerts(no_refresh_needed);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ntop->getTrace()->traceEvent(TRACE_WARNING, "Updated: %s [%d]",
|
||||
((StringHost*)node)->host_key(),
|
||||
|
|
@ -1858,11 +1847,6 @@ void NetworkInterface::periodicStatsUpdate() {
|
|||
static_cast<MySQLDB*>(db)->updateStats(&tv);
|
||||
db->flush(false /* not idle, periodic activities */);
|
||||
}
|
||||
|
||||
if(getRefreshNumAlerts() != no_refresh_needed) {
|
||||
alertsManager->refreshCachedNumAlerts();
|
||||
setRefreshNumAlerts(no_refresh_needed);
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue