Skip to content

Instantly share code, notes, and snippets.

@mattintosh4
Last active March 1, 2017 17:51
Show Gist options
  • Save mattintosh4/fefd07b46cec86ef79463aa1a41d174d to your computer and use it in GitHub Desktop.
Save mattintosh4/fefd07b46cec86ef79463aa1a41d174d to your computer and use it in GitHub Desktop.
db_prefix = "/srv/nfs4/"
db(f) = db_prefix . f . ".sqlite3"
hexcolor(r, g, b) = sprintf("#%02x%02x%02x", r, g, b)
set term svg enhanced size 1024,480 background rgb "white"
set output "/opt/local/nginx/html/sensors/g2_brightness.svg"
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set title "BRIGHTNESS SENSORS"
set bmargin 3
set lmargin 10
set rmargin 10
set grid xtics ytics mytics
set xtics font ",10" nomirror
set ytics font ",10" format "%g Lx" nomirror
set logscale y
set key left font "monospace,10" box opaque
plot \
"< sqlite3 -separator , " . db("temp") . " 'select * from NJL7302L where date >= datetime(\"now\",\"-24 hours\",\"localtime\")'" \
u 1:4 with lines lc rgb hexcolor(255, 128, 0) title "NJL7302L /w LM358N (x3)"
set term svg enhanced size 1024,480 font ",8" background rgb "white"
set output "/opt/local/nginx/html/sensors/g5_client2.svg"
set datafile separator "|"
set xdata time
set timefmt "%s"
set multiplot
set lmargin 11
set rmargin 11
set key left font "monospace" box opaque
set title "RASPBERRY PI 2"
set size 1.0,0.5
set origin 0.0,0.5
set xtics font ",8" format "%H:%M" nomirror
set ytics 10 font ",8" format "%g (*C/%%)" nomirror
set y2tics font ",8" format "%g MHz" nomirror
set mytics 2
set yrange [0:100]
set y2range [500:1000]
set grid
plot "< sqlite3 /srv/nfs4/RPi2.sqlite3 -cmd '.timeout 10000' 'select * from RPi2 where ROWID > (select max(ROWID) from RPi2) - 3600'" \
u ($1+9*60*60):2 w lines title "ARM Temperature(*C)" \
, "" u ($1+9*60*60):3 w lines axis x1y2 title "ARM Frequency(MHz)" \
, "" u ($1+9*60*60):4 w lines title "CPU Usage(%)" \
, "" u ($1+9*60*60):5 w lines title "VM Usage(%)"
set title "NETWORK BANDWIDTH"
set size 0.5,0.5
set origin 0.0,0.0
unset ytics
unset mytics
unset y2tics
unset yrange
unset y2range
set xtics 3600
set ytics autofreq font ",8" format "%g KiB/s"
set style fill solid 0.5 noborder
plot \
"" u ($1+9*60*60):($6/1024) w boxes title "Recieved(KiB/s)" \
, "" u ($1+9*60*60):($7/1024) w steps title "Sent(KiB/s)"
unset ytics
unset mytics
unset y2tics
unset yrange
unset y2range
set title "DISK USAGE"
set size 0.5,0.5
set origin 0.5,0.0
set xtics 3600
set ytics font ",8" format "%g %%" nomirror
set grid xtics ytics
plot \
"" u ($1+9*60*60):8 w lines title "mmcblk0p2" \
, "" u ($1+9*60*60):9 w lines title "sda1(1GB)" \
, "" u ($1+9*60*60):10 w lines title "sda2(1GB)" \
, "" u ($1+9*60*60):11 w lines title "sda3(1GB)" \
, "" u ($1+9*60*60):12 w lines title "sdb1(1GB)"
db(f) = "/srv/nfs4/" . f . ".sqlite3"
hexcolor(r, g, b) = sprintf("#%02x%02x%02x", r, g, b)
set term svg enhanced size 1024,480 font ",9" background rgb "white"
set output "/opt/local/nginx/html/sensors/g3_cpu.svg"
set datafile separator "|"
set xdata time
set timefmt "%s"
set multiplot
set lmargin 10
set rmargin 10
set key left font "monospace,9" box opaque
set grid xtics ytics mytics
set title font ",10" "RASPBERRY PI 3 (" . strftime("%F %T",time(0)+9*60*60) . ")"
set size 1.0,0.5
set origin 0.0,0.5
set xtics format "%H:%M" nomirror
set ytics 10 format "%g" nomirror
set y2tics format "%g MHz"
set ylabel "USAGE(%) / TEMPERATURE(*C)"
set y2label "ARM FREQ"
set yrange [0:100]
set y2range [400:1400]
plot \
"< sqlite3 -cmd '.timeout 10000' " . db("RPi") . " '.read " . system("echo $HOME") . "/src/sensors/rpi_cpu.sql'" \
u ($1+9*60*60):3 w points title "ARM Frequency(MHz)" axis x1y2 \
, "" u ($1+9*60*60):4 w impulses title "CPU Usage(%)" axis x1y1 \
, "" u ($1+9*60*60):5 w lines lc rgb hexcolor(255,128, 0) title "VM Usage(%)" axis x1y1 \
, "" u ($1+9*60*60):2 w lines lc rgb hexcolor(255, 0, 0) title "ARM Temperature(*C)" axis x1y1
unset xtics
unset ytics
unset y2tics
unset ylabel
unset y2label
unset yrange
unset y2range
set title font ",10" "NETWORK BANDWIDTH"
set size 0.5,0.5
set origin 0.0,0.0
set xtics auto font ",9" format "%H:%M" nomirror
set ytics auto font ",9" format "%g KiB/s" nomirror
set style fill solid 0.5 noborder
plot \
"" u ($1+9*60*60):6 w boxes lc rgb hexcolor(255,128, 0) title "Recieved(KiB/s)" \
, "" u ($1+9*60*60):7 w steps lc rgb hexcolor(255, 0, 0) title "Sent(KiB/s)"
unset xtics
unset ytics
unset y2tics
unset ylabel
unset y2label
unset yrange
unset y2range
set title font ",10" "DISK USAGE"
set size 0.5,0.5
set origin 0.5,0.0
set xtics format "%H:%M" nomirror
set ytics format "%g %%" nomirror
set yrange [0:100]
set style fill solid 1.0 noborder
plot \
"" u ($1+9*60*60):8 w steps title "mmcblk0p2(%)"
db_prefix = "/srv/nfs4/"
db(f) = db_prefix . f . ".sqlite3"
hexcolor(r, g, b) = sprintf("#%02x%02x%02x", r, g, b)
set term svg enhanced size 1024,480 background rgb "white"
set output "/opt/local/nginx/html/sensors/g5_server.svg"
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set title "SERVER STATUS"
set bmargin 3
set lmargin 10
set rmargin 10
set grid xtics ytics mytics
set xtics font ",10" format "%H:%M" nomirror
set ytics font ",10" format "%g %%" nomirror
set y2tics font ",10"
set yrange [0:100]
set y2range [0:10]
set ylabel "USAGE (%)"
set y2label "LOGIN USERS"
set key left font "monospace,10" box opaque
plot \
"< sqlite3 -separator , " . db("ubuntu") . " '.read " . system("echo $HOME") . "/src/sensors/sysmon.sql'" \
u 1:2 w impulse lc rgb hexcolor(255, 64, 64) title " CPU (%)" \
, "" u 1:3 w lines title "MEMORY (%)" \
, "" u 1:4 w lines title " DISK (%)" \
, "" u 1:5 w steps lc rgb hexcolor( 96, 96, 96) title " LOGIN " axis x1y2
db_prefix = "/srv/nfs4/"
db(f) = db_prefix . f . ".sqlite3"
set term svg enhanced size 1024,480 background rgb "white"
set output "/opt/local/nginx/html/sensors/g1_temp.svg"
set datafile separator "|"
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set title "THERMAL SENSORS"
set bmargin 3
set lmargin 10
set rmargin 10
set grid
set mxtics 4
set mytics 5
set ylabel "TEMPERATURE"
set y2label "HUMIDITY"
set xtics format "%H:%M" font ",10" nomirror
set ytics format "%g *C" font ",10" nomirror
set y2tics format "%g %%" font ",10"
set yrange [10:30]
set y2range [10:90]
set key left font "monospace,10" box opaque
plot \
"< sqlite3 -cmd '.timeout 10000' " . db("DHT11") . " '.read " . system("echo $HOME") . "/src/sensors/dht11_all.sql'" \
u 1:2 w lines title "DHT11 (Temperature)" \
, "" u 1:3 w lines lc rgb sprintf("#%02x%02x%02x",128,192,255) title "DHT11 (Humidity)" axis x1y2 \
, "< sqlite3 -cmd '.timeout 10000' " . db("temp") . " '.read " . system("echo $HOME") . "/src/sensors/lm_all.sql'" \
u 1:6 w lines dt "-" lc rgb sprintf("#%02x%02x%02x",128,128,128) title "Average within 24 hours (LM35DZ)" \
, "" u 1:2 w lines lc rgb sprintf("#%02x%02x%02x",255, 64, 64) title "LM61CIZ" \
, "" u 1:3 w lines lc rgb sprintf("#%02x%02x%02x",128, 64, 64) title "LM61BIZ" \
, "" u 1:4 w lines lc rgb sprintf("#%02x%02x%02x", 64,255, 64) title "LM61CIZ /w LM358N (x2)" \
, "" u 1:5 w lines lc rgb sprintf("#%02x%02x%02x", 64,128, 64) title "LM35DZ /w LM358N (x3)"
db_prefix = "/srv/nfs4/"
db(f) = db_prefix . f . ".sqlite3"
hexcolor(r, g, b) = sprintf("#%02x%02x%02x", r, g, b)
set term svg enhanced size 1024,480 background rgb "white"
set output "/opt/local/nginx/html/sensors/g1_temp2.svg"
set datafile separator ","
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set title "NON-INVERTING AMPLIFIERS TEST"
set bmargin 3
set lmargin 10
set rmargin 10
set grid xtics ytics mytics
set mytics 4
set ylabel "TEMPERATURE"
set y2label "HUMIDITY"
set xtics font ",10" format "%H:%M" nomirror
set ytics font ",10" format "%g *C" nomirror
set y2tics font ",10" format "%g V"
set key left font "monospace,10" box opaque
plot \
"< sqlite3 -separator , " . db("temp") . " '.read " . system("echo $HOME") . "/src/sensors/lm_all2.sql'" \
u 1:2 w lines lc rgb hexcolor(255, 64, 64) title " LM61CIZ (V)" axis x1y2 \
, "" u 1:4 w lines lc rgb hexcolor( 64,255, 64) title "LM61CIZ /w LM358N x2 (V)" axis x1y2 \
, "" u 1:6 w lines lc rgb hexcolor(128, 64, 64) title " LM61BIZ (V)" axis x1y2 \
, "" u 1:8 w lines lc rgb hexcolor( 64,128, 64) title " LM35DZ /w LM358N x3 (V)" axis x1y2 \
, "" u 1:3 w linespoints pt 7 lc rgb hexcolor(255, 64, 64) title " LM61CIZ (*C)" \
, "" u 1:5 w linespoints pt 7 lc rgb hexcolor( 64,255, 64) title "LM61CIZ /w LM358N x2 (*C)" \
, "" u 1:7 w linespoints pt 7 lc rgb hexcolor(128, 64, 64) title " LM61BIZ (*C)" \
, "" u 1:9 w linespoints pt 7 lc rgb hexcolor( 64,128, 64) title " LM35DZ /w LM358N x3 (*C)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment