Skip to content

Instantly share code, notes, and snippets.

@stemid
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stemid/8187d7516e719464d3b0 to your computer and use it in GitHub Desktop.
Save stemid/8187d7516e719464d3b0 to your computer and use it in GitHub Desktop.
Gnuplot script to plot TIMING-SA values from amavis maillogs
#!/usr/bin/env gnuplot
# Extract the values into a csv, I tend to save only hour:minutes:seconds and the milliseconds using awk
# Example: grep TIMING-SA /var/log/maillog | awk '{printf "%s,%s\n", $3, $11}'
#
# Then set the csv filename in envrionment before running script.
# export GNUPLOT_NAME=sa_timing.csv
# ./gnuplot.gnu
reset
name=system("echo $GNUPLOT_NAME")
set xdata time
set timefmt '%H:%M:%S'
set format x '%H:%M'
set datafile separator ','
#set terminal wxt size 410,250 enhanced font 'Verdana,9' persist
set terminal png size 2400,250 enhanced font 'Verdana,9'
#set terminal png
#set terminal svg size 410,250 fname 'Verdana, Helvetica, Arial, sans-serif' fsize '9' rounded dashed
set output name.'.png'
set style line 11 lc rgb '#808080' lt 1
set border 3 back ls 11
set tics nomirror
set style line 12 lc rgb '#808080' lt 0 lw 1
set grid back ls 12
# color definitions
set style line 1 lc rgb '#8b1a0e' pt 1 ps 1 lt 1 lw 2 # --- red
set style line 2 lc rgb '#5e9c36' pt 6 ps 1 lt 1 lw 2 # --- green
set key bottom right
#set xrange [1:1]
set yrange [0:1000]
set style data linespoints
set xlabel "tid"
set ylabel "sekunder"
set title 'SA timing: '.name
plot name using 1:($2/1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment