MRTG with RRDtool and Routers2 – Installation from Scratch

I always wanted to monitor my private network with an open source tool. Since I knew some nice statistics, e.g. from the DE-CIX (printed with RRDtool) or from the Uni-Gießen (generated with MRTG), I had the idea of installing such a system by myself. Luckily I found a book from Steve Shipway, called “Using MRTG with RRDtool and Routers2“, which actually disappointed me because it did not offer a complete installation guide but mainly further information about fine-tuning the appropriate tools.

Therefore, I want to show a complete step-by-step installation of all the needed tools in order to monitor a network with MRTG, RRDtool and Routers2.  “From scratch” means that there are no prerequisite to this installation guide except a plain Linux server (in my case a Ubuntu Linux) such as presented here. Okay, let’s go:

Preparation

In order to use all features that I explain in the next sections, the following tools must be installed on the system. Of course, all these packages can be installed step-by-step, but I think it is easier to install them at once. Here is the list:

The installation requires round about 60 packages. Attention: The installation process from MRTG asks a single question, whether or not the root user should be the only one who can read the default configuration file from MRTG (/etc/mrtg.cfg). In our scenario, this can be answered with “Yes”, which is also the default option in this question.

Webserver: Apache

We just installed the apache web server. ;) It is already running in the background and can be tested with a browser that accesses the IP address/domain name of the server. If you see the standard “It works!” page you are right. (The following paragraph is only for further investigations on it.)

  • You can see whether the apache server is running via ps -A | grep apache which should show a few apache2 processes. Furthermore, the command netstat -l should show at least one tcp process that LISTENs on port 80 (http). If you have IPv6 enabled, another tcp6 process also LISTENs on port 80.
  • The configuration can be edited with sudo nano /etc/apache2/apache2.conf (since I am using Ubuntu. Other Linux distributions are using httpd.conf).
  • If you get an error message in your logs similar to this: “apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName”, you can add a line in the apache2.conf file which starts with ServerName, e.g., “ServerName mrtg.example.com”.
  • We also already installed the CGI support. In the following file an alias specifies in which directory the CGI scripts must be stored:  cat /etc/apache2/sites-available/default. It is under “/usr/lib/cgi-bin/”.

MRTG and RRDtool

There is not much to say about the blank MRTG installation on a Ubuntu server since it already comes with a pre-configured configuration file (/etc/mrtg.cfg) and also an installed cron job which runs MRTG every five minutes. You can verify that there is a cron job installed as you should have a file called “mrtg” in the “/etc/cron.d/” directory. You can display it via cat /etc/cron.d/mrtg. If you look at your syslog messages with tail /var/log/syslog you should see a few lines similar to the following:

Similarly, the MRTG log is under /var/log/mrtg/mrtg.log .

We must create some folders in order to store our configuration and rrd files. I decided to store the configs under the /etc folder while the rrd files under the /var folder:

Note that RRDtool itself needs no further configuration since it is always used from Routers2 directly and thus needs no specific configuration.

Routers2.cgi

At first, the routers2.cgi package must be downloaded from here. Extract it, cd into the folder and start the installation:

During the installation, several questions are asked and can be answered as follows. (Note that these are only my suggestions! Answer the questions to your needs. The following text only shows the relevant lines):

After this installation process, the configuration file for routers2.cgi can be modified with sudo nano /var/mrtg/routers2.conf. I suggest the following changes in the file: (Refer to the excellent notes in the file itself to fully understand all these settings.)

Modifying the Default mrtg.cfg

Open the file with sudo nano /etc/mrtg.cfg and delete (or #comment) ALL lines. Then add the following lines which are needed for the following reasons:

First Test (Yet Without Any Devices)

With a web browser, access the following page/file: http://<ip-address>/cgi-bin/routers2.cgi.
Since there are no monitored devices (called “targets”) yet, this blank page should look like this:
routers2.cgi_FirstTest

If so, you are almost done with the base installation of MRTG, RRDtool and Routers2!!! Congratulations! ;)
You can also view the configuration verification of Routers2 when you access the following URL (of course without any targets, too): http://<ip-address>/cgi-bin/routers2.cgi?page=verify.

