added alarm for monitoring the percentage used of connection tracker table
Costa Tsaousis (ktsaou) committed
Nov 22, 2016 at 02:35 UTC
1b3bae12d3a2fc2772cc7e4128b7f1ad6f8ef6c9
3 files changed
+31
-7
conf.d/Makefile.am
+1
@@ -61,6 +61,7 @@ dist_healthconfig_DATA = \
61
health.d/mysql.conf \
62
health.d/named.conf \
63
health.d/net.conf \
64
+ health.d/netfilter.conf \
65
health.d/nginx.conf \
66
health.d/postgres.conf \
67
health.d/qos.conf \
conf.d/health.d/netfilter.conf
new
+23
@@ -0,0 +1,23 @@
1
+
2
+ alarm: netfilter_last_collected_secs
3
+ on: netfilter.conntrack_sockets
4
+ calc: $now - $last_collected_t
5
+ units: seconds ago
6
+ every: 10s
7
+ warn: $this > (($status >= $WARNING) ? ($update_every) : ( 5 * $update_every))
8
+ crit: $this > (($status == $CRITICAL) ? ($update_every) : (60 * $update_every))
9
+ delay: down 5m multiplier 1.5 max 1h
10
+ info: number of seconds since the last successful data collection
11
+ to: sysadmin
12
+
13
+ alarm: netfilter_conntrack_full
14
+ on: netfilter.conntrack_sockets
15
+ lookup: max -10s unaligned of connections
16
+ calc: $this * 100 / $netfilter.conntrack.max
17
+ units: %
18
+ every: 10s
19
+ warn: $this > (($status >= $WARNING) ? (70) : (80))
20
+ crit: $this > (($status == $CRITICAL) ? (80) : (90))
21
+ delay: down 5m multiplier 1.5 max 1h
22
+ info: the number of connections tracked by the netfilter connection tracker, as a percentage of the connection tracker table size
23
+ to: sysadmin
src/proc_net_stat_conntrack.c
+7
-7
@@ -7,7 +7,7 @@ int do_proc_net_stat_conntrack(int update_every, unsigned long long dt) {
7
static procfile *ff = NULL;
8
static int do_sockets = -1, do_new = -1, do_changes = -1, do_expect = -1, do_search = -1, do_errors = -1;
9
static unsigned long long get_max_every = 10 * 1000000ULL, usec_since_last_max = 0;
10
- static int read_count = 1, read_full = 1;
10
+ static int read_full = 1;
11
static char *nf_conntrack_filename, *nf_conntrack_count_filename, *nf_conntrack_max_filename;
12
static RRDVAR *rrdvar_max = NULL;
13
@@ -33,21 +33,21 @@ int do_proc_net_stat_conntrack(int update_every, unsigned long long dt) {
33
do_search = config_get_boolean("plugin:proc:/proc/net/stat/nf_conntrack", "netfilter connection searches", read_full);
34
do_errors = config_get_boolean("plugin:proc:/proc/net/stat/nf_conntrack", "netfilter errors", read_full);
35
36
- read_count = !read_full;
37
- if(read_count) {
36
+ do_sockets = 1;
37
+ if(!read_full) {
38
snprintfz(filename, FILENAME_MAX, "%s%s", global_host_prefix, "/proc/sys/net/netfilter/nf_conntrack_count");
39
nf_conntrack_count_filename = config_get("plugin:proc:/proc/sys/net/netfilter/nf_conntrack_count", "filename to monitor", filename);
40
41
if(read_single_number_file(nf_conntrack_count_filename, &aentries))
42
- read_count = 0;
42
+ do_sockets = 0;
43
}
44
45
- do_sockets = config_get_boolean("plugin:proc:/proc/net/stat/nf_conntrack", "netfilter connections", read_count);
45
+ do_sockets = config_get_boolean("plugin:proc:/proc/net/stat/nf_conntrack", "netfilter connections", do_sockets);
46
47
- if(!read_count && !read_full)
47
+ if(!do_sockets && !read_full)
48
return 1;
49
50
- rrdvar_max = rrdvar_custom_host_variable_create(&localhost, "nf.conntrack.max");
50
+ rrdvar_max = rrdvar_custom_host_variable_create(&localhost, "netfilter.conntrack.max");
51
}
52
53
if(likely(read_full)) {