Munin

From ArchWiki
Revision as of 21:15, 31 October 2009 by Timetrap (talk | contribs)
Jump to: navigation, search

Installing Munin

What is Munin?

"Munin the monitoring tool surveys all your computers and remembers what it saw. It presents all the information in graphs through a web interface. Its emphasis is on plug and play capabilities. After completing a installation a high number of monitoring plugins will be playing with no more effort.

Using Munin you can easily monitor the performance of your computers, networks, SANs, applications, weather measurements and whatever comes to mind. It makes it easy to determine "what's different today" when a performance problem crops up. It makes it easy to see how you're doing capacity-wise on any resources.

Munin uses the excellent RRDTool (written by Tobi Oetiker) and the framework is written in Perl, while plugins may be written in any language. Munin has a master/node architecture in which the master connects to all the nodes at regular intervals and asks them for data. It then stores the data in RRD files, and (if needed) updates the graphs. One of the main goals has been ease of creating new plugins (graphs). "[1]

Munin allows you to make pretty graphs about a systems statistics. You like pretty graphs, right?

Like to see a running example?

Initial Notes

The following guide sets up a munin under a directory beneath the html root.

If anyone would like to add a vhost setup guide please feel free to add it.

Apache Notes

See Fastcgi_and_lighttpd for more details.

The html root is located under /srv/http. This directory may not be created by default, so create it if not.

 #mkdir -p /srv/http

apache also creates (or uses) the user account and group of http:http.

 #chown http:http /srv/http

All of these settings can be changed in the file

 /etc/httpd/conf/httpd.conf

Munin Notes

Munin relies is built using a client-server model. The client is munin-node, and the server is munin (refered to "munin-master" in all documentation). You MUST have munin-node and munin-master installed for this installation to work.

You will only need to install munin-master on a single machine. But munin-node will need to be installed on all machines you wish to monitor. This page will focus on a single machine installation. Further documentation may be found on the munin documentation wiki.

Installing lighttp

PHP, lighttp, and fastcgi

Install PHP Fastcgi and lighttpd

 #pacman -S lighttpd fcgi php

Add an entry to your rc.conf

 DAEMONS=(syslog-ng network netfs crond lighttpd)

Edit your /etc/hosts.allow (by adding the following line)

 lighttpd:    ALL

Start your webserver (sanity check)

 #/etc/rc.d/lighttpd start

Create a test document

 #echo "Testing lighttpd" > /srv/http/index.html

Open a web browser to http://127.0.0.1/, and you should see the test document.

If it didn't work try (and check again):

chown -R http:http /var/run/lighttpd/

Stop the webserver

 #/etc/rc.d/lighttpd stop

Configuration

Uncomment these lines in /etc/lighttpd/lighttpd.conf

"mod_fastcgi"
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/var/run/lighttpd/php-fastcgi.socket",
                                   "bin-path" => "/usr/bin/php-cgi"
                                 )
                               )
                            )

Installing DokuWiki

Downloading the Latest Version

Go to the DokuWiki download site and get the latest version

 #mv dokuwiki*.tar.gz /srv/http
 #cd /srv/http
 #tar zxf dokuwiki*.tar.gz
 #mv dokuwiki-DATE dokuwiki

Preparing the Installation Files

chown the DokuWiki files

 #chown -R http:http dokuwiki/

(http is the default user for lighttp, if you changed this, change the user:group to the lighttp user:group)

DokuWiki Specific lighttp Configuration

Edit the /etc/lighttpd/lighttpd.conf file

Under the line:

 
$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

add this:

# subdir of dokuwiki
# comprised of the subdir of the root dir where dokuwiki is installed
# in this case the root dir is the basedir plus /htdocs/
# Note: be careful with trailing slashes when uniting strings.
# all content on this example server is served from htdocs/ up.
#var.dokudir = var.basedir + "/dokuwiki"
var.dokudir = server.document-root + "/dokuwiki"

# make sure those are always served through fastcgi and never as static files
# deny access completly to these
$HTTP["url"] =~ "/\.ht" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "/_ht" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/bin/"  { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/data/" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/inc/"  { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/conf/" { url.access-deny = ( "" ) }

These entries give some basic security to dokuwiki. lighttpd does not use .htaccess files like apache. You CAN install with out this, but I would NEVER recommend it.

For further (possibly updated) configuration, please see the DokuWiki lighttpd install guide

Restart lighttp

Start your webserver

 #/etc/rc.d/lighttpd start

Install DokuWiki

Open a webbrowser to

 http://127.0.0.1/dokuwiki/install.php

Post Installation

Cleaning Up

After configuring the server remove the install.php file!

 #rm /srv/http/dokuwiki/install.php

Installing Plugins

Many community created plugins can be found here

They can be added through the web interface (as well as updated) through the Admin menu.

Backing Up

It is very trivial to backup DokuWiki, since there is no database. All pages are in plain text, and require only a simple tar, or rsync.

A quick breakdown of the directories of interest in the current (2008-05-05) version:

 /dokuwiki/data/  =>  All User Created Data
 /dokuwiki/lib/plugins/  =>  All User Added Plugins

Further Reading

The DokuWiki main site has all of the information and help that you could possibly need.