Difference between revisions of "Monitorix"

From ArchWiki
Jump to: navigation, search
(monitorix - a light hardware monitor that uses rrdtool and a webserver)
 
m (Start Monitorix)
Line 113: Line 113:
 
==Start Monitorix==
 
==Start Monitorix==
  
Monitorix is started like any other daemon:
+
Monitorix is started like any other daemon.  Data collection will occur '''once per minute''' triggered via a cron job ({{Filename|/etc/cron.d/monitorix}}).  When running monitorix for the very first time, it is necessary to restart the crond.  On any subsequent start or restart this step is not necessary.
 +
 
 
  # /etc/rc.d/monitorix start
 
  # /etc/rc.d/monitorix start
{{Note| Monitorix collects data once per minute using a cron lob. When running it the first time it will take several minutes before data are displayed graphically so be patient.}}
+
  # /etc/rc.d/crond restart
  
 
{{Note|To have monitorix start at boot, add it to your daemons array in {{Filename|/etc/rc.conf}}.}}
 
{{Note|To have monitorix start at boot, add it to your daemons array in {{Filename|/etc/rc.conf}}.}}
  
 
To view your system stats, make sure your webserver is running (see the next section if you do not have a webserver) and browse to [[http://localhost/monitorix http://localhost/monitorix]] to see the data.
 
To view your system stats, make sure your webserver is running (see the next section if you do not have a webserver) and browse to [[http://localhost/monitorix http://localhost/monitorix]] to see the data.
 +
 +
{{Note|It will take several minutes before data are displayed graphically so be patient.}}
  
 
==Configure a Webserver==
 
==Configure a Webserver==

Revision as of 21:03, 27 January 2010


Monitorix is a free, open source, lightweight system monitoring tool designed to monitor as many services as possible. At this time it monitors from the CPU load and temperatures to the users using the system. Network devices activity, network services demand and even the devices' interrupt activity are also monitored, and more. The current status of any corporate server with Monitorix installed can be accessed via a web browser[1].

Installation of Monitorix

There are two dependencies for this package -- both of which are in the repos. Install them before you attempt to install the package you will build.

# pacman -S rrdtool metamail

Visit the AUR and grab the tarball for the [monitorix package] and build/install it.

$ tar monitorix.tar.gz
$ cd monitorix
$ makepkg -s
# pacman -U monitorix-<TAB>.tar.gz

Configuration of Monitorix

Before starting the monitorix daemon, be sure to adjust the Template:Filename to your liking. For a complete list of options and features, see the [official website] or the included man page for monitor.conf.

$ man monitorix.conf

Most if not all of the user settings are self explanatory based on the commented text within the conf file itself.

General

our $TITLE = "My Company";    # your company name
our $HOSTNAME = "myhostname";            # hostname of this server
our $OSTYPE = "Linux-RHFC";        # choose your OS type (see below)
our $SAMBAVER = "3";            # Samba version (2 or 3)
our $MULTIHOST = "N";            # Enable multihost feature
our $MULTIHOST_FOOTER = "Y";        # (multihost) display URL in image
our $MULTIHOST_IMGPERLINE = "2";    # (multihost) # of images per line
our $REPORT_LANG = "en";        # Report language
our $THEME_COLOR = "black";        # Default is "black", none is "white"
our $REFRESH_RATE = "150";        # Web stats' refresh rate in seconds
our $ENABLE_CROND_MAIL = "Y";        # Error messages are sent by crond

Common settings to tweak here include company name, hostname, and theme color.

Warning: Do NOT change the our $OSTYPE setting!

Select Which Data Gets Graphed

our $ENABLE_CPU = "Y";            # Enable/Disable CPU graph
our $ENABLE_KERN = "Y";            # Enable/Disable KERN graph
our $ENABLE_PROC = "Y";            # Enable/Disable PROC graph
our $ENABLE_DISK = "Y";            # Enable/Disable DISK graph
our $ENABLE_NET = "Y";            # Enable/Disable NET graph
our $ENABLE_SERVU = "Y";        # Enable/Disable SERVU graph
our $ENABLE_PORT = "Y";            # Enable/Disable PORT graph
our $ENABLE_USER = "Y";            # Enable/Disable USER graph
our $ENABLE_NGINX = "N";        # Enable/Disable NGINX graph
our $ENABLE_INT = "Y";            # Enable/Disable INT graph
our $ENABLE_LMTEMP = "N";        # Enable/Disable LMTEMP graph

our $ENABLE_ZOOM = "Y";            # Enable Zoom feature
our $IFACE_MODE = "graph";        # Interface mode: graph or text

Toggle which of the data gets displayed.

CPU Stats

our $CPU1_RIGID = "1";            # rigid level
our $CPU1_LIMIT = "1";            # CPUs max value
our $CPU2_RIGID = "0";            # rigid level
our $CPU2_LIMIT = "100";        # NPROC max value
our $MEMORY = "4096";        # MB of memory

The default values here are fine. Adjust the memory variable to the amount of RAM on your system.

Tempeture monitor

Monitorix optionally reads the info from lm-sensors and from hddtemp and logs CPU, MB, and HDD temps as well as fan speeds. See the lm_sensors wiki article to setup sensors on your box. See the hddtemp wiki article to setup hddtemp on your box.

Note: both packages are in the [extra] repo. Install them via: pacman -S lm_sensors hddtemp

To setup monitorix to read your specific sensors data, simply run sensors on the box and make the appropriate substitutions in the Template:Filename

For example:

ur %SENSORS_LIST = ("MB" => "temp2",
                     "CPU1" => "Core 0",
                     "CPU2" => "Core 1",
                     "CPU3" => "Core 2",
                     "CPU4" => "Core 3",
                     "FAN1" => "fan1");
our @HDDTEMP_LIST = ("/dev/hda", "/dev/hdd", "/dev/hdc");    # max 9 hard disk drives

Again, you'll need to change the values for each variable based on your own hardware and based on what you want to capture in the rrd databases.

Filesystems

Set up to seven mount points. The root partition is included by default and need not be implicitly specified.

For example:

our @MNT_LIST = ("/home", "/media/data");        # max 7 mount points
our $DISK2_RIGID = "2";            # rigid level
our $DISK2_LIMIT = "1000";        # IOCount max value
our $DISK3_RIGID = "2";            # rigid level
our $DISK3_LIMIT = "1000";        # Sector max value

Additional sections

The rest of the config file includes data that most users won't want or need to customize. Feel free to tweak the file to your liking.

Start Monitorix

Monitorix is started like any other daemon. Data collection will occur once per minute triggered via a cron job (Template:Filename). When running monitorix for the very first time, it is necessary to restart the crond. On any subsequent start or restart this step is not necessary.

# /etc/rc.d/monitorix start
# /etc/rc.d/crond restart
Note: To have monitorix start at boot, add it to your daemons array in Template:Filename.

To view your system stats, make sure your webserver is running (see the next section if you do not have a webserver) and browse to [http://localhost/monitorix] to see the data.

Note: It will take several minutes before data are displayed graphically so be patient.

Configure a Webserver

Lighttpd

Placeholder for someone to use.

Apache

Installation

The following describes exactly what to do to install and configure Apache to work with monitorix.

# pacman -S apache php php-apache

Make sure the hostname appears in /etc/hosts and in /etc/rc.conf or apache will not operate.

Configuration

Add these lines in Template:Filename. First, place this at the beginning of the "LoadModule" list (for some reason php5 won't work if this line is at the bottom of the "LoadModule" list):

LoadModule php5_module modules/libphp5.so

Place this at the end of the "Include" list:

Include conf/extra/php5_module.conf

Uncomment the following lines in Template:Filename:

short_open_tag
Default Value: On
Development Value: Off
Production Value: Off

Start Apache

Apache is started like any other daemon:

# /etc/rc.d/httpd start
Note: To have apache start at boot, add it to your daemons array in Template:Filename.