Created
March 27, 2017 18:54
-
-
Save ayufan/41a05fb6f5840a1f2b4335f01498ff1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
join_by() { | |
local IFS="," | |
echo "$*" | |
} | |
get_data() { | |
local QUERIES=$(join_by "$@") | |
while read -d "," VALUE REST; do | |
echo "$1,hostname=$HOSTNAME value=$VALUE" | |
shift | |
done < <(nvidia-smi --query-gpu="${QUERIES[@]}" --format=csv | tail -n 1) | |
} | |
DB=pc | |
CREDS=user:password | |
METRICS="power.draw power.limit temperature.gpu | |
clocks.current.graphics clocks.current.sm clocks.current.memory clocks.current.video | |
utilization.gpu utilization.memory memory.used memory.total fan.speed" | |
curl -v -u "$CREDS" -X POST "https://influxdb.ayufan.eu/write?db=$DB" --data-binary "$(get_data $METRICS)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how exactly does this work? Im trying to run it on my debian box and I am failing to get any data into influx