From a790c283a45f0959fd42cabb7fe1448883f38bc9 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Mon, 25 Nov 2013 09:55:54 +0100 Subject: [PATCH] Fixed the lack of minimum definition in some data sources of 'bind' graph --- Changes | 2 ++ lib/bind.pm | 54 +++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Changes b/Changes index d4e7e7e..1744f45 100644 --- a/Changes +++ b/Changes @@ -34,6 +34,8 @@ (thanks to Patrick Fallberg, patrick AT fallberg.net for pointing this out) - Fixed to correctly sanitize the input string in the built-in HTTP server which led a number of security vulnerabilities. [#30] +- Fixed the lack of minimum definition in some data sources of 'bind' graph. + (thanks to Andreas Itzchak Rehberg, izzy AT qumran.org for pointing this out) - Small fixes and typos. diff --git a/lib/bind.pm b/lib/bind.pm index f83c05d..974cfdb 100644 --- a/lib/bind.pm +++ b/lib/bind.pm @@ -79,12 +79,12 @@ sub bind_init { push(@last, "RRA:LAST:0.5:1440:" . (365 * $n)); } for($n = 0; $n < scalar(my @bl = split(',', $bind->{list})); $n++) { - push(@tmp, "DS:bind" . $n . "_totalinq:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_inq01:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_inq02:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_inq03:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_inq04:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_inq05:GAUGE:120:U:U"); + push(@tmp, "DS:bind" . $n . "_totalinq:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_inq01:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_inq02:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_inq03:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_inq04:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_inq05:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_inq06:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_inq07:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_inq08:GAUGE:120:0:U"); @@ -100,11 +100,11 @@ sub bind_init { push(@tmp, "DS:bind" . $n . "_inq18:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_inq19:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_inq20:GAUGE:120:0:U"); - push(@tmp, "DS:bind" . $n . "_ouq01:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_ouq02:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_ouq03:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_ouq04:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_ouq05:GAUGE:120:U:U"); + push(@tmp, "DS:bind" . $n . "_ouq01:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_ouq02:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_ouq03:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_ouq04:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_ouq05:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_ouq06:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_ouq07:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_ouq08:GAUGE:120:0:U"); @@ -160,11 +160,11 @@ sub bind_init { push(@tmp, "DS:bind" . $n . "_rs18:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_rs19:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_rs20:GAUGE:120:0:U"); - push(@tmp, "DS:bind" . $n . "_crr01:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_crr02:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_crr03:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_crr04:GAUGE:120:U:U"); - push(@tmp, "DS:bind" . $n . "_crr05:GAUGE:120:U:U"); + push(@tmp, "DS:bind" . $n . "_crr01:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_crr02:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_crr03:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_crr04:GAUGE:120:0:U"); + push(@tmp, "DS:bind" . $n . "_crr05:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_crr06:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_crr07:GAUGE:120:0:U"); push(@tmp, "DS:bind" . $n . "_crr08:GAUGE:120:0:U"); @@ -250,6 +250,28 @@ sub bind_init { } } + # this fixes the lack of minimum definition in some data sources + for($n = 0; $n < scalar(my @bl = split(',', $bind->{list})); $n++) { + RRDs::tune($rrd, + "--minimum=bind" . $n . "_totalinq:0", + "--minimum=bind" . $n . "_inq01:0", + "--minimum=bind" . $n . "_inq02:0", + "--minimum=bind" . $n . "_inq03:0", + "--minimum=bind" . $n . "_inq04:0", + "--minimum=bind" . $n . "_inq05:0", + "--minimum=bind" . $n . "_ouq01:0", + "--minimum=bind" . $n . "_ouq02:0", + "--minimum=bind" . $n . "_ouq03:0", + "--minimum=bind" . $n . "_ouq04:0", + "--minimum=bind" . $n . "_ouq05:0", + "--minimum=bind" . $n . "_crr01:0", + "--minimum=bind" . $n . "_crr02:0", + "--minimum=bind" . $n . "_crr03:0", + "--minimum=bind" . $n . "_crr04:0", + "--minimum=bind" . $n . "_crr05:0", + ); + } + $config->{bind_hist} = (); push(@{$config->{func_update}}, $package); logger("$myself: Ok") if $debug;