set proper margins

set proper margins

#!/usr/bin/env gnuplot

# graph of network usage

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql4gnuplot/sql13h.csv"
ifnamed = "/tmp/lnxdiagd/mysql4gnuplot/sql13d.csv"
ifnamew = "/tmp/lnxdiagd/mysql4gnuplot/sql13w.csv"
ifnamey = "/tmp/lnxdiagd/mysql4gnuplot/sql13y.csv"
set output "/tmp/lnxdiagd/site/img/day13.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,480
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94
TTPOS = 0.95
TBPOS = 0.55
BTPOS = 0.48
BBPOS = 0.08

# network data is recorded in bytes per 1 minute
# hourly data is queried in 1 minute intervals and post-processed to bytes/second
# convert to bits per second:
BPSh = 8.
# daily data is queried in 30 minute intervals (1800s) and post-processed to bytes/second
# convert to bits per second:
BPSd = 8.
# weekly data is queried in 120 minute intervals (7200s) and post-processed to bytes/second
# convert to bits per second:
BPSw = 8.
# yearly data is queried in 1 week intervals (604 800s) and post-processed to bytes/second
# convert to bits per second:
BPSy = 8.

# ************************************************************* Functions ******
# determine speed of data
speedh(x) = x * BPSh
speedd(x) = x * BPSd
speedw(x) = x * BPSw
speedy(x) = x * BPSy

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput
Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here of column 7 (Upload bytes per minute)
stats ifnameh using 6 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput
Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here of column 7 (Upload bytes per minute)
stats ifnamed using 6 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here of column 7 (Upload bytes per minute)
stats ifnamew using 6 name "Yw" nooutput

Ymax = max(max(speedd(Yd_max), speedh(Yh_max)), speedw(Yw_max))
Ymin = 1024
#Ystd = max(max(Yd_stddev, Yh_stddev), Yw_stddev)
#Ymean = max(max(Yd_mean, Yh_mean), Yw_mean)
#Ymax = (Ymean + Ystd) * 3

# ********************** Statistics for the bottom graphs **********************
# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 6 (Download bytes per minute)
stats ifnameh using 3 name "Ybh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 6 (Download bytes per minute)
stats ifnamed using 3 name "Ybd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 6 (Download bytes per minute)
stats ifnamew using 3 name "Ybw" nooutput

# ********************************************************* Statistics (Y) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamey using 1 name "X" nooutput
Xy_min = X_min + utc_offset - epoch_compensate
Xy_max = X_max + utc_offset - epoch_compensate

set multiplot layout 4, 3 title "Network load ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  UPPER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""            # Display time in 24 hour notation on the X axis
set xrange [ Xy_min : Xy_max ]

# ***************************************************************** Y-axis *****
set ylabel "Network load [bits/sec]"
set yrange [ : ]
set format y "%3.0s%c"
set logscale y

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****

#set bmargin 0
set tmargin at screen TTPOS
set bmargin at screen TTPOS - 0.2
set lmargin at screen LMARG
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnamey \
      using ($1+utc_offset):(speedy($6)) title "Upload (eth0)" with lines lc rgb "#cc0000bb" lw 1

# ***************************************************************** X-axis *****
set format x "%b"            # Display time in 24 hour notation on the X axis
set xrange [ Xy_min : Xy_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set yrange [ : ] reverse
set format y "%3.0s%c"
set logscale y

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****

#set tmargin 0
#unset bmargin
set tmargin at screen TTPOS - 0.2
set bmargin at screen TBPOS
set lmargin at screen LMARG
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnamey \
      using ($1+utc_offset):(speedy($3)) title "Download (eth0)" with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  LOWER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                    TOP LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Network load [bits/sec]"
set yrange [ Ymin : Ymax ]
set format y "%3.0s%c"
set logscale y

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****

set tmargin at screen BTPOS
set bmargin at screen BTPOS - 0.2
set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):(speedw($6)) title "Upload (eth0)" with lines lc rgb "#cc0000bb" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                 TOP MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):(speedd($6)) with lines lc rgb "#cc0000bb" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                  TOP RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):(speedh($6)) with lines lc rgb "#cc0000bb" lw 1

################################################################################
################################################################################
################################## BOTTOM PLOT #################################
################################################################################
################################################################################

