return $time;
}
+my $tags = $ENV{TAGS};
+$tags = ",$tags" unless $tags =~ m/^,/;
+
while(<>) {
chomp;
next if /^$/;
next if $measurement =~ /top3/; # FIXME this isn't parsed yet
#XXX { cols => \@cols, vals => \@vals };
- print "atop_$measurement,host=$host";
+ print "atop_$measurement,host=$host$tags";
my $d = " ";
foreach my $i ( 0 .. $#cols ) {
if ( my $c = $cols[$i] ) {
#!/bin/sh
host=$1
+tags=$2
test -z "$host" && echo "usage: $0 host" && exit 1
:> /dev/shm/atop-import-$host.sh
cat /dev/shm/atop.$host.logs | while read log
do
echo "# $host:$log";
- echo ssh $host \"atopsar -A -r $log\" \| ./atop2influx.pl \| tee /dev/shm/atop.$host.influx \| curl -i -X POST http://localhost:8086/write?db=atop --data-binary '@-' >> /dev/shm/atop-import-$host.sh
+ echo ssh $host \"atopsar -A -r $log\" \| TAGS=$tags ./atop2influx.pl \| tee /dev/shm/atop.$host.influx \| curl -i -X POST http://localhost:8086/write?db=atop3 --data-binary '@-' >> /dev/shm/atop-import-$host.sh
done
sh -x /dev/shm/atop-import-$host.sh