projects
/
atop-influxdb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d9949e6
)
specify DB using enviroment variable
master
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 12 Dec 2016 06:44:06 +0000
(07:44 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Mon, 12 Dec 2016 06:44:06 +0000
(07:44 +0100)
import-host.sh
patch
|
blob
|
history
diff --git
a/import-host.sh
b/import-host.sh
index
590469d
..
8ad41f9
100755
(executable)
--- a/
import-host.sh
+++ b/
import-host.sh
@@
-2,14
+2,18
@@
host=$1
tags=$2
host=$1
tags=$2
+db=$3
test -z "$host" && echo "usage: $0 host" && exit 1
test -z "$host" && echo "usage: $0 host" && exit 1
+test -z "$db" && db=$DB
+test -z "$db" && db=atop
+
:> /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";
:> /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\" \| 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
+ 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=
$db
--data-binary '@-' >> /dev/shm/atop-import-$host.sh
done
sh -x /dev/shm/atop-import-$host.sh
done
sh -x /dev/shm/atop-import-$host.sh