Ymax = max(max(speedd(Ybd_max), speedh(Ybh_max)), speedw(Ybw_max))
#Ymin = min(min(Ybd_min, Ybh_min), Ybw_min) -1
Ymin = 1024
#Ystd = max(max(Ybd_stddev, Ybh_stddev), Ybw_stddev)
#Ymean = max(max(Ybd_mean, Ybh_mean), Ybw_mean)
#Ymax = (Ymean + Ystd) * 3

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                    BTM LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set yrange [ Ymax : Ymin ] # reverse
set format y "%3.0s%c"

# ***************************************************************** Legend *****
set key inside bottom left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****

set tmargin at screen BTPOS - 0.2
set bmargin at screen BBPOS
set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):(speedw($3)) title "Download (eth0)" with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                 BTM MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymax : Ymin ] # reverse

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):(speedd($3)) with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                  BTM RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymax : Ymin ] # reverse

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):(speedh($3)) with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of network usage

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql4gnuplot/sql13h.csv"
ifnamed = "/tmp/lnxdiagd/mysql4gnuplot/sql13d.csv"
ifnamew = "/tmp/lnxdiagd/mysql4gnuplot/sql13w.csv"
ifnamey = "/tmp/lnxdiagd/mysql4gnuplot/sql13y.csv"
set output "/tmp/lnxdiagd/site/img/day13.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,480
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94
TTPOS = 0.95
TBPOS = 0.55
BTPOS = 0.48
BBPOS = 0.08

# network data is recorded in bytes per 1 minute
# hourly data is queried in 1 minute intervals and post-processed to bytes/second
# convert to bits per second:
BPSh = 8.
# daily data is queried in 30 minute intervals (1800s) and post-processed to bytes/second
# convert to bits per second:
BPSd = 8.
# weekly data is queried in 120 minute intervals (7200s) and post-processed to bytes/second
# convert to bits per second:
BPSw = 8.
# yearly data is queried in 1 week intervals (604 800s) and post-processed to bytes/second
# convert to bits per second:
BPSy = 8.

# ************************************************************* Functions ******
# determine speed of data
speedh(x) = x * BPSh
speedd(x) = x * BPSd
speedw(x) = x * BPSw
speedy(x) = x * BPSy

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput
Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here of column 7 (Upload bytes per minute)
stats ifnameh using 6 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput
Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here of column 7 (Upload bytes per minute)
stats ifnamed using 6 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here of column 7 (Upload bytes per minute)
stats ifnamew using 6 name "Yw" nooutput

Ymax = max(max(speedd(Yd_max), speedh(Yh_max)), speedw(Yw_max))
Ymin = 1024
#Ystd = max(max(Yd_stddev, Yh_stddev), Yw_stddev)
#Ymean = max(max(Yd_mean, Yh_mean), Yw_mean)
#Ymax = (Ymean + Ystd) * 3

# ********************** Statistics for the bottom graphs **********************
# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 6 (Download bytes per minute)
stats ifnameh using 3 name "Ybh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 6 (Download bytes per minute)
stats ifnamed using 3 name "Ybd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 6 (Download bytes per minute)
stats ifnamew using 3 name "Ybw" nooutput

# ********************************************************* Statistics (Y) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamey using 1 name "X" nooutput
Xy_min = X_min + utc_offset - epoch_compensate
Xy_max = X_max + utc_offset - epoch_compensate

set multiplot layout 4, 3 title "Network load ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  UPPER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%b"            # Display time in 24 hour notation on the X axis
set xrange [ Xy_min : Xy_max ]

# ***************************************************************** Y-axis *****
set ylabel "Network load [bits/sec]"
set yrange [ : ]
set format y "%3.0s%c"
set logscale y

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****

set bmargin 0
#set tmargin at screen BTPOS
#set bmargin at screen BBPOS
set lmargin at screen LMARG
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnamey \
      using ($1+utc_offset):(speedy($6)) title "Upload (eth0)" with lines lc rgb "#cc0000bb" lw 1

# ***************************************************************** X-axis *****
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xy_min : Xy_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set yrange [ : ] reverse
set format y "%3.0s%c"
set logscale y

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****

