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.
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.
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.
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.
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.
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.
To setup monitorix to read your specific sensors data, simply run sensors on the box and make the appropriate substitutions in the Template:Filename
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.
Set up to seven mount points. The root partition is included by default and need not be implicitly specified.
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
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.
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
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.
Configure a Webserver
Monitorix has minimal requirements for webservering the data. Arch has several options in the main repos for web serving, two of which are listed below. Lighttpd is recommended since its system resource footprint is minimal compared to apache (0.94 MB vs. 6.52 MB). Alternatively, Apache will work, but it is overkill!
# pacman -S lighttpd
By default, cgi support is not enabled in lighttpd. To enable it, uncomment the following lines in Template:Filename:
Under the server.modules section, uncomment the following line:
Under the CGI module section, uncomment the following two lines:
cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" )
Save the file and exit.
Start lighttpd like any other daemon:
# /etc/rc.d/lighttpd start
# pacman -S apache
Start apache like any other daemon:
# /etc/rc.d/httpd start
Using tmpfs to Store RRD Databases
Have a look at the following package which provides a script that will make use of tmpfs to store your RRD Databases for Monitorix. Doing so will greatly reduce hdd reads/writes.