Difference between revisions of "Monitorix"

From ArchWiki
Jump to: navigation, search
m (Viewing Monitorix Data)
(25 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:HOWTOs (English)]]
+
[[Category:Web Server]]
[[Category:Web Server (English)]]
+
{{Article summary start}}
 +
{{Article summary text|Installation and configuration of Monitorix.}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|Anything-sync-daemon}}
 +
{{Article summary wiki|lm_sensors}}
 +
{{Article summary wiki|hddtemp}}
 +
{{Article summary end}}
  
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[[http://www.monitorix.org/ 1]].
+
[http://www.monitorix.org/ Monitorix] is an open source, lightweight system monitoring tool designed to monitor as many services and system resources as possible. It has been created to be used under production '''UNIX/Linux servers''', but due to its simplicity and small size many use it on embedded devices as well.
  
 
==Installation of Monitorix==
 
==Installation of Monitorix==
 
+
Visit the [[AUR]] and grab the tarball for the {{AUR|monitorix}} package and build/install it.
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 [[http://aur.archlinux.org/packages.php?ID=33911 monitorix package]] and build/install it.
+
 
+
$ tar monitorix.tar.gz
+
$ cd monitorix
+
$ makepkg -s
+
# pacman -U monitorix-<TAB>.tar.gz
+
  
 
{{Note| Depending on which font packages are installed on your system, it ''might'' been necessary to install the '''terminus-font''' package.  For now, proceed without it, once monitorix is configured and running, users will know very quickly if they are missing the correct font as the graphs will not contain any text at which point, go ahead and install the '''terminus-font''' package via pacman.}}
 
{{Note| Depending on which font packages are installed on your system, it ''might'' been necessary to install the '''terminus-font''' package.  For now, proceed without it, once monitorix is configured and running, users will know very quickly if they are missing the correct font as the graphs will not contain any text at which point, go ahead and install the '''terminus-font''' package via pacman.}}
  
 
==Configuration of Monitorix==
 
==Configuration of Monitorix==
Before starting the monitorix daemon, '''be sure''' to adjust the {{Filename|/etc/monitorix.conf}} to your liking.  For a complete list of options and features, see the [[http://monitorix.org official website]] or the included man page for monitor.conf.   
+
Before starting the monitorix daemon, '''be sure''' to adjust the {{ic|/etc/monitorix.conf}} to your liking.  For a complete list of options and features, see the [[http://monitorix.org 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.
 
Most if not all of the user settings are self explanatory based on the commented text within the conf file itself.
 
===General===
 
<pre>our $TITLE = "My Company";    # your company name
 
our $HOSTNAME = "myhostname";            # hostname of this server
 
our $OSTYPE = "Linux-Arch";        # 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</pre>
 
 
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===
 
 
<pre>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
 
</pre>
 
 
Toggle which of the data gets displayed.
 
 
===CPU Stats===
 
 
<pre>
 
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
 
</pre>
 
 
The default values here are fine.  Adjust the memory variable to the amount of RAM on your system.
 
 
===Temperature 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 {{Filename|/etc/monitorix.conf}}
 
 
For example:
 
 
<pre>
 
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
 
</pre>
 
 
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:
 
 
<pre>
 
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
 
</pre>
 
 
===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==
 
==Start Monitorix==
 +
Start Monitorix with the included service file like any other systemd service:
 +
# systemctl start monitorix
  
Monitorix is started like any other daemonData 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.
+
==Viewing Monitorix Data==
 +
With the release of version 3.0.0, Monitorix now comes with a light, built in webserver thanks to the dependency on {{Pkg|perl-http-server-simple}}This is a configuration option in {{ic|/etc/monitorix.conf}} which users may elect to either use or not.
  
# /etc/rc.d/monitorix start
+
{{Note|This the perl-http-server is defaulted to ''disabled'' in /etc/monitorix.conf.}}
# /etc/rc.d/crond restart
+
  
{{Note|To have monitorix start at boot, add it to your daemons array in {{Filename|/etc/rc.conf}}.}}
+
To view system stats, using the perl-http-server, simply point a browser to [[http://localhost:8080/monitorix http://localhost:8080/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.}}
 
{{Note|It will take several minutes before data are displayed graphically so be patient.}}
  
==Configure a Webserver==
+
==Configure an External 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!
+
 
+
 
===Lighttpd===
 
===Lighttpd===
 +
{{Pkg|Lighttpd}} is another option.
  
  # pacman -S lighttpd
+
By default, cgi support is not enabled in lighttpd. To enable it and to assign perl to process .cgi files, add the following two lines to {{ic|/etc/lighttpd/lighttpd.conf}}:
  
By default, cgi support is not enabled in lighttpdTo enable it, uncomment the following lines in {{Filename | /etc/lighttpd/lighttpd.conf}}:
+
server.modules = ( "mod_cgi" )
 +
  cgi.assign = ( ".cgi" => "/usr/bin/perl" )
  
Under the server.modules section, uncomment the following line:
 
"mod_cgi",
 
 
Under the CGI module section, uncomment the following two lines:
 
<pre>cgi.assign                = ( ".pl"  => "/usr/bin/perl",
 
                              ".cgi" => "/usr/bin/perl" )</pre>
 
 
Save the file and exit.
 
 
Start lighttpd like any other daemon:
 
# /etc/rc.d/lighttpd start
 
 
{{Note|To have lighttpd start at boot, add it to your daemons array in {{Filename|/etc/rc.conf}}.}}
 
 
===Apache===
 
===Apache===
 +
{{Pkg|Apache}} is yet another option.
  
# pacman -S apache
 
 
Make sure the hostname appears in {{Filename|/etc/hosts}} and in {{Filename|/etc/rc.conf}} or apache will not operate.
 
 
Start apache like any other daemon:
 
# /etc/rc.d/httpd start
 
 
{{Note|To have apache start at boot, add it to your daemons array in {{Filename|/etc/rc.conf}}.}}
 
 
==Using tmpfs to Store RRD Databases==
 
==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.
+
{{AUR|Anything-sync-daemon}} is a package which provides a pseudo-daemon that makes use of tmpfs to store RRD Databases for Monitorix.  Doing so will greatly reduce hdd reads/writes.
 
+
http://aur.archlinux.org/packages.php?ID=34134
+

Revision as of 03:00, 22 April 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Monitorix is an open source, lightweight system monitoring tool designed to monitor as many services and system resources as possible. It has been created to be used under production UNIX/Linux servers, but due to its simplicity and small size many use it on embedded devices as well.

Installation of Monitorix

Visit the AUR and grab the tarball for the monitorixAUR package and build/install it.

Note: Depending on which font packages are installed on your system, it might been necessary to install the terminus-font package. For now, proceed without it, once monitorix is configured and running, users will know very quickly if they are missing the correct font as the graphs will not contain any text at which point, go ahead and install the terminus-font package via pacman.

Configuration of Monitorix

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

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

Start Monitorix

Start Monitorix with the included service file like any other systemd service:

# systemctl start monitorix

Viewing Monitorix Data

With the release of version 3.0.0, Monitorix now comes with a light, built in webserver thanks to the dependency on perl-http-server-simple. This is a configuration option in /etc/monitorix.conf which users may elect to either use or not.

Note: This the perl-http-server is defaulted to disabled in /etc/monitorix.conf.

To view system stats, using the perl-http-server, simply point a browser to [http://localhost:8080/monitorix] to see the data.

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

Configure an External Webserver

Lighttpd

Lighttpd is another option.

By default, cgi support is not enabled in lighttpd. To enable it and to assign perl to process .cgi files, add the following two lines to /etc/lighttpd/lighttpd.conf:

server.modules		= ( "mod_cgi" )
cgi.assign		= ( ".cgi" => "/usr/bin/perl" )

Apache

Apache is yet another option.

Using tmpfs to Store RRD Databases

Anything-sync-daemonAUR is a package which provides a pseudo-daemon that makes use of tmpfs to store RRD Databases for Monitorix. Doing so will greatly reduce hdd reads/writes.