set tmargin 0
unset bmargin
set lmargin at screen LMARG
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnamey \
      using ($1+utc_offset):(speedy($3)) title "Download (eth0)" with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                  LOWER ROW
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                    TOP LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if (0) { # commented out block
# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Network load [bits/sec]"
set yrange [ Ymin : Ymax ]
set format y "%3.0s%c"
set logscale y

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****

set bmargin 0
#set tmargin at screen BTPOS
#set bmargin at screen BBPOS
set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):(speedw($6)) title "Upload (eth0)" with lines lc rgb "#cc0000bb" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                 TOP MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):(speedd($6)) with lines lc rgb "#cc0000bb" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                  TOP RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x ""            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):(speedh($6)) with lines lc rgb "#cc0000bb" lw 1

################################################################################
################################################################################
################################## BOTTOM PLOT #################################
################################################################################
################################################################################

Ymax = max(max(speedd(Ybd_max), speedh(Ybh_max)), speedw(Ybw_max))
#Ymin = min(min(Ybd_min, Ybh_min), Ybw_min) -1
Ymin = 1024
#Ystd = max(max(Ybd_stddev, Ybh_stddev), Ybw_stddev)
#Ymean = max(max(Ybd_mean, Ybh_mean), Ybw_mean)
#Ymax = (Ymean + Ystd) * 3

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                    BTM LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set yrange [ Ymax : Ymin ] # reverse
set format y "%3.0s%c"

# ***************************************************************** Legend *****
set key inside bottom left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****

set tmargin 0
unset bmargin
set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):(speedw($3)) title "Download (eth0)" with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                 BTM MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymax : Ymin ] # reverse

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):(speedd($3)) with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                  BTM RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymax : Ymin ] # reverse

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):(speedh($3)) with lines lc rgb "#ccbb0000" lw 1

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot
} # end of commented block


lines use lc

lines use lc

#!/usr/bin/env gnuplot

# graph of current power usage

# datafiles
ifnameh = "/tmp/kamstrupd/mysql/kamh2.csv"
ifnamed = "/tmp/kamstrupd/mysql/kamd2.csv"
ifnamew = "/tmp/kamstrupd/mysql/kamw2.csv"
set output "/tmp/kamstrupd/site/img/kamstrup11.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 4 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 4 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1

set multiplot layout 1, 3 title "Actueel vermogen ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Vermogen [W]"
set yrange [ 0 : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):4 title " Vermogen [W]" with lines lw 0.1 lc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ 0 : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):4 with lines lw 0.1 lc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ 0 : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):4 with lines lw 0.1 lc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of current power usage

# datafiles
ifnameh = "/tmp/kamstrupd/mysql/kamh2.csv"
ifnamed = "/tmp/kamstrupd/mysql/kamd2.csv"
ifnamew = "/tmp/kamstrupd/mysql/kamw2.csv"
set output "/tmp/kamstrupd/site/img/kamstrup11.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid front
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 4 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 4 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 4 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1

set multiplot layout 1, 3 title "Actueel vermogen ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Vermogen [W]"
set yrange [ 0 : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):4 title " Vermogen [W]" with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ 0 : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ 0 : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):4 with lines lw 0.1 fc rgb "#ccbb0000"
      # with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot


slight readjustment

slight readjustment

#!/usr/bin/env gnuplot

# graph of CPU temperature

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql/sql11h.csv"
ifnamed = "/tmp/lnxdiagd/mysql/sql11d.csv"
ifnamew = "/tmp/lnxdiagd/mysql/sql11w.csv"
set output ofname = "/tmp/lnxdiagd/site/img/day11.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera,9" size 1280,304
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
# Positions of split between graphs
LMPOS = 0.40
MRPOS = 0.75

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - 946684800
Xh_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
#stats ifnameh using 4 name "Y" nooutput
#Yh_min = Y_min * 0.90
#Yh_max = Y_max * 1.10

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - 946684800
Xd_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
#stats ifnamed using 4 name "Y" nooutput
#Yd_min = Y_min * 0.90
#Yd_max = Y_max * 1.10

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - 946684800
Xw_max = X_max + utc_offset - 946684800

# stats for Y-axis
stats ifnamew using 4 name "Y" nooutput
Yw_min = Y_min -1
Yw_max = Y_max +1

set multiplot layout 1, 3 title "CPU Temperature"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ Yw_min : Yw_max ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Temperature [degC]" with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Yw_min : Yw_max ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Yw_min : Yw_max ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin -1

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set timestamp 'created: %Y-%m-%d %H:%M' bottom font "Vera,6"
unset multiplot

