mirror of https://github.com/mikaku/Monitorix.git
Changed how the values in 'fail2ban.pm' are shown.
With the new option 'graph_mode' the values are, by default, shown with absolute values. This new option permits switching between 'absolute' and 'rate'. #241
This commit is contained in:
parent
ddfb379157
commit
28ed22b311
4
Changes
4
Changes
|
@ -11,9 +11,13 @@
|
||||||
- Added support for FreeBSD NFS Server stats. [#238]
|
- Added support for FreeBSD NFS Server stats. [#238]
|
||||||
- Added the new option 'rrdtool_extra_options' to be able to include RRDtool
|
- Added the new option 'rrdtool_extra_options' to be able to include RRDtool
|
||||||
extra options on every graph.
|
extra options on every graph.
|
||||||
|
(suggested by Greg Ogonowski, greg AT indexcom.com)
|
||||||
- Changed the main loop functionality using now the select() function, instead
|
- Changed the main loop functionality using now the select() function, instead
|
||||||
of the alarm()+pause() pair. This should improve the responsiveness on high
|
of the alarm()+pause() pair. This should improve the responsiveness on high
|
||||||
system loads. [#230]
|
system loads. [#230]
|
||||||
|
- Changed how the values in 'fail2ban.pm' are shown. Now it shows the Bans as
|
||||||
|
absolute values. The new option 'graph_mode' permits switching between
|
||||||
|
'absolute' (default) and 'rate'. [#241]
|
||||||
- Fixed the copyright year in 'monitorix.cgi'.
|
- Fixed the copyright year in 'monitorix.cgi'.
|
||||||
- Fixed in 'mail.pm to use the option 'mail_log' instead the hard coded path I
|
- Fixed in 'mail.pm to use the option 'mail_log' instead the hard coded path I
|
||||||
forgot to remove when adding the Exim support.
|
forgot to remove when adding the Exim support.
|
||||||
|
|
|
@ -142,6 +142,27 @@ sub fail2ban_update {
|
||||||
my $str;
|
my $str;
|
||||||
my $rrdata = "N";
|
my $rrdata = "N";
|
||||||
|
|
||||||
|
if(lc($fail2ban->{graph_mode} || "") ne "rate") {
|
||||||
|
my $e = 0;
|
||||||
|
while($e < scalar(my @fl = split(',', $fail2ban->{list}))) {
|
||||||
|
my $e2 = 0;
|
||||||
|
foreach my $i (split(',', $fail2ban->{desc}->{$e})) {
|
||||||
|
($str = trim($i)) =~ s/\[//;
|
||||||
|
$str =~ s/\]//;
|
||||||
|
$jails[$e][$e2] = 0 unless defined $jails[$e][$e2];
|
||||||
|
if(open(IN, "fail2ban-client status $str |")) {
|
||||||
|
while(<IN>) {
|
||||||
|
if(/- Currently banned:\s+(\d+)$/) {
|
||||||
|
$jails[$e][$e2] = $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(IN);
|
||||||
|
}
|
||||||
|
$e2++;
|
||||||
|
}
|
||||||
|
$e++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if(! -r $config->{fail2ban_log}) {
|
if(! -r $config->{fail2ban_log}) {
|
||||||
logger("Couldn't find file '$config->{fail2ban_log}': $!");
|
logger("Couldn't find file '$config->{fail2ban_log}': $!");
|
||||||
return;
|
return;
|
||||||
|
@ -184,6 +205,7 @@ sub fail2ban_update {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(IN);
|
close(IN);
|
||||||
|
}
|
||||||
|
|
||||||
my $e = 0;
|
my $e = 0;
|
||||||
while($e < scalar(my @fl = split(',', $fail2ban->{list}))) {
|
while($e < scalar(my @fl = split(',', $fail2ban->{list}))) {
|
||||||
|
@ -234,6 +256,7 @@ sub fail2ban_cgi {
|
||||||
my @tmp;
|
my @tmp;
|
||||||
my @tmpz;
|
my @tmpz;
|
||||||
my @CDEF;
|
my @CDEF;
|
||||||
|
my $vlabel = "Bans";
|
||||||
my $n;
|
my $n;
|
||||||
my $n2;
|
my $n2;
|
||||||
my $str;
|
my $str;
|
||||||
|
@ -259,6 +282,9 @@ sub fail2ban_cgi {
|
||||||
foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
|
foreach my $i (split(',', $config->{rrdtool_extra_options} || "")) {
|
||||||
push(@extra, trim($i)) if trim($i);
|
push(@extra, trim($i)) if trim($i);
|
||||||
}
|
}
|
||||||
|
if(lc($fail2ban->{graph_mode} || "") eq "rate") {
|
||||||
|
$vlabel = "Bans/min";
|
||||||
|
}
|
||||||
|
|
||||||
$title = !$silent ? $title : "";
|
$title = !$silent ? $title : "";
|
||||||
|
|
||||||
|
@ -374,11 +400,10 @@ sub fail2ban_cgi {
|
||||||
my $e = 0;
|
my $e = 0;
|
||||||
foreach my $i (split(',', $fail2ban->{desc}->{$n})) {
|
foreach my $i (split(',', $fail2ban->{desc}->{$n})) {
|
||||||
$str = sprintf("%-25s", substr(trim($i), 0, 25));
|
$str = sprintf("%-25s", substr(trim($i), 0, 25));
|
||||||
push(@tmp, "LINE1:j" . ($e + 1) . $LC[$e] . ":$str");
|
push(@tmp, "LINE2:j" . ($e + 1) . $LC[$e] . ":$str");
|
||||||
push(@tmp, "GPRINT:j" . ($e + 1) . ":LAST: Cur\\:%2.0lf\\g");
|
push(@tmp, "GPRINT:j" . ($e + 1) . ":LAST: Cur\\:%3.0lf\\g");
|
||||||
push(@tmp, "GPRINT:j" . ($e + 1) . ":AVERAGE: Avg\\:%2.0lf\\g");
|
push(@tmp, "GPRINT:j" . ($e + 1) . ":AVERAGE: Avg\\:%3.0lf\\g");
|
||||||
push(@tmp, "GPRINT:j" . ($e + 1) . ":MIN: Min\\:%2.0lf\\g");
|
push(@tmp, "GPRINT:j" . ($e + 1) . ":MAX: Max\\:%3.0lf\\n");
|
||||||
push(@tmp, "GPRINT:j" . ($e + 1) . ":MAX: Max\\:%2.0lf\\n");
|
|
||||||
push(@tmpz, "LINE2:j" . ($e + 1) . $LC[$e] . ":$str");
|
push(@tmpz, "LINE2:j" . ($e + 1) . $LC[$e] . ":$str");
|
||||||
$e++;
|
$e++;
|
||||||
}
|
}
|
||||||
|
@ -397,7 +422,7 @@ sub fail2ban_cgi {
|
||||||
"--title=$str ($tf->{nwhen}$tf->{twhen})",
|
"--title=$str ($tf->{nwhen}$tf->{twhen})",
|
||||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||||
"--imgformat=$imgfmt_uc",
|
"--imgformat=$imgfmt_uc",
|
||||||
"--vertical-label=Bans/min",
|
"--vertical-label=$vlabel",
|
||||||
"--width=$width",
|
"--width=$width",
|
||||||
"--height=$height",
|
"--height=$height",
|
||||||
@extra,
|
@extra,
|
||||||
|
@ -426,7 +451,7 @@ sub fail2ban_cgi {
|
||||||
"--title=$str ($tf->{nwhen}$tf->{twhen})",
|
"--title=$str ($tf->{nwhen}$tf->{twhen})",
|
||||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||||
"--imgformat=$imgfmt_uc",
|
"--imgformat=$imgfmt_uc",
|
||||||
"--vertical-label=Bans/min",
|
"--vertical-label=$vlabel",
|
||||||
"--width=$width",
|
"--width=$width",
|
||||||
"--height=$height",
|
"--height=$height",
|
||||||
@extra,
|
@extra,
|
||||||
|
|
|
@ -452,7 +452,7 @@ Default value: \fI/var/log/proftpd/access.log\fP
|
||||||
.P
|
.P
|
||||||
.BI fail2ban_log
|
.BI fail2ban_log
|
||||||
.RS
|
.RS
|
||||||
This is the path to the Fail2ban log file. Monitorix uses this file to report IP addresses banned.
|
This is the path to the Fail2ban log file. Monitorix uses this file only if the option \fBgraph_mode\fP has the value \fIrate\fP.
|
||||||
.P
|
.P
|
||||||
Default value: \fI/var/log/fail2ban.log\fP
|
Default value: \fI/var/log/fail2ban.log\fP
|
||||||
.RE
|
.RE
|
||||||
|
@ -2642,6 +2642,13 @@ This is the number of fail2ban graphs that will be put in a row.
|
||||||
.P
|
.P
|
||||||
Default value: \fI2\fP
|
Default value: \fI2\fP
|
||||||
.RE
|
.RE
|
||||||
|
.P
|
||||||
|
.BI graph_mode
|
||||||
|
.RS
|
||||||
|
This option changes how the values are represented in the graph. It has two possible values: \fIabsolute\fP which is the default, and \fIrate\fP. The former takes the values directly from the command \fIfail2ban-client status <JAIL>\fP and so the values in the graph will appear as absolute. The later option shows the values in a rating format per minute.
|
||||||
|
.P
|
||||||
|
Default value: \fIabsolute\fP
|
||||||
|
.RE
|
||||||
.SS Icecast Streaming Media Server (icecast.pm)
|
.SS Icecast Streaming Media Server (icecast.pm)
|
||||||
This graph is able to monitor an unlimited number of Icecast servers.
|
This graph is able to monitor an unlimited number of Icecast servers.
|
||||||
.P
|
.P
|
||||||
|
|
Loading…
Reference in New Issue