mirror of https://github.com/mikaku/Monitorix.git
added a new option in 'port.rrd' to enable/disable background red color for each port monitored. #182
This commit is contained in:
parent
9b89651084
commit
be4240af8c
53
lib/port.pm
53
lib/port.pm
|
@ -516,41 +516,44 @@ sub port_cgi {
|
|||
$pp =~ s/6//;
|
||||
my $prig = trim((split(',', $port->{desc}->{$pl[$n]}))[3]);
|
||||
my $plim = trim((split(',', $port->{desc}->{$pl[$n]}))[4]);
|
||||
my $plis = trim((split(',', $port->{desc}->{$pl[$n]}))[5]);
|
||||
@riglim = @{setup_riglim($prig, $plim)};
|
||||
|
||||
# check if the network port is still listening
|
||||
undef(@warning);
|
||||
if($config->{os} eq "Linux") {
|
||||
open(IN, "netstat -nl --$pp |");
|
||||
while(<IN>) {
|
||||
(undef, undef, undef, $pnum) = split(' ', $_);
|
||||
chomp($pnum);
|
||||
$pnum =~ s/.*://;
|
||||
if($pnum eq $num) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(IN);
|
||||
}
|
||||
if(grep {$_ eq $config->{os}} ("FreeBSD", "OpenBSD")) {
|
||||
open(IN, "netstat -anl -p $pp |");
|
||||
while(<IN>) {
|
||||
my $stat;
|
||||
(undef, undef, undef, $pnum, undef, $stat) = split(' ', $_);
|
||||
chomp($stat);
|
||||
if($stat eq "LISTEN") {
|
||||
if(uc($plis) eq "L") {
|
||||
if($config->{os} eq "Linux") {
|
||||
open(IN, "netstat -nl --$pp |");
|
||||
while(<IN>) {
|
||||
(undef, undef, undef, $pnum) = split(' ', $_);
|
||||
chomp($pnum);
|
||||
($pnum) = ($pnum =~ m/^.*?(\.\d+$)/);
|
||||
$pnum =~ s/\.//;
|
||||
$pnum =~ s/.*://;
|
||||
if($pnum eq $num) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(IN);
|
||||
}
|
||||
if(grep {$_ eq $config->{os}} ("FreeBSD", "OpenBSD")) {
|
||||
open(IN, "netstat -anl -p $pp |");
|
||||
while(<IN>) {
|
||||
my $stat;
|
||||
(undef, undef, undef, $pnum, undef, $stat) = split(' ', $_);
|
||||
chomp($stat);
|
||||
if($stat eq "LISTEN") {
|
||||
chomp($pnum);
|
||||
($pnum) = ($pnum =~ m/^.*?(\.\d+$)/);
|
||||
$pnum =~ s/\.//;
|
||||
if($pnum eq $num) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(IN);
|
||||
}
|
||||
if(lc($pcon) ne "out" && $pnum ne $num) {
|
||||
push(@warning, $colors->{warning_color});
|
||||
}
|
||||
close(IN);
|
||||
}
|
||||
if(lc($pcon) ne "out" && $pnum ne $num) {
|
||||
push(@warning, $colors->{warning_color});
|
||||
}
|
||||
|
||||
$name = substr(uc($pcon) . "-" . $pn, 0, 15);
|
||||
|
|
|
@ -1653,7 +1653,20 @@ If you see a red color in the background of a network port graph, it means that
|
|||
.P
|
||||
.BI desc
|
||||
.RS
|
||||
This is the option where each network port specified in \fBlist\fP is described. Each port definition consists of five parameters separated by comma: the port description, the network protocol (\fItcp\fP or \fIudp\fP), the connection type (\fIin\fP, \fIout\fP or \fIin/out\fP) and the rigid and limit values.
|
||||
This is the option where each network port specified in \fBlist\fP is described. Each port definition consists of six parameters separated by comma:
|
||||
.RS
|
||||
- an small port description.
|
||||
.br
|
||||
- the network protocol (\fItcp\fP or \fIudp\fP).
|
||||
.br
|
||||
- the connection type (\fIin\fP, \fIout\fP or \fIin/out\fP).
|
||||
.br
|
||||
- the rigid value.
|
||||
.br
|
||||
- the limit value.
|
||||
.br
|
||||
- the \fIL\fP option which specifies that this port should be listening and Monitorix will advice it, by changing the background color of the graph to red, if finds it down.
|
||||
.RE
|
||||
.P
|
||||
There is also support (Linux only) for IPv6 network ports activity by using protocol names as \fItcp6\fP or \fIudp6\fP.
|
||||
.P
|
||||
|
@ -1663,13 +1676,13 @@ list = 25, 25ip6, 80, 53
|
|||
.br
|
||||
<desc>
|
||||
.br
|
||||
25 = SMTP, tcp, in/out, 0, 1000
|
||||
25 = SMTP, tcp, in/out, 0, 1000, L
|
||||
.br
|
||||
25ip6 = SMTP, tcp6, in/out, 0, 1000
|
||||
25ip6 = SMTP, tcp6, in/out, 0, 1000, L
|
||||
.br
|
||||
80 = HTTP, tcp, in, 0, 1000
|
||||
80 = HTTP, tcp, in, 0, 1000, L
|
||||
.br
|
||||
53 = DNS, udp, in, 0, 1000
|
||||
53 = DNS, udp, in, 0, 1000, L
|
||||
.br
|
||||
</desc>
|
||||
.RE
|
||||
|
|
|
@ -420,15 +420,15 @@ secure_log_date_format = %b %e
|
|||
rule = 24000
|
||||
list = 25, 21, 80, 22, 110, 139, 3306, 53, 143
|
||||
<desc>
|
||||
25 = SMTP, tcp, in, 0, 1000
|
||||
21 = FTP, tcp, in, 0, 1000
|
||||
80 = HTTP, tcp, in, 0, 1000
|
||||
22 = SSH, tcp, in, 0, 1000
|
||||
110 = POP3, tcp, in, 0, 1000
|
||||
139 = NETBIOS, tcp, in, 0, 1000
|
||||
3306 = MYSQL, tcp, in, 0, 1000
|
||||
53 = DNS, udp, in, 0, 1000
|
||||
143 = IMAP, tcp, in, 0, 1000
|
||||
25 = SMTP, tcp, in, 0, 1000, L
|
||||
21 = FTP, tcp, in, 0, 1000, L
|
||||
80 = HTTP, tcp, in, 0, 1000, L
|
||||
22 = SSH, tcp, in, 0, 1000, L
|
||||
110 = POP3, tcp, in, 0, 1000, L
|
||||
139 = NETBIOS, tcp, in, 0, 1000, L
|
||||
3306 = MYSQL, tcp, in, 0, 1000, L
|
||||
53 = DNS, udp, in, 0, 1000, L
|
||||
143 = IMAP, tcp, in, 0, 1000, L
|
||||
</desc>
|
||||
graphs_per_row = 3
|
||||
</port>
|
||||
|
|
Loading…
Reference in New Issue