#!/usr/bin/env gnuplot

# graph of CPU temperature

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql/sql11h.csv"
ifnamed = "/tmp/lnxdiagd/mysql/sql11d.csv"
ifnamew = "/tmp/lnxdiagd/mysql/sql11w.csv"
set output ofname = "/tmp/lnxdiagd/site/img/day11.png"

# ******************************************************* General settings *****
set terminal png truecolor enhanced font "Vera,9" size 1280,304
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
# Positions of split between graphs
LMPOS = 0.40
MRPOS = 0.70

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 2 name "X" nooutput

Xh_min = X_min + utc_offset - 946684800
Xh_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
#stats ifnameh using 4 name "Y" nooutput
#Yh_min = Y_min * 0.90
#Yh_max = Y_max * 1.10

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 2 name "X" nooutput

Xd_min = X_min + utc_offset - 946684800
Xd_max = X_max + utc_offset - 946684800

# stats to be calculated here for Y-axes
#stats ifnamed using 4 name "Y" nooutput
#Yd_min = Y_min * 0.90
#Yd_max = Y_max * 1.10

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 2 name "X" nooutput
Xw_min = X_min + utc_offset - 946684800
Xw_max = X_max + utc_offset - 946684800

# stats for Y-axis
stats ifnamew using 4 name "Y" nooutput
Yw_min = Y_min -1
Yw_max = Y_max +1

set multiplot layout 1, 3 title "CPU Temperature"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ Yw_min : Yw_max ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($2+utc_offset):4 title " Temperature [degC]" with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Yw_min : Yw_max ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($2+utc_offset):4 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Yw_min : Yw_max ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin -1

# ***** PLOT *****
plot ifnameh \
      using ($2+utc_offset):4 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set timestamp 'created: %Y-%m-%d %H:%M' bottom font "Vera,6"
unset multiplot


remove duplicate test

remove duplicate test

:- begin_tests(numberals).
:- consult('numberals.pl').

logging :- fail.

log_writef(A, B) :- logging -> writef(A, B); true.
log_writef(A) :- log_writef(A, []).

test_both_ways(Num, Name) :-
	ground([Num, Name]),
	log_writef( '%q -> %s : ', [Num,  Name] ), number_to_name(Num, Test_Name), log_writef( 'Got %s', [Test_Name]), log_writef('\n'), Name = Test_Name,
	log_writef( '%s -> %q : ', [Name,  Num] ), number_to_name(Test_Num, Name), log_writef( 'Got %q', [Test_Num ]), log_writef('\n'), log_writef('\n'), Num  = Test_Num.

test_name_fail(Name) :-
	log_writef( 'Testing name %s : ', [Name]),
	(\+ number_to_name(_, Name) -> log_writef('not found - ok'), log_writef('\n');
		log_writef('found - fail'), log_writef('\n'), fail), log_writef('\n').
test_num_fail(Num) :-
	log_writef( 'Testing number %q : ', [Num]),
	(\+ number_to_name(Num, _) -> log_writef('not found - ok'), log_writef('\n');
		log_writef('found - fail'), log_writef('\n'), fail), log_writef('\n').

test_both_ways_test([0], "zero").
test_both_ways_test(['-',0], "negative zero"). % signed zero

test_both_ways_test([1,0], "ten").
test_both_ways_test([-,1,0], "negative ten").
test_both_ways_test([1,4], "fourteen").
test_both_ways_test([-,1,4], "negative fourteen").

test_both_ways_test([2,0], "twenty").
test_both_ways_test([-,2,0], "negative twenty").
test_both_ways_test([2,1], "twenty-one").
test_both_ways_test([-,2,1], "negative twenty-one").

test_both_ways_test([3,2], "thirty-two").
test_both_ways_test([-,3,2], "negative thirty-two").
test_both_ways_test([3,5], "thirty-five").
test_both_ways_test([-,3,5], "negative thirty-five").

