|
|
| There's more than one way to do things | |
| PerlMonks |
Re^4: Halogen: A Tool For Monitoring IBM pSeries LPAR and Hypervisor Metricsby bpoag (Monk) |
| on Jan 08, 2014 at 17:21 UTC ( [id://1069839]=note: print w/replies, xml ) | Need Help?? |
|
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:
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. Cheers, Bowie
In Section
Cool Uses for Perl
|
|
||||||||||||||||||||||||||||||