109 lines
2.7 KiB
C
109 lines
2.7 KiB
C
#ifndef _GLOBAL_METRICS_H
|
|
#define _GLOBAL_METRICS_H
|
|
|
|
#ifdef __cpluscplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "utils.h"
|
|
#include <MESA/field_stat2.h>
|
|
|
|
struct metrics_config
|
|
{
|
|
char output_file[256];
|
|
char statsd_server[32];
|
|
int statsd_port;
|
|
int statsd_format;
|
|
int statsd_cycle;
|
|
|
|
int prometheus_listen_port;
|
|
char prometheus_listen_url[256];
|
|
};
|
|
|
|
struct device_metrics
|
|
{
|
|
struct throughput_metrics nf_rx; // 累计值
|
|
struct throughput_metrics nf_tx; // 累计值
|
|
|
|
struct throughput_metrics endpoint_rx; // 累计值
|
|
struct throughput_metrics endpoint_tx; // 累计值
|
|
struct throughput_metrics endpoint_drop; // 累计值
|
|
};
|
|
|
|
// raw_pkt_metrics 不包含 g_vxlan 所占的字节
|
|
struct raw_pkt_metrics
|
|
{
|
|
struct throughput_metrics mirr_bypass; // 累计值
|
|
struct throughput_metrics mirr_block; // 累计值
|
|
struct throughput_metrics mirr_rx_drop; // 累计值
|
|
struct throughput_metrics mirr_tx; // 累计值
|
|
|
|
struct throughput_metrics stee_bypass; // 累计值
|
|
struct throughput_metrics stee_block; // 累计值
|
|
struct throughput_metrics stee_rx; // 累计值
|
|
struct throughput_metrics stee_tx; // 累计值
|
|
|
|
struct throughput_metrics miss_sess; // 累计值
|
|
struct throughput_metrics error_bypass; // 累计值
|
|
struct throughput_metrics error_block; // 累计值
|
|
};
|
|
|
|
struct ctrl_pkt_metrics
|
|
{
|
|
struct throughput_metrics rx; // 累计值
|
|
struct throughput_metrics tx; // 累计值
|
|
|
|
uint64_t opening; // 累计值
|
|
uint64_t active; // 累计值
|
|
uint64_t closing; // 累计值
|
|
uint64_t resetall; // 累计值
|
|
uint64_t error; // 累计值
|
|
};
|
|
|
|
struct keepalived_pkt_metrics
|
|
{
|
|
struct throughput_metrics downlink_rx; // 累计值
|
|
struct throughput_metrics downlink_tx; // 累计值
|
|
|
|
struct throughput_metrics uplink_rx; // 累计值
|
|
struct throughput_metrics uplink_tx_drop; // 累计值
|
|
};
|
|
|
|
struct sf_status_metrics
|
|
{
|
|
uint64_t active; // 累计值
|
|
uint64_t inactive; // 累计值
|
|
};
|
|
|
|
struct sf_session_metrics
|
|
{
|
|
uint64_t num; // 当前值
|
|
uint64_t log; // 累计值
|
|
};
|
|
|
|
struct global_metrics
|
|
{
|
|
struct device_metrics device;
|
|
struct raw_pkt_metrics raw_pkt;
|
|
struct ctrl_pkt_metrics ctrl_pkt;
|
|
struct keepalived_pkt_metrics kee_pkt;
|
|
|
|
struct sf_status_metrics sf_status;
|
|
struct sf_session_metrics sf_session;
|
|
|
|
struct metrics_config config;
|
|
screen_stat_handle_t fs_handle;
|
|
int fs_id[128];
|
|
};
|
|
|
|
struct global_metrics *global_metrics_create(const char *profile);
|
|
void global_metrics_destory(struct global_metrics *metrics);
|
|
void global_metrics_dump(struct global_metrics *metrics);
|
|
|
|
#ifdef __cpluscplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|