Forwarding to Routers2.cgi

It is desirable to have a forwarding to the routers2.cgi if only the IP address or domain name of the server is entered. That is, even though only http://domain.name is entered in the browser, the routers2.cgi page should appear. This can be done by adding a few lines to the index.html under /var/www/index.html : Between the  <html>  and the  <body>  tag, the following lines should be inserted, of course with the correct domain name:

From now on, the web page automatically redirects to the routers2.cgi page after a few milliseconds.

Adding Devices/Targets

Since we now have a complete MRTG with RRDtool and Routers2 installation, we can add several devices to monitor, e.g., network routers and switches, firewalls, servers, and/or even other interesting values to monitor, such as ping-times to a remote server, temperature values, firewall statistics, etc. I will explain the adding procedure for various targets into MRTG in later posts. However, here comes a rough overview:

Querying SNMP values

The first step is always to activate SNMP on the appropriate device. I recommend to use different community strings (i.e., passwords) for every single device! After that, the querying of SNMP can be tested from the Linux server with the tools from snmp, e.g., snmpwalk. Here is an example with the first few lines from requesting a Juniper SSG firewall:

For gathering information about the MIBs that the device supports, the brilliant MIB Browser from iReasoning can be used. It is free for personal use an can be downloaded here. It uses a GUI, can load several MIBs and is able to request the whole SNMP tree via “Get Subtree”. Really good! Here is a screenshot with the output of the NetscreenVpnMonitor MIB:

iReasoning MIB Browser

With these information, precise SNMP OIDs can be queried with MRTG, etc.

Building the MRTG/Routers2 Configuration

Finally, the *.cfg files for MRTG/Routers2 must be created. The tool cfgmaker which ships directly with MRTG can be used for the basic gathering of interfaces of routers and switches, such as:

Note that you can use host templates and interface templates with cfgmaker. [Comment by Steve added here:] “These are scripts that add additional Targets either on a per-device or per-interface basis. For example, the correct host template will add Targets to monitor CPU, Memory, disk space, and so on at the same time as creating all the Interface targets. You can download some templates that work with most hosts and devices from http://www.steveshipway.org/cfgmaker.”

Also note that I wrote several posts about adding other devices to MRTG/routers2. Use this category to search for them on my blog.

MRTG on the Raspberry Pi?

Since the RPi is quite popular these days, it would be a good use case to run MRTG and the other programs on it. I tried it (Model B) and my short summary is: Everything runs without problems – but it is really slow. I have monitored a few switches with 24 ports each, and the RPi took a few seconds for every refresh of the summary page. This is because the Routers2.cgi generates all RRD images on the fly which consumes lots of CPU power. That is: I stopped running MRTG on the RPi because it was simply to slow.

Okay, finished for today! ;)

[Update] 1 Minute Interval

Just a quick update for running MRTG on a 1 minute interval rather than on 5 minutes:

Run the cron job every minute, change the first number from 5 to 1:

Set the MRTG option to 1:

Set routers2 to display the 6 hour graphs:

And delete all already existing rrd files in order to have them created with the 1 minute interval (make a backup before you are deleting them!):

 

Featured image: “control centre” by pristyles is licensed under CC BY-NC 2.0.