test_both_ways_test([1, 3,5], "one hundred and thirty-five").
test_both_ways_test([-,1, 3,5], "negative one hundred and thirty-five").
test_both_ways_test([1,0,0], "one hundred").
test_both_ways_test([-,1,0,0], "negative one hundred").
test_both_ways_test([2,0,0], "two hundred").
test_both_ways_test([-,2,0,0], "negative two hundred").
test_both_ways_test([2,0,1], "two hundred and one").
test_both_ways_test([-,2,0,1], "negative two hundred and one").
test_both_ways_test([2,2,0], "two hundred and twenty").
test_both_ways_test([-,2,2,0], "negative two hundred and twenty").
test_both_ways_test([2,2,5], "two hundred and twenty-five").
test_both_ways_test([-,2,2,5], "negative two hundred and twenty-five").
test_both_ways_test([3,1,0], "three hundred and ten").
test_both_ways_test([-,3,1,0], "negative three hundred and ten").
test_both_ways_test([9,9,9], "nine hundred and ninety-nine").
test_both_ways_test([-,9,9,9], "negative nine hundred and ninety-nine").

test_both_ways_test([1,0,0,0], "one thousand").
test_both_ways_test([-,1,0,0,0], "negative one thousand").
test_both_ways_test([1,0,0,2], "one thousand two").
test_both_ways_test([-,1,0,0,2], "negative one thousand two").
test_both_ways_test([1,0,2,2], "one thousand twenty-two").
test_both_ways_test([-,1,0,2,2], "negative one thousand twenty-two").
test_both_ways_test([1,9,9,9], "one thousand nine hundred and ninety-nine").
test_both_ways_test([-,1,9,9,9], "negative one thousand nine hundred and ninety-nine").
test_both_ways_test([1,0,9,9,9], "ten thousand nine hundred and ninety-nine").
test_both_ways_test([-,1,0,9,9,9], "negative ten thousand nine hundred and ninety-nine").
test_both_ways_test([1,0,0,0,0,0,0], "one million").
test_both_ways_test([-,1,0,0,0,0,0,0], "negative one million").
test_both_ways_test([2,0,0,0,0,0,0], "two million").
test_both_ways_test([-,2,0,0,0,0,0,0], "negative two million").
test_both_ways_test([2,0,0,0,9,0,0], "two million nine hundred").
test_both_ways_test([2,0,0,0,0,9,0], "two million ninety").
test_both_ways_test([2,0,0,0,0,0,9], "two million nine").
test_both_ways_test([1,0,2,0,0,0,0,0,0], "one hundred and two million").
test_both_ways_test([-,1,0,2,0,0,0,0,0,0], "negative one hundred and two million").
test_both_ways_test([1,0,2,0,0,0,0,0,9], "one hundred and two million nine").
test_both_ways_test([2,0,0,1,0,0,0,1,0,9], "two billion one million one hundred and nine").
test_both_ways_test([2,0,0,1,1,0,0,1,0,9], "two billion one million one hundred thousand one hundred and nine").
test_both_ways_test([2,0,0,1,1,2,0,1,0,9], "two billion one million one hundred and twenty thousand one hundred and nine").
test_both_ways_test([2,0,0,1,1,2,3,1,0,9], "two billion one million one hundred and twenty-three thousand one hundred and nine").
test_both_ways_test([2,0,0,0,0,0,1,0,0,0,1,0,9], "two trillion one million one hundred and nine").

test_both_ways_test([1,0, 0,0,0, 0,0,0, 0,0,0,
0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0], "ten duotrigintillion"). % googol

test(test_both_ways, [nondet, forall( test_both_ways_test(Num, Name))]) :-
	test_both_ways(Num, Name).

%test(test_both_ways, [nondet, forall( test_both_ways_test_f(Num, Name))]) :-
	%\+ test_both_ways(Num, Name).

%test(test_to_name, [nondet, forall( test_to_name_test(Num, Name) )]) :-
	%%number_to_name(Num, Test_Name), Test_Name = Name.
	%number_to_name(Num, Test_Name), ( Test_Name = Name -> true; write(Test_Name), nl, writef('%s', [Test_Name]), nl, fail).

test_name_fail_test("zero hundred").
test_name_fail_test("zero thousand").
test_name_fail_test("zero million").
test_name_fail_test("one million "). % extra space
test_name_fail_test("zero million zero thousand").
test_name_fail_test("zero million zero thousand zero").
test_name_fail_test("zero million one thousand").
test_name_fail_test("one million zero thousand zero").
test_name_fail_test("one million zero thousand one").
test(test_name_fail, [nondet, forall( test_name_fail_test(Name) )]) :-
	test_name_fail(Name).

