mirror of https://github.com/mikaku/Monitorix.git
Introduced the option 'cmd' in 'netstat.pm'
From now on the user will have the opportunity to select which command will use to gather the network status statistics. The new option 'cmd' supports two values 'netstat' or 'ss', being the later the value by default. If the 'cmd' option is not defined, then the command line used will be 'ss', that's because in newer Linux systems it looks like the command 'netstat' is being deprecated. In older Linux systems people will be forced to use the 'netstat' command because, early 'ss' versions doesn't contain the protocol column in its output, which breaks the regexp used to extract the the values. #196
This commit is contained in:
parent
3fc9cab78c
commit
4174fea546
|
@ -179,7 +179,8 @@ sub netstat_update {
|
|||
my $rrdata = "N";
|
||||
|
||||
if($config->{os} eq "Linux") {
|
||||
if (`which ss`) {
|
||||
my $cmd = $config->{netstat}->{cmd} || "";
|
||||
if(!$cmd || $cmd eq "ss") {
|
||||
if(open(IN, "ss -na -f inet |")) {
|
||||
while(<IN>) {
|
||||
m/^(\S+)\s+(\S+)/;
|
||||
|
@ -228,7 +229,8 @@ sub netstat_update {
|
|||
}
|
||||
close(IN);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if($cmd eq "netstat") {
|
||||
if(open(IN, "netstat -tn -A inet |")) {
|
||||
while(<IN>) {
|
||||
my $last = (split(' ', $_))[-1];
|
||||
|
|
|
@ -375,6 +375,7 @@ secure_log_date_format = %b %e
|
|||
# NETSTAT graph
|
||||
# -----------------------------------------------------------------------------
|
||||
<netstat>
|
||||
cmd = ss
|
||||
rigid = 0, 0, 0, 0, 0
|
||||
limit = 100, 100, 100, 100, 100
|
||||
</netstat>
|
||||
|
|
Loading…
Reference in New Issue