From b1e6bb4fe4f1f24781d873b02eabb71598090ee9 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 10 Dec 2016 13:29:19 +0100 Subject: [PATCH 1/1] import helper scripts --- import-files.sh | 6 ++++++ import-host.sh | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 import-files.sh create mode 100755 import-host.sh diff --git a/import-files.sh b/import-files.sh new file mode 100755 index 0000000..256c30c --- /dev/null +++ b/import-files.sh @@ -0,0 +1,6 @@ +#!/bin/sh -x +while [ ! -z "$1" ] ; do + echo "# $1"; + atopsar -A -r $1 | ./atop2influx.pl | curl -i -X POST http://localhost:8086/write?db=atop --data-binary '@-' + shift; +done diff --git a/import-host.sh b/import-host.sh new file mode 100755 index 0000000..12ef387 --- /dev/null +++ b/import-host.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +host=$1 +test -z "$host" && echo "usage: $0 host" && exit 1 + +:> /dev/shm/atop-import-$host.sh +#ssh mjesec.ffzg.hr 'ls -t /var/log/atop/atop_*' | tee /dev/shm/atop.$host.logs | while read log +ssh $host 'ls -t /var/log/atop/atop_* || ls -t /var/log/atop.log*' | tee /dev/shm/atop.$host.logs +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 +done +sh -x /dev/shm/atop-import-$host.sh -- 2.20.1