test_num_fail_test([1,-,0]).
test_num_fail_test([-,-,0]).
test_num_fail_test([-,-,-]).
test_num_fail_test([0,0,0]).
test_num_fail_test([0,0,0,0]).
test_num_fail_test([-,-,-,-]).
test(test_num_fail, [nondet, forall( test_num_fail_test(Num) )]) :-
	test_num_fail(Num).

:- end_tests(numberals).

% vim:ft=prolog:fdm=marker

:- begin_tests(numberals).
:- consult('numberals.pl').

logging :- fail.

log_writef(A, B) :- logging -> writef(A, B); true.
log_writef(A) :- log_writef(A, []).

test_both_ways(Num, Name) :-
	ground([Num, Name]),
	log_writef( '%q -> %s : ', [Num,  Name] ), number_to_name(Num, Test_Name), log_writef( 'Got %s', [Test_Name]), log_writef('\n'), Name = Test_Name,
	log_writef( '%s -> %q : ', [Name,  Num] ), number_to_name(Test_Num, Name), log_writef( 'Got %q', [Test_Num ]), log_writef('\n'), log_writef('\n'), Num  = Test_Num.

test_name_fail(Name) :-
	log_writef( 'Testing name %s : ', [Name]),
	(\+ number_to_name(_, Name) -> log_writef('not found - ok'), log_writef('\n');
		log_writef('found - fail'), log_writef('\n'), fail), log_writef('\n').
test_num_fail(Num) :-
	log_writef( 'Testing number %q : ', [Num]),
	(\+ number_to_name(Num, _) -> log_writef('not found - ok'), log_writef('\n');
		log_writef('found - fail'), log_writef('\n'), fail), log_writef('\n').

test_both_ways_test([0], "zero").
test_both_ways_test(['-',0], "negative zero"). % signed zero

test_both_ways_test([1,0], "ten").
test_both_ways_test([-,1,0], "negative ten").
test_both_ways_test([1,4], "fourteen").
test_both_ways_test([-,1,4], "negative fourteen").

test_both_ways_test([2,0], "twenty").
test_both_ways_test([-,2,0], "negative twenty").
test_both_ways_test([2,1], "twenty-one").
test_both_ways_test([-,2,1], "negative twenty-one").

test_both_ways_test([3,2], "thirty-two").
test_both_ways_test([-,3,2], "negative thirty-two").
test_both_ways_test([3,5], "thirty-five").
test_both_ways_test([-,3,5], "negative thirty-five").

test_both_ways_test([1, 3,5], "one hundred and thirty-five").
test_both_ways_test([-,1, 3,5], "negative one hundred and thirty-five").
test_both_ways_test([1,0,0], "one hundred").
test_both_ways_test([-,1,0,0], "negative one hundred").
test_both_ways_test([2,0,0], "two hundred").
test_both_ways_test([-,2,0,0], "negative two hundred").
test_both_ways_test([2,0,1], "two hundred and one").
test_both_ways_test([-,2,0,1], "negative two hundred and one").
test_both_ways_test([2,2,0], "two hundred and twenty").
test_both_ways_test([-,2,2,0], "negative two hundred and twenty").
test_both_ways_test([2,2,5], "two hundred and twenty-five").
test_both_ways_test([-,2,2,5], "negative two hundred and twenty-five").
test_both_ways_test([3,1,0], "three hundred and ten").
test_both_ways_test([-,3,1,0], "negative three hundred and ten").
test_both_ways_test([9,9,9], "nine hundred and ninety-nine").
test_both_ways_test([-,9,9,9], "negative nine hundred and ninety-nine").

