mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-23 03:50:20 +00:00
Migrate interface alerts to in-memory alerts
This commit is contained in:
parent
346627eb74
commit
d85fc2b06b
5 changed files with 78 additions and 31 deletions
|
|
@ -3005,6 +3005,29 @@ bool NetworkInterface::checkPointNetworkCounters(lua_State* vm, u_int8_t checkpo
|
|||
|
||||
/* **************************************************** */
|
||||
|
||||
char* NetworkInterface::serializeCheckpoint() {
|
||||
json_object *my_object, *inner;
|
||||
|
||||
if((my_object = json_object_new_object()) == NULL) return(NULL);
|
||||
if((inner = json_object_new_object()) == NULL) { json_object_put(my_object); return(NULL); }
|
||||
|
||||
json_object_object_add(my_object, "seen.last", json_object_new_int64(getTimeLastPktRcvd()));
|
||||
json_object_object_add(my_object, "ndpiStats", ndpiStats.getJSONObjectForCheckpoint(this));
|
||||
|
||||
json_object_object_add(inner, "bytes", json_object_new_int64(getNumBytes()));
|
||||
json_object_object_add(inner, "packets", json_object_new_int64(getNumPackets()));
|
||||
json_object_object_add(my_object, "stats", inner);
|
||||
|
||||
char *rsp = strdup(json_object_to_json_string(my_object));
|
||||
|
||||
/* Free memory */
|
||||
json_object_put(my_object);
|
||||
|
||||
return(rsp);
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
Host* NetworkInterface::findHostsByIP(AddressTree *allowed_hosts,
|
||||
char *host_ip, u_int16_t vlan_id) {
|
||||
if(host_ip != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue