frame

Sveiki apsilankę!

Jei forume lankaisi pirmą kartą, kviečiame registruotis ir prisijungti prie diskusijų.

Prisijungti Registruotis

Munin sistemos stebėjimo įrankio diegimas Debian 6 aplinkoje

IV_VygandasSIV_VygandasS Serverių ekspertas (-ė)
edited 2013 liepos 19 Į Monitoringas
Šioje trumpoje pamokoje pateikiame instrukcijas kaip įsidiegti munin sistemos stebėjimo įrankį Debian 6 aplinkoje.

1. Munin sistemos stebėjimo įrankio diegimas

1.1. Atnaujiname repozitorijas:
apt-get update

1.2. Įdiegiame munin:
apt-get install munin munin-node munin-plugins-extra

1.3. Įgaliname kelis munin papildynius:
cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/mysql_ mysql_
ln -s /usr/share/munin/plugins/mysql_bytes mysql_bytes
ln -s /usr/share/munin/plugins/mysql_innodb mysql_innodb
ln -s /usr/share/munin/plugins/mysql_isam_space_ mysql_isam_space_
ln -s /usr/share/munin/plugins/mysql_queries mysql_queries
ln -s /usr/share/munin/plugins/mysql_slowqueries mysql_slowqueries
ln -s /usr/share/munin/plugins/mysql_threads mysql_threads

1.4. Redaguojame /etc/munin/munin.conf konfigūracinį failą. Atkomentuojame dbdir, htmldir, logdir, rundir ir tmpldir eilutes, bei pakeičiame localhost.localdomain parametrą į mūsų.serveris.lt .
vi /etc/munin/munin.conf

Pavyzdinis /etc/munin/munin.conf failo turinys:
# Example configuration file for Munin, generated by 'make build'

# The next three variables specifies where the location of the RRD
# databases, the HTML output, logs and the lock/pid files. They all
# must be writable by the user running munin-cron. They are all
# defaulted to the values you see here.
#
dbdir /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir /var/run/munin
#
# Where to look for the HTML templates
tmpldir /etc/munin/templates

# (Exactly one) directory to include all files from.
#
includedir /etc/munin/munin-conf.d

# Make graphs show values per minute instead of per second
#graph_period minute

# Graphics files are normaly generated by munin-graph, no matter if
# the graphs are used or not. You can change this to
# on-demand-graphing by following the instructions in
# http://munin.projects.linpro.no/wiki/CgiHowto
#
#graph_strategy cgi

# munin-cgi-graph is invoked by the web server up to very many times at the
# same time. This is not optimal since it results in high CPU and memory
# consumption to the degree that the system can thrash. Again the default is
# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as
# max_graph_jobs.
#
#munin_cgi_graph_jobs 6

# If the automatic CGI url is wrong for your system override it here:
#
#cgiurl_graph /cgi-bin/munin-cgi-graph

# munin-graph runs in parallel, the number of concurrent processes is
# 6. If you want munin-graph to not be parallel set to 0. If set too
# high it will slow down munin-graph. Some experiments are needed to
# determine how many are optimal on your system. On a multi-core
# system with good SCSI disks the number can probably be quite high.
#
#max_graph_jobs 6

# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
# something changes (OK -> WARNING, CRITICAL -> OK, etc)
#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
#
# For those with Nagios, the following might come in handy. In addition,
# the services must be defined in the Nagios server as well.
#contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf

# a simple host tree
[mūsų.serveris.lt]
address 127.0.0.1
use_node_name yes

#
# A more complex example of a host tree
#
## First our "normal" host.
# [fii.foo.com]
# address foo
#
## Then our other host...
# [fay.foo.com]
# address fay
#
## Then we want totals...
# [foo.com;Totals] #Force it into the "foo.com"-domain...
# update no # Turn off data-fetching for this "host".
#
# # The graph "load1". We want to see the loads of both machines...
# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
# load1.graph_title Loads side by side
# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
#
# # The graph "load2". Now we want them stacked on top of each other.
# load2.graph_title Loads on top of each other
# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
# load2.dummy_field.draw AREA # We want area instead the default LINE2.
# load2.dummy_field.label dummy # This is needed. Silly, really.
#
# # The graph "load3". Now we want them summarised into one field
# load3.graph_title Loads summarised
# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
# load3.combined_loads.label Combined loads # Must be set, as this is
# # not a dummy field!
#
## ...and on a side note, I want them listen in another order (default is
## alphabetically)
#
# # Since [foo.com] would be interpreted as a host in the domain "com", we
# # specify that this is a domain by adding a semicolon.
# [foo.com;]
# node_order Totals fii.foo.com fay.foo.com
#
1.5. Redaguojame /etc/apache2/conf.d/munin failą. Užkomentuojame "Allow from localhost 127.0.0.0/8 ::1" eilutę ir įterpiame eilutę "Allow from all".

Pavyzdinis /etc/munin/munin.conf failo turinys:
Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
Order allow,deny
# Allow from localhost 127.0.0.0/8 ::1
Allow from all
Options None

# This file can be used as a .htaccess file, or a part of your apache
# config file.
#
# For the .htaccess file option to work the munin www directory
# (/var/cache/munin/www) must have "AllowOverride all" or something
# close to that set.
#

# AuthUserFile /etc/munin/munin-htpasswd
# AuthName "Munin"
# AuthType Basic
# require valid-user

# This next part requires mod_expires to be enabled.
#

# Set the default expiration time for files to 5 minutes 10 seconds from
# their creation (modification) time. There are probably new files by
# that time.
#

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault M310
</IfModule>

</Directory>
1.6. Perkrauname Apache tarnybą:
/etc/init.d/apache2 restart

1.7. Perkrauname munin tarnybą:
/etc/init.d/munin-node restart

Rezultatas:

Apsilankius [url]http://mūsų.domenas.lt/munin/[/url] adresu ir palaukus kelias minutes pradėsime matyti stebėjimo sistemos atvaiduojamą statistiką, munin pateikiamuose grafikuose.
attachment.php?attachmentid=24&stc=1&d=1374235710

2. Munin išvesties katalogo apsaugojimas slaptažodžiu

2.1. Siekiant, kad mūsų munin generuojamus duomenis peržiūrėti galėtų tik autorizuoti asmenys, apribosime prieigą prie statistinių duomenų nurodant slaptažodį:
htpasswd -c /etc/munin/munin-htpasswd admin

Įvedame pasirinkta admin vartotojo slaptažodį - naudojant šiuos duomenis mes galėsime prisijungti prie mūsų munin prieigos.

2.2. Atsidarome /etc/apache2/conf.d/munin failą ir atkomentuojame žemiau pateiktas eilutes:
[...]
        AuthUserFile /etc/munin/munin-htpasswd
        AuthName "Munin"
        AuthType Basic
        require valid-user
[...]

2.3. Perkrauname Apache tarnybą:
/etc/init.d/apache2 restart

Rezultatas:
Bandant apsilankyti prieš tai mūsų nurodytu adresu [url]http://mūsų.domenas.lt/munin/[/url] norint prisijungti reikės nurodyti 2.1. punkte nurodytais prisijungimo duomenimis:

User Name: admin
Password: <Mūsų_2.1_punkte_įvestas_slaptažodis>
Norėdami palikti komentarą, turite prisijungti arba registruokis.