The graphing script is in Listing 2, 2396l2.orig. A breakdown of the major parts of this script follows: Line 12: trap command to remove working files if the user hits break Lines 18 - 23: A function that will check if a file exists and has a file size greater than zero Lines 35 - 52: Some variable definitions and help/usage information Lines 60 - 90: Parsing the options, set switches or display information as requested. I find it helpful to include options for help (-h or -H), RCS log information (-L) and version number (-V) and debugging (-D); so I use a standard template for most of my scripts with these basic options, then add appropriate options for the job at hand. For this script the additional options are: print without display (-P), display the chart with ghostview, then offer the option of printing or not (-p). Lines 92: Change the current directory to the one where the data files are collected. Lines 93 - 105: Check for a passed file name; if no file name was passed default to constructing the name for today's data file. Lines 106 - 117: Validate the file name, making sure that the file exists, is readable and is non-zero in length. Lines 121 - 161: Run the data file through an in-stream awk script, converting the timestamp to hours and hundredths so that the plot will have the data distributed evenly across the scale for each hour. If we left the minutes scaled to 60, the data points would be clustered within the first .6 of the hour. @bb: If we find a value for user time that is lower than the prior observation, it is either a reboot or the counter rolled over. Since it is usually a reboot, I adjust the saved values to zero to reflect the counter reset and set the reboot data point to 100 to generate a reboot indication on the chart. On normal observations the reboot data point is set to -1, so the plotted point will fall outside of the chart and not appear. @bb: Calculate the gain for each counter and divide by the number of seconds since the last records and write the values out to a temporary file with the converted timestamp. Save the value of each variable for use with the next record. Line 164: Get the name of the host. I'm assuming that this is the machine that the data was generated on. This also assumes that the data being charted is for the machine it is being charted on. If I were to go with a central data collection and analysis system, I would embed the originating host name in the file name. Line 165: Clip the date out of the file name of the input for use in chart titles. Lines 166: Display a progress message, showing the system and date. Lines 170 - 179: Define the gnuplot script line that sets the output device. If the user requested hardcopy, set the "set terminal" and "set output" for PostScript output; otherwise, set the terminal as X11 for display in an X11 window. We also "set label" for the Y axis for hardcopy and leave it null for X11, as it gets displayed incorrectly on the display. The X11 display gets a pause of ten seconds to allow some time to view the chart. Without the pause the graphic display is cleared too quickly to be seen. Line 183: Start echoing the in-stream script as stdin to the gnuplot program to generate the chart. Line 184: Set the previously defined "set terminal" command. Lines 185 - 187: Turn on plotting with lines, turn off the grid overlay, and turn on the key legend display for labeling the lines. Line 188: Set the chart title, using the system name and the date from the input file name. Lines 189 - 191: Set up the X-axis variables: label, range of values and range of tic marks.The x scale is used for the time of day and is labeled as such, from 0 to 24 with tic marks for every hour. Lines 192 - 194: Set up the Y-axis variables: label, range of values and range of tic marks.The Y scale is for the percentages and as such runs from 0 to 100, but to allow room for the legends in the upper right corner the scale is set to 0 to 140, with tic marks every 10 points from 0 to 100. Lines 195 - 200: Define the plots, input file, columns to use, title for the legend and plot type. The reboot plot is done with points rather than a line, as it refers to events rather than trends (we hope). Lines 201 - 202: Pause, if appropriate, and quit. Line 203: The EOF marks the end of the input stream. Lines 204 -217: If hardcopy and no display before printing is requested, go right to lpr. If a display before printing is requested, send the PostScript file to Ghostview, then prompt for whether to print or not. Clean up the PostScript file when done. Line 218 - 221: I have found that I want to look at the work files when I'm debugging, so If I set the debug switch (-D), keep the data file; otherwise, trash it. @b:The other scripts work on the same basic pattern with some additional twists for the scripts for disks and interrupts, as I try not to generate graphs for non-existent disks or unused interrupts. I've pulled the descriptive text for the used interrupts out of the /proc/interrupts file to add a little more detail to the charts.