test_both_ways_test([1,0,0,0], "one thousand").
test_both_ways_test([-,1,0,0,0], "negative one thousand").
test_both_ways_test([1,0,0,2], "one thousand two").
test_both_ways_test([-,1,0,0,2], "negative one thousand two").
test_both_ways_test([1,0,2,2], "one thousand twenty-two").
test_both_ways_test([-,1,0,2,2], "negative one thousand twenty-two").
test_both_ways_test([1,9,9,9], "one thousand nine hundred and ninety-nine").
test_both_ways_test([-,1,9,9,9], "negative one thousand nine hundred and ninety-nine").
test_both_ways_test([1,0,9,9,9], "ten thousand nine hundred and ninety-nine").
test_both_ways_test([-,1,0,9,9,9], "negative ten thousand nine hundred and ninety-nine").
test_both_ways_test([1,0,0,0,0,0,0], "one million").
test_both_ways_test([-,1,0,0,0,0,0,0], "negative one million").
test_both_ways_test([2,0,0,0,0,0,0], "two million").
test_both_ways_test([-,2,0,0,0,0,0,0], "negative two million").
test_both_ways_test([2,0,0,0,9,0,0], "two million nine hundred").
test_both_ways_test([2,0,0,0,0,9,0], "two million ninety").
test_both_ways_test([2,0,0,0,0,0,9], "two million nine").
test_both_ways_test([1,0,2,0,0,0,0,0,0], "one hundred and two million").
test_both_ways_test([-,1,0,2,0,0,0,0,0,0], "negative one hundred and two million").
test_both_ways_test([1,0,2,0,0,0,0,0,9], "one hundred and two million nine").
test_both_ways_test([2,0,0,1,0,0,0,1,0,9], "two billion one million one hundred and nine").
test_both_ways_test([2,0,0,1,1,0,0,1,0,9], "two billion one million one hundred thousand one hundred and nine").
test_both_ways_test([2,0,0,1,1,2,0,1,0,9], "two billion one million one hundred and twenty thousand one hundred and nine").
test_both_ways_test([2,0,0,1,1,2,3,1,0,9], "two billion one million one hundred and twenty-three thousand one hundred and nine").
test_both_ways_test([2,0,0,0,0,0,1,0,0,0,1,0,9], "two trillion one million one hundred and nine").

test_both_ways_test([2,0,0,0,0,0,1,0,0,0,1,0,9], "two trillion one million one hundred and nine").
test_both_ways_test([1,0, 0,0,0, 0,0,0, 0,0,0,
0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0,
0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0], "ten duotrigintillion"). % googol

test(test_both_ways, [nondet, forall( test_both_ways_test(Num, Name))]) :-
	test_both_ways(Num, Name).

%test(test_both_ways, [nondet, forall( test_both_ways_test_f(Num, Name))]) :-
	%\+ test_both_ways(Num, Name).

%test(test_to_name, [nondet, forall( test_to_name_test(Num, Name) )]) :-
	%%number_to_name(Num, Test_Name), Test_Name = Name.
	%number_to_name(Num, Test_Name), ( Test_Name = Name -> true; write(Test_Name), nl, writef('%s', [Test_Name]), nl, fail).

test_name_fail_test("zero hundred").
test_name_fail_test("zero thousand").
test_name_fail_test("zero million").
test_name_fail_test("one million "). % extra space
test_name_fail_test("zero million zero thousand").
test_name_fail_test("zero million zero thousand zero").
test_name_fail_test("zero million one thousand").
test_name_fail_test("one million zero thousand zero").
test_name_fail_test("one million zero thousand one").
test(test_name_fail, [nondet, forall( test_name_fail_test(Name) )]) :-
	test_name_fail(Name).

test_num_fail_test([1,-,0]).
test_num_fail_test([-,-,0]).
test_num_fail_test([-,-,-]).
test_num_fail_test([0,0,0]).
test_num_fail_test([0,0,0,0]).
test_num_fail_test([-,-,-,-]).
test(test_num_fail, [nondet, forall( test_num_fail_test(Num) )]) :-
	test_num_fail(Num).

:- end_tests(numberals).

% vim:ft=prolog:fdm=marker


line on week graph

line on week graph

#!/usr/bin/env gnuplot

# graph of CPU temperature

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql4gnuplot/sql11h.csv"
ifnamed = "/tmp/lnxdiagd/mysql4gnuplot/sql11d.csv"
ifnamew = "/tmp/lnxdiagd/mysql4gnuplot/sql11w.csv"
set output "/tmp/lnxdiagd/site/img/day11.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 2 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 3 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 3 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1

set multiplot layout 1, 3 title "CPU Temperature ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):3 title " Temperature [degC]" with lines lw 0.1 fc rgb "#ccbb0000"

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):2 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot

#!/usr/bin/env gnuplot

# graph of CPU temperature

