## 2.10. Setup graphical server monitoring using MRTG

OLAT provides some graphical monitoring tools to supervise the helthness of your server. The graphics are generated by a tool called MRTG which originally has been designed to monitor network devices. Thanks to the very generic interface it can be used to monitor anything that provides a comparable value.

The available scripts are all built for Unix. If someone creates some windows equivalents, please share them with us.

### 2.10.1. Install MRTG

The open source tool MRTG can be downloaded from MRTG site. Most Linux distributions have pre-built binary packages.

### 2.10.2. Build the configuration file

Go to your olat3 directory and use ant to generate the MRTG configuration file. Make sure the path to your MRTG is correct in your olat3/build.properties file. Usually you don't have to change anything there:

    ...
    # MRTG configuration for monitoring (optional)
    mrtg.bin=/usr/bin/mrtg
    monitoring.dir=${base.dir}/monitoring
    ...

Now generate the configuration for MRTG and the olat server monitoring scripts:

    #cd olat3
    #ant config-all

Now the necessary configuration is located at olat3/monitoring/conf/

mrtg.cfg: The MRTG main configuration file. Usually you do not need to change anything here. Review the file and proceed with the installation of the cronjobs.

### 2.10.3. Installing the monitoring crontabs

monitoring-crontab: This are the cron jobs you need to install. You can use any cron system. On most Unix systems you can type the following as root:

    #crontab -e -u apache  (or wwwrun or whatever user is running your apache)

Now paste the generated sample monitoring-crontab file from olat3/monitoring/conf into the editor and save.

The cronjobs fetch some statisitcal values from the OLAT server every 5 minutes, plus it checks the ping time to google to see if your network is up and running and writes the information in a temporary file. MRTG uses then the files to read the value (kind of not so nice, feel free to send us a much nicer configuration file. Then if runs the MRTG program every 5 minutes to update the graphics.

### 2.10.4. Configuring Apache

Configure your apache to deliver the index page from the mrtg output. This is in your olatdata/monitoring directory. See the section Section 2.4, “Tomcat and Apache configuration”.Search for the monitoring section.

### 2.10.5. Interpreting the images

Point your browser to the location where you have your monitoring defined. You will get an overview page that contains the daily and weekly statistics. Click on any title to also see the montly and early statistics.

The images are kind of odd. They must be read from right to left and not vice verca. This means: the present is at the very left side of the image, and the past is at the right side.

- Users online: number of authenticated user sessions. If a user is logged in twice, he will be counted twice. The blue line shows the users logged in using SSL.

- WebDAV iser: number of users connected using WebDAV. The blue line shows the users who use an SSL WebDAV connection.

- Instant messaging users: number of running instant messaging clients. This acutally shows the distinct number of online users since at each moment there can only be one instant messaging client in the system per user. The blue line shows the number of opened chat windows.

- Link availability: milliseconds needed to ping google.com. A network test

- Apache and MySQL processes: number of running apache processes (green) and running MySQL processes (blue). Handy to optimize your configuration.

- CPU load: Unix load multiplied by 100. (MRTG can only handle integers, load is usually a number between 0 and 1. Read Unix manpages to really understand the meaning of this value. Generally you can say, a load of 1 (value of 100 in the graph) means that in the average one process is requesting CPU cycles at each moment. If you have a multi processor machine the interpretation of this value changes. A machine with four processes can handle a load of 4 to have the same busyness as a one processor machine with a load of 1.

- Memory: Green is the amount of memory used (Total memory - free memory - buffered memory - cached memory) in your system. Note that this is not the memory used by OLAT but a monitoring of your system memory! Blue is the amount of swap used (Total swap - free swap). Note that it is common that the swap is used under linux even there is free memory. Read the manpages to understand the memory management of your operating system.

- Runtime controllers: number of OLAT controllers held in a weak hash map. When the line drops, the garbage collector has cleaned up the unused controllers.