#!/usr/bin/perl -w use strict; use Sys::Statistics::Linux; my $log_file = '/tmp/netstats.yml'; my $sleep = 1; my $lxs = Sys::Statistics::Linux->new( netstats => { init => 1, initfile => $log_file, }, ); while( 1 ) { my $stat = $lxs->get( $sleep ); my $netstats_ppp0 = $stat->{netstats}{ppp0}; my $bytes_per_second = $netstats_ppp0->{ttbyt}; print $bytes_per_second, "\n"; }