Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^3: Halogen: A Tool For Monitoring IBM pSeries LPAR and Hypervisor Metrics

by dmitri (Curate)
on Jan 08, 2014 at 03:17 UTC ( #1069718=note: print w/ replies, xml ) Need Help??

Comment on Re^3: Halogen: A Tool For Monitoring IBM pSeries LPAR and Hypervisor Metrics
Replies are listed 'Best First'.
Re^4: Halogen: A Tool For Monitoring IBM pSeries LPAR and Hypervisor Metrics
by bpoag (Monk) on Jan 08, 2014 at 17:21 UTC
    Ok.. I'll recap.

    All the graphs are generated in the script via simple calls to a gnuplot binary. No Perl modules used at all. We've been using gnuplot for a long time where I work, so, we've managed to both find good ways of wrangling it, and find ways of making it pretty. It's a clever little bit of code.. Have a look:

    open (GNUPLOT, "|gnuplot 2>/dev/null 1>/dev/null"); print GNUPLOT <<EOF; set term png transparent size 1000,220 x000000 xaaaaaa x202020 x90 +9090 x88ff88 xffffff xfffffe x000000 x505050 set title "Halogen: Number of pSeries Systems Exceeding CPU Panic +Threshold \(Starting: $rangeStart Ending: $rangeEnd\)" textcolor lt 2 set output "/var/www/html/spectrum/halogen-spectrum.png" set mxtics 2 set xtics 300 set grid unset key set xdata time set timefmt "%Y-%m-%d %H:%M:%S" set format x "%H:%M" set yrange ["$yNeg" : "$yPos"] set xrange ["$rangeStart" : "$rangeEnd"] set pointsize 0.9 set multiplot plot "/var/www/html/halogen/data.txt" using 1:3 w linespoints lt 6 + pt 7, "/var/www/html/halogen/data.txt" using 1:3 smooth bezier w lin +es lw 1 lt 2 EOF close (GNUPLOT);

    In Perl, we're basically opening a pipe to the gnuplot command and funneling it the native command syntax it understands...The print call will continue until an EOF is received. When it hits EOF, the print call closes, we close the pipe, the binary kicks off, and whammo, you've got a graph sitting in a filesystem ready to go.

    We've even managed to get our graphs to look fairly anti-aliased, something which stock gnuplot doesn't support (without being compiled against libgd/cairo libraries, at least)...All you do is just generate the graph at a resolution higher than you expect to see it on a webpage..and make sure the img tag used for the graph is hard-coded with a specific width or height smaller than the physical resolution of the image, and the browser handles the task of doing a quick cubic downscaling of the image. Looks much better that way.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1069718]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2016-02-07 02:47 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (241 votes), past polls