0

I'm duplicating an existing working MRTG setup. I set up the source machine a few years ago. Source and target are both CentOS 6.10, running MRTG 2.16.2.

Copying the commands run on the source machine which are stored in their files:

/usr/bin/cfgmaker --no-down --subdirs=HOSTNAME -o dell-x1018p.cfg -ifref=name -ifdesc=alias --global "WorkDir: /var/www/mrtg/" --global "RunAsDaemon: no" --global "Options[_]: pngdate" --global "EnableIPv6: no" public@dell-x1018p

/usr/bin/indexmaker --output /var/www/mrtg/dell-x1018p.html --title Dell-X1018p --columns 1 --width 800 --height 160 --show day /etc/mrtg/dell-x1018p.cfg

This generates very pretty 800 pixel wide graphs. Properly scaled graph

When I use the same syntax on the target machine:

/usr/bin/cfgmaker --no-down --subdirs=HOSTNAME -o dell-x1018.cfg -ifref=name -ifdesc=alias --global "WorkDir: /var/www/mrtg/" --global "RunAsDaemon: no" --global "Options[_]: pngdate" --global "EnableIPv6: no" public@dell-x1018

/usr/bin/indexmaker --output /var/www/mrtg/dell-x1018.html --title "Dell X1018 (downstairs switch)" --columns 1 --width 800 --height 160 --show day /etc/mrtg/dell-x1018.cfg

This generates really ugly 500 pixel wide graphs that are scaled up to 800x160

rescaled graph

I must have done something else when I set up the source machine years ago, but looking at the files I see no difference. What am I missing?

Mike Pepe
  • 3
  • 2
  • Are you using MRTG with RRDTool, and if so, which version of the RRDTool libraries do you have installed? This is probably the cause of the difference. – Steve Shipway Jun 17 '20 at 22:33
  • Also - how are you generating the graphs - periodic calls to MRTG, or via a frontend like Routers2 or 14all? What is your cronjob that updates the data and potentially creates the graphs (if using native mode) -- does this include any additional global configurations, or use a 'master.cfg' that includes the others? – Steve Shipway Jun 17 '20 at 22:37
  • I don't appear to have rrdtool installed anywhere on either machine. The cron job is a simple thing that runs every 5 minutes: */5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok --logging /var/log/mrtg.log I am using a master config which has some innocuous global settings but each device has its own config file called with a #include in the main config. – Mike Pepe Jun 19 '20 at 01:00

1 Answers1

0

It looks like you're running MRTG in Native mode (IE no RRDTool).

You should add global settings like:

XSize[_]: 800
Ysize[_]: 100

to the start of your master CFG file (before the 'Include' lines). This will set the default graph size to 800x100 rather than the smaller default (note that this is the size of the graph, not the image, which includes a legend space as well).

You should consider installing RRDTool with LogFormat: RRD and using a graph-on-demand frontend instead like Routers2 as this gives more features and a smaller load on your system.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • Thanks, this solved the problem. One note: 600 is the maximum size allowed- the X and Y size refer to the size of the graph, not the overall size of the image. Why I got confused is that I was comparing like-to-like graphs. I didn't notice that the very old legacy configs had XSize/YSize defined and thus were setting it globally. I added X and Y size to the main config, removed all references to them elsewhere and regenerated the HTML indices without the --width/--height parameters and now things look like they're supposed to everywhere. Thanks! – Mike Pepe Jun 20 '20 at 23:56