added TAGS=dc=ffzg
[atop-influxdb] / import-host.sh
1 #!/bin/sh
2
3 host=$1
4 tags=$2
5 test -z "$host" && echo "usage: $0 host" && exit 1
6
7 :> /dev/shm/atop-import-$host.sh
8 #ssh mjesec.ffzg.hr 'ls -t /var/log/atop/atop_*' | tee /dev/shm/atop.$host.logs | while read log
9 ssh $host 'ls -t /var/log/atop/atop_* || ls -t /var/log/atop.log*' | tee /dev/shm/atop.$host.logs
10 cat /dev/shm/atop.$host.logs | while read log 
11 do
12         echo "# $host:$log";
13         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
14 done
15 sh -x /dev/shm/atop-import-$host.sh