// SPDX-License-Identifier: GPL-3.0-or-later
#include "plugin_proc.h"
#define PLUGIN_PROC_MODULE_NET_SNMP_NAME "/proc/net/snmp"
#define RRD_TYPE_NET_SNMP "ipv4"
static struct proc_net_snmp {
// kernel_uint_t ip_Forwarding;
kernel_uint_t ip_DefaultTTL;
kernel_uint_t ip_InReceives;
kernel_uint_t ip_InHdrErrors;
kernel_uint_t ip_InAddrErrors;
kernel_uint_t ip_ForwDatagrams;
kernel_uint_t ip_InUnknownProtos;
kernel_uint_t ip_InDiscards;
kernel_uint_t ip_InDelivers;
kernel_uint_t ip_OutRequests;
kernel_uint_t ip_OutDiscards;
kernel_uint_t ip_OutNoRoutes;
kernel_uint_t ip_ReasmTimeout;
kernel_uint_t ip_ReasmReqds;
kernel_uint_t ip_ReasmOKs;
kernel_uint_t ip_ReasmFails;
kernel_uint_t ip_FragOKs;
kernel_uint_t ip_FragFails;
kernel_uint_t ip_FragCreates;
kernel_uint_t icmp_InMsgs;
kernel_uint_t icmp_OutMsgs;
kernel_uint_t icmp_InErrors;
kernel_uint_t icmp_OutErrors;
kernel_uint_t icmp_InCsumErrors;
kernel_uint_t icmpmsg_InEchoReps;
kernel_uint_t icmpmsg_OutEchoReps;
kernel_uint_t icmpmsg_InDestUnreachs;
kernel_uint_t icmpmsg_OutDestUnreachs;
kernel_uint_t icmpmsg_InRedirects;
kernel_uint_t icmpmsg_OutRedirects;
kernel_uint_t icmpmsg_InEchos;
kernel_uint_t icmpmsg_OutEchos;
kernel_uint_t icmpmsg_InRouterAdvert;
kernel_uint_t icmpmsg_OutRouterAdvert;
kernel_uint_t icmpmsg_InRouterSelect;
kernel_uint_t icmpmsg_OutRouterSelect;
kernel_uint_t icmpmsg_InTimeExcds;
kernel_uint_t icmpmsg_OutTimeExcds;
kernel_uint_t icmpmsg_InParmProbs;
kernel_uint_t icmpmsg_OutParmProbs;
kernel_uint_t icmpmsg_InTimestamps;
kernel_uint_t icmpmsg_OutTimestamps;
kernel_uint_t icmpmsg_InTimestampReps;
kernel_uint_t icmpmsg_OutTimestampReps;
//kernel_uint_t tcp_RtoAlgorithm;
//kernel_uint_t tcp_RtoMin;
//kernel_uint_t tcp_RtoMax;
ssize_t tcp_MaxConn;
kernel_uint_t tcp_ActiveOpens;
kernel_uint_t tcp_PassiveOpens;
kernel_uint_t tcp_AttemptFails;
kernel_uint_t tcp_EstabResets;
kernel_uint_t tcp_CurrEstab;
kernel_uint_t tcp_InSegs;
kernel_uint_t tcp_OutSegs;
kernel_uint_t tcp_RetransSegs;
kernel_uint_t tcp_InErrs;
kernel_uint_t tcp_OutRsts;
kernel_uint_t tcp_InCsumErrors;
kernel_uint_t udp_InDatagrams;
kernel_uint_t udp_NoPorts;
kernel_uint_t udp_InErrors;
kernel_uint_t udp_OutDatagrams;
kernel_uint_t udp_RcvbufErrors;
kernel_uint_t udp_SndbufErrors;
kernel_uint_t udp_InCsumErrors;
kernel_uint_t udp_IgnoredMulti;
kernel_uint_t udplite_InDatagrams;
kernel_uint_t udplite_NoPorts;
kernel_uint_t udplite_InErrors;
kernel_uint_t udplite_OutDatagrams;
kernel_uint_t udplite_RcvbufErrors;
kernel_uint_t udplite_SndbufErrors;
kernel_uint_t udplite_InCsumErrors;
kernel_uint_t udplite_IgnoredMulti;
} snmp_root = { 0 };
int do_proc_net_snmp(int update_every, usec_t dt) {
(void)dt;
static procfile *ff = NULL;
static int do_ip_packets = -1, do_ip_fragsout = -1, do_ip_fragsin = -1, do_ip_errors = -1,
do_tcp_sockets = -1, do_tcp_packets = -1, do_tcp_errors = -1, do_tcp_handshake = -1, do_tcp_opens = -1,
do_udp_packets = -1, do_udp_errors = -1, do_icmp_packets =