47 thoughts on “MRTG with RRDtool and Routers2 – Installation from Scratch

  1. Sorry you were a little disappointed due to the lack of detailed installation instructions in the book.
    The problem I had was that there are simply way too many different platforms under which the software can be installed, plus several different ways that it can be installed and managed on a given system, and I could not give detailed instructions for all of them. Your instructions above are great, and very detailed; but are specifically for one way of installing under Debian. I would have also needed to cover Redhat, Solaris, AIX, and of course Windows…
    As I result I went lighter on the ‘how to install’ (since the individual packages come with their own instructions) and heavier on the ‘how to use it and make the most of it’. Hopefully, you found the book much more useful in this area.

    1. Hey Steve. I appreciate it to see your comment here.
      Yes, I am still using your book. It was a good starting point to see, what routers2 can do at all. And it is still a reference for all the options. ;)

  2. Hi Johonnes,

    Any idea why I get this error:

    Error reading RRD database /var/mrtg/172.21.147.14_gi0_1_0.1000.rrd
    opening ‘/var/mrtg/172.21.147.14_gi0_1_0.1000.rrd’: No such file or directory
    Check that MRTG has run successfully on this device, and has created the RRD file.

    I followed your guide step by step..

    Also, when I try to manually run MRTG.. i get an error saying that /var/mrtg is not created.. when it is created…

    Thanks!

    1. Hi Carlos,

      this might have something to do with the permission of that /var/mrtg/ directory. Maybe mrtg is not able to create the rrd file. Have you created it as sudo? If you do a “ls -ahl /var/” on your machine, what are the permission on the mrtg folder? Something like this?:
      drwxr-xr-x 2 root root 20K Aug 13 08:51 mrtg
      Regards!

      1. Hi Johonnes

        Thanks for a great write-up, I’m still facing the issue that is on the subject. I have the same permission you indicate but no luck. Any other options

        Thanks

    2. This really looks like permissions on the /var/mrtg directory are wrong. Make sure the directory has write permission to (or is owned by) the MRTG process.

    1. Hm, I am sorry, but I don’t know any further hints right now.
      I hope that you have correctly used a Target[], Title[], MaxBytes[] triple to have an rrd file created without any other errors. But if it is still not created, I do not know. Maybe you can post your issue on the forum from Steve Shipway (http://www.steveshipway.org/forum/)?

    2. Either you have wrong permissions on /var/mrtg — no write permission to the MRTG process, or /var is full, or you have not set ‘WorkDir:/var/mrtg’ in your cfg files (so they are being created elsewhere), or you have string SELinux operating which is denying write permission to /var/mrtg, or MRTG is not running (try running it interactively to test)

  3. The “Error reading RRD” message appears when the RRD file cannot be read, either because of file or directory access permission, or because the RRD file mentioned does not exist. The usual reason is that it does not exist; the RRD file is created by the first *successful* run of MRTG against the Target.

    Possible causes for this would be —
    0. File permissions. The file exists but is owned by the wrong user – maybe you ran an initial test as the ‘root’ user then run subsequent updates as ‘mrtg’, but the file does not have read permission for the web process.
    1. directory permissions. The MRTG process does not have write permission to the directory to create the file
    2. file system full or quota restrictions
    3. The MRTG process cannot retrieve the data. Possibly the SNMP community or ACL for the device are wrong, so it cannot collect the data. The RRD file will not be created if it does not have data.
    4. The cfg file is incorrectly set to ‘native’ mode — IE, it does not have LogFormat:rrdtool defined. In this case it will write a .log file, not a .rrd file
    5. The MRTG process has not run. Maybe your MRTG daemon has died, or you have a scheduler that is not running? Maybe you have not scheduled a run against this cfg file?
    6. The MRTG daemon has not updated. Maybe you’re using a single daemon with a master.cfg inclusion configuration, but you have not restarted it to cause it to re-read the configuration, and a new cfg file has not been picked up (MRTG 2.17.4 checks file update time to try and re-read where necessary)

    To test this, try switching to the user that MRTG is supposed to run as, and run MRTG interactively against your cfg file. You’ll see any error messages which should help to clear things up — either SNMP errors, or file permission errors. If an interactive run works fine, the issue is likely with your scheduler.

    Hope this helps

  4. Gentlemen,
    This is the error that appeared on my mrtg.log
    ERROR: CFG Error in “logformat”, file /etc/mrtg.cfg line 3: Invalid Logformat ‘rrdtool #Tells MRTG to use RRD instead of its own log format’

    Advise Pls

    1. You are not allowed to do follow-on comment style in MRTG — IE, this is NOT allowed:

      LogFormat: rrdtool # comment here

      You can only do comment lines prepended with whitespace and a #, like this:

      # comment here
      LogFormat: rrdtool

  5. I am getting an error early where I can’t access the http://IPADDRESS/cgi-bin/routers2.cgi, the part that begins First Test (Yet Without Any Devices).

    initially, I got a 404 error “Does not exist”.
    I created a ScriptAlias for usr/lib/cgi-bin
    with the directory.
    THEN I got a second error:
    You don’t have permission to access /cgi-bin/routers2.cgi on this server.

    So, when I thought this was going to be a short and sweet config up to this point, I seem to be going down different rabbit holes. somehow the guide must be assuming that I know more about this than I do, because I think there are steps missing. Or did I miss something?

    Thanks,
    Ryan

  6. I thought I had left a comment. I am having issues from the get go on this config. Could be that I’m no expert with either apache or cgi. In any case,when I go to http://ip-address/cgi-bin/routers2.cgi, I get a text file of the routers2.cgi file displayed, OR, if I delete the settings I made, then I get an error that it doesn’t exist.

    So I know I’m not correctly allowing the cgi to be properly displayed. Just don’t know where that is. I don’t see any guides that integrate things like this one, so any help, thanks in advance.

    1. Hi Ryan,

      hm, I am sorry, but I do not know where your problem is. I have done MRTG/routers2 installation with this guide a few times now. Every single step I did is documented here. So maybe you just have skipped a few lines here? (Have you done the fourth point from “Webserver: Apache”?)

    2. If you’re seeing the contents of the CGI file itself, then this means you have an Apache configuration issue – the script is not being run, which means that either you dont have the Apache CGI module installed, or you have not set up ScriptAlias for the directory correctly, or you don’t have the ExecCGI option set (see http://httpd.apache.org/docs/2.2/howto/cgi.html ). If you are using mod_perl, you may want to use AddHandler and ExecCGI (see the previous link for details)

      Make sure the routers2.cgi has read and execute permission on it, as do the containing directories, and (unless you are using mod_perl) verify the initial #! line correctly gives the path to the perl executable.

      “You dont have permission” errors will mean that you need to check the directory permissions; also and authentication rules you have configured in apache, including any .htaccess directives. Something in Apache is denying you access to the URL.

      Hope this helps…

    3. There is one thing to note that 14.04 uses Doc root is actually /var/www/html this could fix your issue.

  7. Something you may wish to add to your section about using cfgmaker to create MRTG configuratiobs, is that cfgmaker allows you to specify ‘host templates’ and ‘interface templates’. These are scripts that add additional Targets either on a per-device or per-interface basis. For example, the correct host template will add Targets to monitor CPU, Memory, disk space, and so on at the same time as creating all the Interface targets.

    You can download some templates that work with most hosts and devices from http://www.steveshipway.org/cfgmaker

  8. I followed these directions step for step on Ubuntu Server 14 with Apache 2.4. There are 2 steps that helped me get this working.

    1st.) sudo a2enmod cgi
    2nd.) sudo gedit /etc/apache2/sites-available/000-default.conf
    Change /var/www/html to /var/www *basically remote the /html
    3rd.)sudo service apache2 restart

    These steps got it working for me!

  9. just do not forge to change default cfmaker WorkDir to appropriate option…

    cfgmaker –global ‘WorkDir: /var/mrtg’ –output ….

    i made that mistake

    great tutorial…

  10. Is there any step by step to install MRTG With RRDTOOL and routers2 on Windows platform?

    1. The Open Innovations Bundle for Windows can install everything in one go, and they have instructions on their website.
      http://www.openinnovations.com/mrtgbundle.html

      Unfortunately, they have fairly old versions of Routers2, RRDTool and MRTG, but these can be separately upgraded afterwards using the instructions with the individual applications. Routers2, for example, can be upgraded simply by unpacking the ‘tar’ package and running the ‘install.pl’ script, which then identifies the existing installation and upgrades it.

  11. Great job of documenting! I loved to follow your instructions.
    But there are a few things I had to adjust:

    1. Font-Size of the table next to the graph
    It was just too small for me so I adjusted line 84 in
    /var/www/rrdicons/routers2.css (side text on summary page: changed from “smaller” to “small”

    2. Increased height of top frame for larger logo
    I changed line 4933 the parameter “rows” from 50 to whatever fits your logo in
    /usr/lib/cgi-bin/routers2.cgi

    It would be cool to adjust these things from within /var/mrtg/routers2.conf

    Hope this helps if someone else needs such an adjustment!

  12. Hi Johannes,

    thanks for the documentation, but I have one problem!

    When I go to http://localhost/cgi-bin/routers2.cgi the MRTG Network Monitor ist opening, but there no icons shown.
    And I think the paths are correct!

    Here is the Actice Configuration Settings:
    routers.cgi-actuals = “yes”
    routers.cgi-archive-mode = “hash”
    routers.cgi-bgcolour = “#ffffff”
    routers.cgi-cfgfiles = “*.cfg”
    routers.cgi-compact = “no”
    routers.cgi-confpath = “/etc/mrtg”
    routers.cgi-dayend = “18”
    routers.cgi-daystart = “8”
    routers.cgi-dbpath = “/var/mrtg”
    routers.cgi-defaultinterface = “_summary_”
    routers.cgi-defaulttarget = “summary”
    routers.cgi-extendedtime = “yes”
    routers.cgi-graphpath = “/graphs”
    routers.cgi-graphstyle = “x3”
    routers.cgi-graphtype = “w”
    routers.cgi-graphurl = “/graphs”
    routers.cgi-iconurl = “/rrdicons/”
    routers.cgi-legendunits = “yes”
    routers.cgi-percentile = “yes”
    routers.cgi-showfindbox = “no”
    routers.cgi-showtotal = “yes”
    routers.cgi-slope = “yes”
    routers.cgi-smalliconurl = “/rrdicons/”
    routers.cgi-sorder = “l2 l2D x3 x3D”
    routers.cgi-stylesheet = “/rrdicons/routers2.css”
    routers.cgi-twinmenu = “yes”
    routers.cgi-unscaled = “no”
    routers.cgi-usebigk = “no”
    routers.cgi-windowtitle = “RasPi MRTG Network Monitor”
    routers.cgi-withdate = “yes”
    targetnames-ifdefault = “ai”
    targetnames-routerdefault = “filename”
    web-backurl = “/”
    web-charset = “utf-8”
    web-png = “1”

    Thanks for your help!

    Regards

    1. You might like to try visiting page http://localhost/cgi-bin/routers2.cgi?page=verify which will test your configuration. If the small target icons are invisible, then this indicates that the smalliconurl does not point to the correct location. If the larger heading icons are invisible, then they may be missing, or you may have installed a language pack incorrectly and ${iconurl}/${language} does not contain the replacement icons.

    2. Hi Carsten,

      I just installed another MRTG with Routers2 and got the same error. After 1-2 hours I found a difference in the apache2 configuration: they changes the DocumentRoot from /var/www to /var/www/html
      I solved it by:
      “sudo nano /etc/apache2/sites-available/000-default.conf”
      and change the edited the following line into:
      “DocumentRoot /var/www”
      Then “sudo service apache2 restart” and it worked.

      Johannes

  13. Hello Steve,
    all icons are invisible….
    How can I install the missing icons and reinstall the language pack?
    Regards

    1. Check that your iconurl and smalliconurl are correct. Do the paths exist, and they are accessible to the web server? Look in the corresponding directory for the icon files. If they are there then your web server config is wrong. If they are not there, then re-run the install.pl script from the routers2 package.

      Looking at your config, it also seems that graphpath and graphurl are incorrect. Make sure that graphpath is the PATH corresponding to the graphurl URL.

  14. Hie Johannes,

    Thanks for a good article, l have been tasked with implementing a monitoring solution for billing purposes…The key deliverable is to store historical data for longer periods of time ,. l want to store daily 5 minute data for 30 days , weekly 10 minute data for 30 days ,monthly 30 minute data for 90 days and yearly 1 day data for 5 years….l am not sure what metrics l should use in creating metrics for these graphs…

    1. Hi Jikamsila,

      as far as I know it is not that simple to further extend the storing of historical data. Routers2.cgi as well as MRTG use almost always these default values. Please refer to the MRTG or Routers2 documentation. I cannot help you with this, sorry.

    2. If you have the latest version of Routers2, then it supports extended RRD files. There are detailed instructions in the installation docs with the package. Basically, you need to have some MRTG directives in your default MRTG cfg file (so that RRD files are created with the new default larger size) and existing RRD files can be extended using ‘rrdtool tune’. Routers2 will automatically detect these extended RRD files (you need to enable this in the routers2,.conf though).

      The default 5min data is kept for 2 days, but you can extend that as far as you want – note that the disk space requirements will increase proportionally, though. When using ‘rrdtool tune’, RRA number 0 and 1 are the 5min (daily), 2 and 3 are the 30min (weekly), 4 and 5 are the 2h (monthly) and 6 and 7 are the 1day (yearly).

  15. I’m trying to get this running on Ubuntu 16.04.1 Server without any success (as yet). I note (first) that there’s an inconsistency I’ve seen in your documentation where the routers2.cgi setup is being configured. You give the following:
    Configuration file [/var/mrtg/routers2.conf]?

    whereas the configuration default is actually:
    Configuration file [/etc/mrtg/routers2.conf]?

    And along with this, you then have the following line:
    After this installation process, the configuration file for routers2.cgi can be modified with sudo nano /var/mrtg/routers2.conf.

    Should this actually be:
    sudo nano /etc/mrtg/routers2.conf

    The next step (First Test without any devices) is where I come unstuck – I get the following error message:

    500 Internal Server Error

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

    More information about this error may be available in the server error log.

    Apache/2.4.18 (Ubuntu) Server at 10.255.17.162 Port 80

    1. Check your apache error log; the most likely cause of this is that you have some perl modules missing on your system, or even perl has not been installed correctly. The error log should give you proper information. Another possibliity is incorrect file permissions, though the script will usually catch these.

      Also, you can run the routers2.cgi script direct from the commandline (don’t do this as root) which should give you relevant error messages.

      The installation process does a bit of intelligent system checking, and so will give a different default location in some cases, if it discovers that you have installed your web server in a different way, or if certain things are already installed. This is likely why you have a different default to the one in the original example.

      1. running /usr/lib/cgi-bin/routers2.cgi gives the following error message:
        Can’t locate CGI.pm in @INC (you may need to install the CGI module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /usr/lib/cgi-bin/routers2.cgi line 29.
        BEGIN failed–compilation aborted at /usr/lib/cgi-bin/routers2.cgi line 29.

        When I check using “a2enmod cgi”, as JKroll mentioned above, I had to run this to enable CGI before, it reports:
        Your MPM seems to be threaded. Selecting cgid instead of cgi.
        Module cgid already enabled

        The error in the apache error.log is the same as the router2.cgi output.

        Aside from running on Ubuntu Server 16.04.1 (not 13.04 which looks like the last LTS version as of the original date of this post), I’ve done everything else as per the blog post – including the additional steps as detailed by Johannes in response to Carsten in the comments (which I think Johannes actually meant:
        “and change the edited the following line into:
        “DocumentRoot /var/www/html”

        Still looks like the cgi-bin stuff is faulting here and I’m not sure why. Again, using Ubuntu Server 16.04.1 with everything else as per this blog.

        1. The Routers2 script requires the Perl CGI module to run; without this installed, it fails, as you see. The a2enmod command only enables the embedded Perl CGI support in Apache; you need to install the CGI Perl module.

          Try installing libcgi-pm-perl and see if this fixes things; otherwise, it may be overkill, but under Ubuntu, try installing libcgi-application-basic-plugin-bundle-perl which should pull in the CGI module (and a fair bit more besides)

  16. Hy guys, ty for this tutorial i need a large help because im big newbie on linux

    i have a problem on step: First Test (Yet Without Any Devices)

    i just cant get that to work, just getting error 404 not found response…

    so things i got: ubuntu server properly working and updated
    installed all programs and apache2 is up and running, same with mrtg

    so only problem i think is routers… do i need to turn it on somehow? do i need to make changes to apache cfg or what do i need to do that isnt explained in tutorial to get that test monitor page?

    sry for this kind of questions…

    1. sry guys, dont bother previous comments solved my issue

      resolved with: sudo a2enmod cgi
      service apache2 restart

  17. Guten Abend,

    vor ein paar Tagen hatte ich eine Frage zum Thema MRTG bereits per Mail gestellt. Natürlich macht es mehr Sinn dies entsprechend direkt unter diesen Blog hier zu setzen um eventuell anderen damit gleich mit zu helfen.

    Seit längerer Zeit besitze ich zwei Raspberry Pi an zwei verschiedenen Standorten um mehrere Geräte zu überwachen und FritzDect Cometen sowie Fritz DECT Geräte zu monitoren. Nun bin ich vor längerer Zeit über den Fakt gestolpert welcher mir zwar bewusst war aber in dem Zusammenhang nie in den Kopf gekommen ist: SD Karten mögen es ja eigentlich nicht häufig beschrieben zu werden und sterben eher früher als später. Nun stellt sich mir die Frage was kann man unternehmen um diesen Prozess zu verlangsamen? Was ich ändern könnte wäre das Auslagern der RRD Dateien da diese teilweise sogar im Minuten Takt geändert werden. Nur wo wird angegeben wo die RRD Dateien sind beziehungsweise was muss alles geändert werden wenn man in einem laufenden System den Speicherort der RRDs verändert?
    Ich würde diese nämlich gern auf meine NAS auslagern. Den dabei aussetzenden Standby nehme ich dabei in Kauf da a) eh WD Red verbaut sind und b) demnächst Dienste (IP-Cams) auf dem NAS laufen werden wo die Platten eh nicht mehr schlafen gehen.

    Auf eine Antwort zu diesem Thema würde ich mich sehr freuen.

    Mit freundlichen Grüßen

    Marcus

    1. Hallo Marcus,

      meine persönliche Erfahrung mit den SD-Karten ist außerordentlich gut! Ich verwende bei meinem Stromzähler-Projekt ebenfalls eine herkömmliche SD-Karte, welche teilweise mehrmals pro Minute (!!!) einen Zählerstand auf der SD-Karte erhöht. Aber bereits seit mehreren Jahren läuft dieser Raspberry Pi ohne Probleme! (Ein anderer Leser hatte gleiches Bedenken ebenfalls geäußert: https://blog.webernetz.net/2014/10/13/stromzahler-mit-s0-schnittstelle-vom-raspberry-pi-auswerten/#comment-35029 )

      Obwohl es also *theoretisch* möglich wäre, die RRD Dateien auf ein NAS auszulagern, würde ich sehr davon abraten, weil der MRTG Prozess dann immer erst auf das NAS zugreifen muss, was es verlangsamen würde. Änderungen im Minutentakt auf der SD-Karte sind meiner Meinung nach unkritisch. (Mir hat mal ein IT-Fachmann gesagt, dass die Chips auf den SD-Karten selber sehr gut die Speicherzugriffe verwalten und eine automatische Streuung einbauen. Evtl. gibt es deswegen wenig Probleme bei mir?)

      PS: Mein Problem mit MRTG auf dem Raspberry Pi war eher die generelle Langsamkeit des Pis beim Erstellen der Graphen. Öffnete man eine Seite im Monitoring Server, welche mehrere Graphen erstellen musste, musste man mitunter ein paar Sekunden warten. Dieses Problem würde man mit einem Auslagern der RRD Files ebenfalls nicht lösen können.

      Ok, ich hoffe ich konnte dir trotzdem irgendwie helfen. ;)
      Johannes

      1. Vielen Dank für die Antwort. Das beruhigt mich dann doch etwas. Sicherlich wäre der Weg über das NAS eine Krücke aber wenn die Karten dann doch so viel aushalten passt es. Regelmäßige Backups werde ich aber anlegen für den Fall der Fälle.
        Sobald es jetzt wieder kälter wird werde ich mich nochmal wegen einem anderen Problem melden.

        Vielen dank und liebe Grüße

Leave a Reply

Your email address will not be published. Required fields are marked *