# datafiles
ifnameh = "/tmp/lnxdiagd/mysql4gnuplot/sql11h.csv"
ifnamed = "/tmp/lnxdiagd/mysql4gnuplot/sql11d.csv"
ifnamew = "/tmp/lnxdiagd/mysql4gnuplot/sql11w.csv"
set output "/tmp/lnxdiagd/site/img/day11.png"

# ******************************************************* General settings *****
set terminal png enhanced font "Vera,9" size 1280,320
set datafile separator ';'
set datafile missing "NaN"    # Ignore missing values
set grid
tz_offset = utc_offset / 3600 # GNUplot only works with UTC. Need to compensate
                              # for timezone ourselves.
if (GPVAL_VERSION == 4.6) {epoch_compensate = 946684800} else {if (GPVAL_VERSION == 5.0) {epoch_compensate = 0}}
# Positions of split between graphs
LMARG = 0.06
LMPOS = 0.40
MRPOS = 0.73
RMARG = 0.94

min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y

# ********************************************************* Statistics (R) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnameh using 1 name "X" nooutput

Xh_min = X_min + utc_offset - epoch_compensate
Xh_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnameh using 2 name "Yh" nooutput

# ********************************************************* Statistics (M) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamed using 1 name "X" nooutput

Xd_min = X_min + utc_offset - epoch_compensate
Xd_max = X_max + utc_offset - epoch_compensate

# stats to be calculated here for Y-axes
stats ifnamed using 3 name "Yd" nooutput

# ********************************************************* Statistics (L) *****
# stats to be calculated here of column 2 (UX-epoch)
stats ifnamew using 1 name "X" nooutput
Xw_min = X_min + utc_offset - epoch_compensate
Xw_max = X_max + utc_offset - epoch_compensate

# stats for Y-axis
stats ifnamew using 3 name "Yw" nooutput

Ymax = max(max(Yd_max, Yh_max), Yw_max) +1
Ymin = min(min(Yd_min, Yh_min), Yw_min) -1

set multiplot layout 1, 3 title "CPU Temperature ".strftime("( %Y-%m-%dT%H:%M:%S )", time(0)+utc_offset)

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                       LEFT PLOT: past week
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past week"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%a %d"            # Display time in 24 hour notation on the X axis
set xrange [ Xw_min : Xw_max ]

# ***************************************************************** Y-axis *****
set ylabel "Temperature [degC]"
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
set key inside top left horizontal box
set key samplen 1
set key reverse Left

# ***************************************************************** Output *****
# set arrow from graph 0,graph 0 to graph 0,graph 1 nohead lc rgb "red" front
# set arrow from graph 1,graph 0 to graph 1,graph 1 nohead lc rgb "green" front
#set object 1 rect from screen 0,0 to screen 1,1 behind
#set object 1 rect fc rgb "#eeeeee" fillstyle solid 1.0 noborder
#set object 2 rect from graph 0,0 to graph 1,1 behind
#set object 2 rect fc rgb "#ffffff" fillstyle solid 1.0 noborder

set lmargin at screen LMARG
set rmargin at screen LMPOS

# ***** PLOT *****
plot ifnamew \
      using ($1+utc_offset):3 title " Temperature [degC]" with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                     MIDDLE PLOT:  past day
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past day"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xd_min : Xd_max ]

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen LMPOS+0.001
set rmargin at screen MRPOS

# ***** PLOT *****
plot ifnamed \
      using ($1+utc_offset):3 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                      RIGHT PLOT: past hour
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# ***************************************************************** X-axis *****
set xlabel "past hour"       # X-axis label
set xdata time               # Data on X-axis should be interpreted as time
set timefmt "%s"             # Time in log-file is given in Unix format
set format x "%R"            # Display time in 24 hour notation on the X axis
set xrange [ Xh_min : Xh_max ]
set xtics textcolor rgb "red"

# ***************************************************************** Y-axis *****
set ylabel " "
set ytics format " "
set yrange [ Ymin : Ymax ]

# ***************************************************************** Legend *****
unset key

# ***************************************************************** Output *****
set lmargin at screen MRPOS+0.001
set rmargin at screen RMARG

# ***** PLOT *****
plot ifnameh \
      using ($1+utc_offset):2 with points pt 5 ps 0.2 fc rgb "#ccbb0000" \

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#                                                                 FINALIZING
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

unset multiplot