mirror of
https://github.com/ntop/ntopng.git
synced 2026-10-21 22:10:23 +00:00
132 lines
3.7 KiB
C++
132 lines
3.7 KiB
C++
/*
|
|
*
|
|
* (C) 2013-26 - ntop.org
|
|
*
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*
|
|
*/
|
|
|
|
#ifndef _NPROBE_STATS_H_
|
|
#define _NPROBE_STATS_H_
|
|
|
|
#include "ntop_includes.h"
|
|
|
|
typedef struct {
|
|
u_int64_t collection_port;
|
|
u_int64_t nf_ipfix_flows;
|
|
u_int64_t sflow_samples;
|
|
} FlowCollection;
|
|
|
|
typedef struct {
|
|
time_t time_last_used;
|
|
u_int32_t num_sflow_flows;
|
|
u_int32_t num_netflow_flows;
|
|
u_int32_t num_drops;
|
|
u_int32_t unique_source_id;
|
|
} ExporterStats;
|
|
|
|
/* Probe system stats */
|
|
typedef struct {
|
|
bool available; /* true when system stats have been received */
|
|
struct {
|
|
u_int16_t num_cores;
|
|
float load; /* overall CPU load (%) */
|
|
std::vector<float> cores_load; /* per-core load (%) */
|
|
/* Core affinity and load for the cores used */
|
|
int32_t capture_core, export_core; /* -1 if unknown */
|
|
float capture_core_load, export_core_load;
|
|
} cpu;
|
|
struct { /* KB */
|
|
u_int64_t total, used, free, available, buffers, cached;
|
|
u_int64_t swap_total, swap_used;
|
|
} memory;
|
|
} ProbeSystemStats;
|
|
|
|
typedef struct {
|
|
u_int32_t last_update;
|
|
u_int32_t stats_interval;
|
|
u_int32_t remote_lifetime_timeout;
|
|
u_int32_t remote_idle_timeout;
|
|
u_int32_t remote_collected_lifetime_timeout;
|
|
u_int32_t sflow_pkt_sample_drops;
|
|
u_int32_t remote_ifspeed;
|
|
u_int32_t remote_time;
|
|
u_int32_t avg_pps;
|
|
u_int32_t avg_bps;
|
|
u_int64_t sflow_samples;
|
|
u_int64_t remote_bytes;
|
|
u_int64_t remote_pkts;
|
|
u_int64_t remote_pkt_drops;
|
|
u_int64_t remote_active_flows;
|
|
u_int64_t num_flow_exports;
|
|
} CumulativenProbeStats;
|
|
|
|
struct NdpiIn6AddrCompare {
|
|
bool operator()(const struct ndpi_in6_addr& lhs, const struct ndpi_in6_addr& rhs) const {
|
|
return memcmp(&lhs, &rhs, sizeof(struct ndpi_in6_addr)) < 0;
|
|
}
|
|
};
|
|
|
|
class nProbeStats {
|
|
public:
|
|
char remote_ifname[32];
|
|
char remote_ifaddress[64];
|
|
char remote_collector_address[64];
|
|
char nprobe_address[64];
|
|
char nprobe_public_address[64];
|
|
char uuid[36];
|
|
char nprobe_version[64];
|
|
char nprobe_os[64];
|
|
char nprobe_license[64];
|
|
char nprobe_edition[64];
|
|
char nprobe_maintenance[64];
|
|
char nprobe_instance_name[64];
|
|
char mode[64];
|
|
u_int32_t nprobe_source_id;
|
|
u_int32_t num_exporters;
|
|
u_int32_t last_update;
|
|
u_int64_t remote_bytes;
|
|
u_int32_t remote_pkts;
|
|
u_int32_t remote_pkt_drops;
|
|
u_int32_t remote_active_flows;
|
|
u_int32_t num_flow_exports;
|
|
u_int32_t remote_ifspeed;
|
|
u_int16_t remote_collector_port;
|
|
u_int32_t remote_time;
|
|
u_int32_t local_time;
|
|
u_int32_t avg_bps;
|
|
u_int32_t avg_pps;
|
|
u_int32_t stats_interval; /* Stats update interval sec (sent by nprobe) */
|
|
u_int32_t remote_lifetime_timeout;
|
|
u_int32_t remote_idle_timeout;
|
|
u_int32_t remote_collected_lifetime_timeout;
|
|
u_int32_t export_queue_full;
|
|
u_int32_t too_many_flows;
|
|
u_int32_t elk_flow_drops;
|
|
u_int32_t sflow_pkt_sample_drops;
|
|
u_int32_t flow_collection_drops;
|
|
u_int32_t flow_collection_udp_socket_drops;
|
|
FlowCollection flow_collection;
|
|
ProbeSystemStats system;
|
|
|
|
std::map<struct ndpi_in6_addr, ExporterStats, NdpiIn6AddrCompare> exportersStats;
|
|
|
|
public:
|
|
nProbeStats();
|
|
~nProbeStats() {};
|
|
};
|
|
|
|
#endif /* _NPROBE_STATS_H_ */
|