Changeset - 207c124454d0
[Not reviewed]
tip default
0 1 0
Tyler Durden (virii) - 7 years ago 2016-10-19 18:34:12
virii@c3l.lu
Edited file Exit-Network-Stats.pl via Kallithea
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
Exit-Network-Stats.pl
Show inline comments
 
@@ -19,25 +19,25 @@ my (@nodes_rand, @nodes_sorted);
 
$json        = valid_json($api_request->{content});
 
$json        = parse_json($api_request->{content});
 

	
 

	
 
$nodes_in_numbers = scalar @$json;
 

	
 
push @nodes_rand, [$json->[$_]{ip}, $json->[$_]{name}, $json->[$_]{country}] for (0..$nodes_in_numbers -1);
 
@nodes_sorted = nsort_by { int $_->[0] } @nodes_rand;
 

	
 

	
 
format HEAD =
 
************************************************
 
    Country     RX      TX
 
    Country             RX              TX
 
************************************************
 
.
 
write HEAD;
 

	
 

	
 
for (0..$nodes_in_numbers -1) {
 
    unless ($nodes_sorted[$_][0] == $nodes_sorted[$_ +1][0]) {
 
            $api_request = $api->get('http://' . $nodes_sorted[$_][1] . '.enn.lu/vnstat.xml');
 
            $parser      = XML::LibXML->new();
 
            $vnstat_xml  = $parser->load_xml(string => $api_request->{content});
 

	
 
            $query = '/vnstat/interface/traffic/total';
0 comments (0 inline, 0 general)