fluxplug: make initial commit
Signed-off-by: Nagy Károly Gábriel <k@jpi.io>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
myhost=$(/bin/hostname -f)
|
||||
CURL="/usr/bin/curl -is -u user:password -XPOST 'http://influxdb.url/write?db=jpi' --data-binary "
|
||||
AWK="/usr/bin/awk"
|
||||
WC="/usr/bin/wc"
|
||||
DF="/bin/df -t ext4 "
|
||||
SED="/bin/sed -e 1d"
|
||||
CHRONY="/usr/bin/chronyc -nc tracking"
|
||||
|
||||
z=$(basename $0)
|
||||
IAM="${z%.*}"
|
||||
|
||||
tmpfile="$HOME"/tmp/"$IAM"
|
||||
datafile="$HOME"/data/"$IAM"
|
||||
|
||||
MAXLINES=10
|
||||
|
||||
sendfile() {
|
||||
datfile="$1"
|
||||
echo $CURL" @$datfile"
|
||||
}
|
||||
|
||||
writeline() {
|
||||
line="$1"
|
||||
length="$2"
|
||||
echo "$line" >> "$tmpfile"
|
||||
lines=$("$WC" -l < "$tmpfile")
|
||||
if [ "$lines" -ge $length ]; then
|
||||
mv "$tmpfile" "$datafile"
|
||||
sendfile "$datafile"
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user