Skip to content

Instantly share code, notes, and snippets.

@1stvamp
Created September 3, 2012 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1stvamp/3610175 to your computer and use it in GitHub Desktop.
Save 1stvamp/3610175 to your computer and use it in GitHub Desktop.
Post custom metric data for a device to the Server Density API
#!/bin/bash
# Use i-node usage for disk usage stats
stat=$(df -i | grep -F /dev/disk1)
av=$(echo $stat | awk '{print $4}')
ius=$(echo $stat | awk '{print $6}')
us=$(echo $stat | awk '{print $8}' | sed -e 's/.$//')
cp=$(echo $stat | awk '{print $5}')
mt=$(echo $stat | awk '{print $9}')
payload="
{
\"agentKey\" : \"6d6ed3d1150ba02f1aa30c43\",
\"diskUsage\": [
[\"/dev/disk1\", \"$ius\", \"$us\", \"$av\", \"$cp\", \"$mt\"]
]
}"
echo $payload | densli metrics.postback deviceId=4cb4ab6d7addf98506010000 --postback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment