Difference between revisions of "Monitorix"

From ArchWiki
Jump to: navigation, search
(Fixed missing link pointing to Monitorix localhost monitoring page)
 
(33 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[[Category:Web Server]]
+
[[Category:Status monitoring and notification]]
{{Article summary start}}
+
[[ja:Monitorix]]
{{Article summary text|Installation and configuration of Monitorix.}}
+
{{Related articles start}}
{{Article summary heading|Related}}
+
{{Related|Anything-sync-daemon}}
{{Article summary wiki|Monitorix-sync-daemon}}
+
{{Related|lm_sensors}}
{{Article summary wiki|lm_sensors}}
+
{{Related|hddtemp}}
{{Article summary wiki|hddtemp}}
+
{{Related articles end}}
{{Article summary end}}
+
  
[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.
+
[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==
 +
[[Install]] the package {{AUR|monitorix}}.
  
Visit the [[AUR]] and grab the tarball for the {{AUR|monitorix}} package and build/install it.
+
{{Note|Without a compatible font already installed, the Monitorix graphs will not contain any text. If this happens, install the {{Pkg|terminus-font}}.}}
  
$ tar -zxvf monitorix.tar.gz
+
==Configuration==
  $ cd monitorix
+
Edit {{ic|/etc/monitorix/monitorix.conf}} to match graphing options and system-specific variablesFor a complete list of options and features, see the [http://www.monitorix.org/documentation.html man page].  
$ makepkg -src
+
# 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.}}
+
Most of the user settings are self explanatory based on the commented text within the configuration file itself.
  
==Configuration of Monitorix==
+
Monitorix comes with a light, built-in webserver; via the dependency {{Pkg|perl-http-server-simple}}. It is, however, disabled by default. To use it, change the configuration option as follows: 
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.
+
 
 +
{{hc|1=/etc/monitorix/monitorix.conf|2=
 +
....
 +
<httpd_builtin>
 +
 
 +
enabled = y
 +
....}}
 +
See the configuration file for the other related options, for example [http://www.monitorix.org/documentation.html#3 accesss restrictions], or [[#Configure an external webserver]].
  
$ man monitorix.conf
+
==Start and viewing data ==
 +
[[Start]] {{ic|monitorix.service}} and [[enable]] it to run at boot like any other systemd service.
  
Most if not all of the user settings are self explanatory based on the commented text within the conf file itself.
+
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.
  
===General===
+
{{Tip|If it is the first time running Monitorix, it will take several minutes before data are available to be displayed graphically; so be patient.}}
{{bc|1=
+
our $TITLE = "Reborn's Monitorix";
+
our $HOSTNAME = "Reborn";
+
our $THEME_COLOR = "black";
+
our $REFRESH_RATE = "150";
+
our $IFACE_MODE = "graph";
+
our $ENABLE_ZOOM = "Y";
+
}}
+
 
+
Common settings to tweak here include title, hostname, and theme color.
+
 
+
===Select Which Data Gets Graphed===
+
 
+
{{bc|<nowiki>
+
        "system"        => "Y",
+
        "kern"          => "N",
+
        "proc"          => "Y",
+
        "hptemp"        => "N",
+
        "lmsens"        => "Y",
+
        "nvidia"        => "Y",
+
        "disk"          => "Y",
+
        "fs"            => "N",
+
        "net"          => "Y",
+
        "serv"          => "N",
+
        "mail"          => "N",
+
        "port"          => "N",
+
        "user"          => "Y",
+
        "apache"        => "N",
+
        "nginx"        => "N",
+
        "int"          => "N",
+
</nowiki>}}
+
 
+
Toggle which of the data gets displayed.
+
 
+
===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 {{ic|/etc/monitorix.conf}}
+
 
+
For example:
+
 
+
{{bc|<nowiki>
+
        "MB0"    => "Mobo Temp",
+
        "CPU0"  => "CPU0 Temp",
+
        "FAN1"  => "CPU0 Fan",
+
        "CORE0"  => "CPU0 Temp",
+
        "CORE1"  => "CPU1 Temp",
+
        "VOLT0"  => "VCore 1",
+
        "VOLT1"  => "VCore 2",
+
        "VOLT2"  => "\\+3.3V",
+
        "VOLT3"  => "\\+5V",
+
        "VOLT4"  => "\\+12V",
+
        "VOLT5"  => "\\-12V",
+
        "VOLT6"  => "\\-5V",
+
        "VOLT7"  => "cpu0_vid",
+
        "GPU0"  => "nvidia",
+
</nowiki>}}
+
 
+
Again, 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 block devices and mount points (optional).
+
 
+
For example:
+
 
+
{{bc|1=
+
our @DISK_LIST = (
+
        "/dev/sda",
+
#      "/dev/sdb",
+
#      "/dev/sdc",
+
);
+
our @FS_LIST = (
+
        "/boot",
+
        "/",
+
        "/data",
+
);
+
}}
+
 
+
===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 ({{ic|/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.
+
 
+
# rc.d start monitorix
+
 
+
{{Note|To have monitorix start at boot, add it to your daemons array in {{ic|/etc/rc.conf}}.}}
+
 
+
==Viewing Monitorix Data==
+
 
+
To view system stats, make sure a webserver is running (see the next section) 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==
+
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!
+
  
 +
==Configure an external webserver==
 
===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 lighttpd.  To enable it and to assign perl to process .cgi files, add the following two lines to {{ic|/etc/lighttpd/lighttpd.conf}}:
+
  
 
  server.modules = ( "mod_cgi" )
 
  server.modules = ( "mod_cgi" )
 
  cgi.assign = ( ".cgi" => "/usr/bin/perl" )
 
  cgi.assign = ( ".cgi" => "/usr/bin/perl" )
 
Start lighttpd like any other daemon:
 
# rc.d start lighttpd
 
 
{{Note|To have lighttpd start at boot, add it to your daemons array in {{ic|/etc/rc.conf}}.}}
 
  
 
===Apache===
 
===Apache===
 +
{{Pkg|apache}} is yet another option.
  
  # pacman -S apache
+
===Nginx===
 +
{{Pkg|nginx}} can be used as a reverse proxy/webserver by adding the following server block the nginx config:
 +
{{bc|
 +
server {
 +
    listen      80;
 +
    server_name your.domain.com;
  
Make sure the hostname appears in {{ic|/etc/hosts}} and in {{ic|/etc/rc.conf}} or apache will not operate.
+
    location / {
 +
      <nowiki>proxy_pass http://127.0.0.1:8080/;</nowiki>
 +
      proxy_buffering off;
 +
    }
  
Start apache like any other daemon:
+
    location ~ ^/monitorix/(.+\.png)$ {
# rc.d start httpd
+
        alias /srv/http/monitorix/$1;
 +
    }
 +
}
 +
}}
  
{{Note|To have apache start at boot, add it to your daemons array in {{ic|/etc/rc.conf}}.}}
+
Also add {{ic|<nowiki>url_prefix_proxy = http://your.domain.com</nowiki>}} to {{ic|/etc/monitorix/monitorix.conf}}.
==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|monitorix-sync-daemon}}
+
==Using tmpfs to Store RRD databases==
 +
{{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.

Latest revision as of 19:16, 14 January 2016

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

Install the package monitorixAUR.

Note: Without a compatible font already installed, the Monitorix graphs will not contain any text. If this happens, install the terminus-font.

Configuration

Edit /etc/monitorix/monitorix.conf to match graphing options and system-specific variables. For a complete list of options and features, see the man page.

Most of the user settings are self explanatory based on the commented text within the configuration file itself.

Monitorix comes with a light, built-in webserver; via the dependency perl-http-server-simple. It is, however, disabled by default. To use it, change the configuration option as follows:

/etc/monitorix/monitorix.conf
....
<httpd_builtin>
  
enabled = y
....

See the configuration file for the other related options, for example accesss restrictions, or #Configure an external webserver.

Start and viewing data

Start monitorix.service and enable it to run at boot like any other systemd service.

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

Tip: If it is the first time running Monitorix, it will take several minutes before data are available to be 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.

Nginx

nginx can be used as a reverse proxy/webserver by adding the following server block the nginx config:

server {
    listen       80;
    server_name  your.domain.com;

    location / {
       proxy_pass http://127.0.0.1:8080/;
       proxy_buffering off;
    }

    location ~ ^/monitorix/(.+\.png)$ {
        alias /srv/http/monitorix/$1;
    }
}

Also add url_prefix_proxy = http://your.domain.com to /etc/monitorix/monitorix.conf.

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.