Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
SQL="select count(*), date_trunc('day', to_timestamp(create_date)) as create_dated from user_registration group by create_dated order by create_dated;" | ||
result=$( echo ${SQL} | psql -qtU postgres -d tornadowatch | awk '{ print $1, $3 }' | grep 2012 ) | ||
start=$( echo "${result}" | head -n1 | awk '{print $2}' ) | ||
end=$( echo "${result}" | tail -n1 | awk '{print $2}' ) | ||
echo "${result}" > /tmp/reg.dat | ||
cat > /tmp/reg.plt<<EOF | ||
set terminal png size 600,400 | ||
set xdata time | ||
set timefmt "%Y-%m-%d" | ||
set format x "%m/%d" | ||
set output "/www/silverwraith.com/canonical/tw.silverwraith.com/htdocs/user_registrations_daily.png" | ||
# time range must be in same format as data file | ||
set xrange ["${start}":"${end}"] | ||
#set yrange [0:50] | ||
set grid | ||
set xlabel "Date\\nTime" | ||
set ylabel "Users" | ||
set title "User registrations" | ||
set key left box | ||
plot "/tmp/reg.dat" using 2:1 index 0 title "User registrations" with lines | ||
EOF | ||
cat /tmp/reg.plt | gnuplot | ||
|
||
SQL="select count(*), date_part('hour', to_timestamp(create_date)) as create_dated from user_registration group by create_dated order by create_dated;" | ||
result=$( echo ${SQL} | psql -qtU postgres -d tornadowatch | awk '{ print $1, $3 }' | grep "[0-9]" ) | ||
echo "${result}" > /tmp/reg.dat | ||
cat > /tmp/reg.plt<<EOF | ||
set terminal png size 600,400 | ||
set xdata time | ||
set timefmt "%H" | ||
set format x "%H" | ||
set output "/www/silverwraith.com/canonical/tw.silverwraith.com/htdocs/user_registrations_hourly.png" | ||
# time range must be in same format as data file | ||
set xrange ["0":"23"] | ||
#set yrange [0:50] | ||
set grid | ||
set xlabel "Hour of day" | ||
set ylabel "Users" | ||
set title "User registrations" | ||
set key left box | ||
plot "/tmp/reg.dat" using 2:1 index 0 title "User registrations" with lines | ||
EOF | ||
cat /tmp/reg.plt | gnuplot |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set terminal png size 1200,800 | ||
set xdata time | ||
set timefmt "%s" | ||
set output "/www/silverwraith.com/canonical/tw.silverwraith.com/htdocs/load.png" | ||
# time range must be in same format as data file | ||
#set xrange ["1331601802":"1332375229" | ||
set yrange [0:50] | ||
set grid | ||
set xlabel "Date\\nTime" | ||
set ylabel "Users" | ||
set title "User registrations" | ||
set key left box | ||
plot "load.dat" using 1:2 index 0 title "ahost" with lines |