Menu

command line png limits width

Help
Greg Rahn
2012-07-18
2013-04-29
  • Greg Rahn

    Greg Rahn - 2012-07-18

    Can you explain this bit of code in colplotlib.ph?  I don't understand why it resets the width back to 1 (* 700 px)  if one is not using the -email flag.  I dont see why png file generation should be limited to 700px wide.

    if ($pparams->{email} ne '' && $pparams->{width}>1)
      {
        displayText($mycfg, "Warning: Plot width reset to 1 to fit page", 3);
        $pparams->{width}=1;
      }
    
     
  • Mark Seger

    Mark Seger - 2012-07-18

    wow - I haven't looked at that code in 10 years, give or take.

    Can I assume you've tried setting email address to an address or local directory?  When you do this the default behavior is to write the plots out as PDFs and as I recall, the pdf geometry is based on an 8-1/2 X 11 sheet, with a width of 1 being the max that will fit on a page.  It then attaches the pdt to your email OR writes it to the spefied directory.  So, if you make the width > 1, it won't render correctly, at least that's what used to happen.

    Since your earlier note talked about png files perhaps I'm incorrectly doing this if you're trying to render pngs, but my only excuse is I've only built pngs to insert into a word document and so it always seemed reasonable at the time and it saved me the trouble of rendering plots that wouldn't fit.

    At the very least you could always comment it out and see what happens when  you use sizes > 1.

    As an aside, if you're interested in playing with different formats I've been experimenting with an api you might find interesting.  The main idea is you tell colplot to call a mini-script at a few places in the code that change some of the gnuplot settings resulting in denser plots.  You  need to be able to write perl and understand how to use gnuplot but it sounds like that's not a deal breaker for you  ;)

    If you look in /usr/share/collectl you'll see tiny.ph which renders tiny plots and you can fit on the order of 500 or so in a single window, depending on your monitor resolution.  oneperpage.ph renders pdf files with all the plots for a single server on one page.  The more plots the shorter their height.  The 'trick' with any of these or those you might want to write yourself, which I haven't documented yet because I'm still experimenting, is to just put the name of the file in the subject field.  Works for both the web-page and cli.

    -mark

     
  • Greg Rahn

    Greg Rahn - 2012-07-18

    For my use case, I want png output so my command line is something like:

    colplot -dir . -time 17:47:48-17:52:27 -plots cpu,disk,net -filetype png -width 1.2 -height 0.5 -thick 2 -filedir plots
    

    If I comment out the code that resets it to 1, it does result in the right line in the gnuplot ctl file.  e.g.:

    set terminal png   size 1.2*700,0.5*500
    

    I'll take a look at the examples mentioned in my quest to build a static webpage that mimics the CGI page.

     
  • Mark Seger

    Mark Seger - 2012-07-19

    Sounds like a good/useful thing to do.  If I can offer any assistance be sure to ask.  As an aside, I have put a lot of effort into the diagnostic/development side of colplot, if you haven't yet noticed, which you enable with -debug and a mask.  The mask selects different things for colplot to do or show.  You can also add ?debug=mask to the url itself but keep in mind one you start printing extra things in the browser  you can no longer see the plots - remember I said they're streams to the browser and it screws up things depending when in the processing the print statements are being executed.

    One such value you might find useful is 4, which tells colplot to NOT delete the gnuplot ctl files in /tmp after generating plots.  Having a look at one of those might provide some insight.  You can also manually edit/run gnuplot with one of those to experiment with different settings.

    One other thing that may also not be obvious.  While colplot lives in /usr/bin, colplot.conf lives in /etc and the colplotlib stuff live in /usr/share/collectl, you can copy them all to a different location for testing/hacking since by design colplot always looks for everything in the directory it's being run out of.

    good luck…

    -mark

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.