added TCPSynRetrans and tcphandshake chart; fixes #2169
Costa Tsaousis (ktsaou) committed
May 10, 2017 at 23:00 UTC
718c8dacdf092e8fe081c5768b635c11fbf28252
4 files changed
+36
-14
src/plugin_proc.c
+1
-1
@@ -32,7 +32,7 @@ static struct proc_module {
32
33
// network metrics
34
{ .name = "/proc/net/dev", .dim = "netdev", .func = do_proc_net_dev },
35
- { .name = "/proc/net/netstat", .dim = "netstat", .func = do_proc_net_netstat },
35
+ { .name = "/proc/net/netstat", .dim = "netstat", .func = do_proc_net_netstat }, // this has to be before /proc/net/snmp, because there is a shared metric
36
{ .name = "/proc/net/snmp", .dim = "snmp", .func = do_proc_net_snmp },
37
{ .name = "/proc/net/snmp6", .dim = "snmp6", .func = do_proc_net_snmp6 },
38
{ .name = "/proc/net/softnet_stat", .dim = "softnet", .func = do_proc_net_softnet_stat },
src/plugin_proc.h
+3
@@ -29,4 +29,7 @@ extern int do_proc_spl_kstat_zfs_arcstats(int update_every, usec_t dt);
29
30
extern int get_numa_node_count(void);
31
32
+// metrics that need to be shared among data collectors
33
+extern unsigned long long tcpext_TCPSynRetrans;
34
+
35
#endif /* NETDATA_PLUGIN_PROC_H */
src/proc_net_netstat.c
+8
@@ -1,5 +1,7 @@
1
#include "common.h"
2
3
+unsigned long long tcpext_TCPSynRetrans;
4
+
5
static void parse_line_pair(procfile *ff, ARL_BASE *base, size_t header_line, size_t values_line) {
6
size_t hwords = procfile_linewords(ff, header_line);
7
size_t vwords = procfile_linewords(ff, values_line);
@@ -94,6 +96,9 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
96
// IPv4 TCP memory pressures
97
static unsigned long long tcpext_TCPMemoryPressures = 0;
98
99
+ // shared: tcpext_TCPSynRetrans
100
+
101
+
102
if(unlikely(!arl_ipext)) {
103
hash_ipext = simple_hash("IpExt");
104
hash_tcpext = simple_hash("TcpExt");
@@ -191,6 +196,9 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
196
if(do_tcpext_memory != CONFIG_BOOLEAN_NO) {
197
arl_expect(arl_tcpext, "TCPMemoryPressures", &tcpext_TCPMemoryPressures);
198
}
199
+
200
+ // shared metrics
201
+ arl_expect(arl_tcpext, "TCPSynRetrans", &tcpext_TCPSynRetrans);
202
}
203
204
if(unlikely(!ff)) {
src/proc_net_snmp.c
+24
-13
@@ -645,24 +645,35 @@ int do_proc_net_snmp(int update_every, usec_t dt) {
645
if(do_tcp_handshake) {
646
st = rrdset_find_localhost(RRD_TYPE_NET_SNMP ".tcphandshake");
647
if(!st) {
648
- st = rrdset_create_localhost(RRD_TYPE_NET_SNMP, "tcphandshake", NULL, "tcp", NULL
649
- , "IPv4 TCP Handshake Issues", "events/s", 2900, update_every
650
- , RRDSET_TYPE_LINE);
648
+ st = rrdset_create_localhost(
649
+ RRD_TYPE_NET_SNMP
650
+ , "tcphandshake"
651
+ , NULL
652
+ , "tcp"
653
+ , NULL
654
+ , "IPv4 TCP Handshake Issues"
655
+ , "events/s"
656
+ , 2900
657
+ , update_every
658
+ , RRDSET_TYPE_LINE
659
+ );
660
rrdset_flag_set(st, RRDSET_FLAG_DETAIL);
661
653
- rrddim_add(st, "EstabResets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
654
- rrddim_add(st, "OutRsts", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
655
- rrddim_add(st, "ActiveOpens", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
656
- rrddim_add(st, "PassiveOpens", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
657
- rrddim_add(st, "AttemptFails", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
662
+ rrddim_add(st, "EstabResets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
663
+ rrddim_add(st, "OutRsts", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
664
+ rrddim_add(st, "ActiveOpens", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
665
+ rrddim_add(st, "PassiveOpens", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
666
+ rrddim_add(st, "AttemptFails", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
667
+ rrddim_add(st, "TCPSynRetrans", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
668
}
669
else rrdset_next(st);
670
661
- rrddim_set(st, "EstabResets", *tcp_EstabResets);
662
- rrddim_set(st, "OutRsts", *tcp_OutRsts);
663
- rrddim_set(st, "ActiveOpens", *tcp_ActiveOpens);
664
- rrddim_set(st, "PassiveOpens", *tcp_PassiveOpens);
665
- rrddim_set(st, "AttemptFails", *tcp_AttemptFails);
671
+ rrddim_set(st, "EstabResets", *tcp_EstabResets);
672
+ rrddim_set(st, "OutRsts", *tcp_OutRsts);
673
+ rrddim_set(st, "ActiveOpens", *tcp_ActiveOpens);
674
+ rrddim_set(st, "PassiveOpens", *tcp_PassiveOpens);
675
+ rrddim_set(st, "AttemptFails", *tcp_AttemptFails);
676
+ rrddim_set(st, "TCPSynRetrans", tcpext_TCPSynRetrans);
677
rrdset_done(st);
678
}
679
}