- my @tags = ( "host=$host_tags", $ENV{TAGS} || 'no_tags=true' );
-
- my $port = $if[$i];
- if ( $port =~ m/if(\d\d)(\d\d\d\d)/ ) {
- push @tags, "prefix=$1,vlan=$2";
- } elsif ( m/if(\d+)/ ) {
- push @tags, "port=$1";
+ my $if = $if[$i];
+
+ my @tags = ( "if=$if", "host=$host_tags", $ENV{TAGS} || 'no_tags=true' );
+=for later
+ if ( $if =~ m/if(\d\d)(\d\d\d\d)/ ) {
+ push @tags, "is_vlan=T,prefix=$1,vlan=$2";
+ } elsif ( $if =~ m/if(\d+)/ ) {
+ push @tags, "is_vlan=F,port=$1";
+ } else {
+ push @tags, "unknown_if=$if";
+ }
+=cut
+
+ my $v1 = $v[$i*2+1];
+ my $v2 = $v[$i*2+2];
+
+ if ( $v1 =~ m/^\d+\.\d++$/ && $v2 =~ m/^\d+\.\d++$/ ) {
+
+ $total[0] += $v1;
+ $total[1] += $v2;
+
+ $v1 = int( $v1 * 1024 );
+ $v2 = int( $v2 * 1024 );
+
+ print $curl "ifstat,", join(',', @tags),
+ " ", $direction[$i*2], "=${v1}i",
+ ",", $direction[$i*2+1], "=${v2}i",
+ " $time\n" if $v1 < 100_000_000_000_000 && $v2 < 100_000_000_000_000;
+
+ $lines++;
+ } else {
+ warn "IGNORED $if $v1 $v2\n";