Created
July 15, 2013 06:30
-
-
Save tairov/5997864 to your computer and use it in GitHub Desktop.
load avg, large data set
This file contains 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 | |
#if [ 0 == 1 ]; then | |
HOSTS=('pm.mongo1' 'pm.mongo2' 'pm.mongo3' 'pm.mongo4') | |
out="[new Date(\"$(date +"%F %H:%M:%S")\")" | |
for host in ${HOSTS[@]}; do | |
load_avg=$(ssh -p 60222 atairov@$host "cat /proc/loadavg") | |
read avg1 avg5 avg15 _tmp <<< $load_avg | |
out="$out, $avg1, null" | |
#printf "$(date +"%F %H:%m:%S"), $host: " | |
#ssh -p 60222 atairov@$host "cat /proc/loadavg" | |
done | |
out="$out],"; | |
printf "$out\n" >> load_avg_data.txt | |
#fi | |
echo $out | |
# read content into a variable | |
# avgdata=$(<load_avg_data.txt) | |
# добавляем слеши в конце строк, чтобы sed нормально смог совершить замену | |
#esc_avgdata=$(echo "$avgdata"|awk '{printf("%s\\n", $0);}') | |
# подставляем данные в темплейт | |
#sed -e "s/{ROWS_DATA}/$esc_avgdata/g" _template_graph.html > graph.html | |
cat _template_graph.html | php replace_stdinout.php > graph.html | |
cp graph.html "/home/tairov/Ubuntu One/Public/" | |
echo "file://"$(pwd)"/graph.html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment