wiki:munin-man

Munin

TOC?

This page is way old and needs to be split up into separate pages. If you feel inspired please look at the Documentation index.

Background

Munin is a server/node pair that graph, htmlifies and optionally warns nagios about data it gathers. It's designed to let it be very easy to graph new datasources.

The Node

Munin-node is a small perl script listening to port 4949 using Net::Server. It reads all the scripts in /etc/munin/plugins on startup. The node accepts these commands:

Protocol commandDescription
list [node] list available scripts for this node
nodes list available nodes
config [script] output configuration for [script]
fetch [script] output script values
version output version string
quit disconnect

Scripts

These scripts can be in your language of choice: bash, perl, python, C, or anything else that your system can execute. The scripts can be run in several modes, the important ones being without parameters, and with the "config"-parameter. When run with "config" as parameter, the script should output the configuration of the graph.

jo@yes:~$ munin-run load config
graph_title Load average
graph_args --base 1000 -l 0
graph_vlabel load
graph_scale no
load.label load
load.warning 10
load.critical 120

See protocol config page for complete list of global and datasource-specific attributes used in plugins.

{name} is limited to 19 characters, and the characters [a-zA-Z0-9_].

Without options the script should only give out {name}.value (value):

jo@yes:~$ munin-run load
load.value 0.41

All script names containing other characters than alphanumerics, "-", "_", and ".", or starting with "." will be skipped.

Plugins may be configured to run as a specific user and/or group, along with other parameters that affect how the plugin is run. Read the plugin configuration documentation for details.

File locations

According to FHS, this is where you should place the files. System package (Debian, RedHat?, maybe others)

CONFDIR/etc/munin/
SBINDIR/usr/sbin/
LIBDIR /usr/share/munin/
STATEDIR/var/run/munin/
LOGDIR/var/log/munin/

Independent install (tarball)

CONFDIR/etc/opt/munin/
BINDIR /opt/munin/sbin/
LIBDIR /opt/munin/lib/
STATEDIR/var/run/munin/
LOGDIR/var/log/munin/

The Server

The server runs a cronjob as the user munin every 5 minutes. The cronjob runs munin-update, munin-nagios, munin-graph and munin-html one by one. All scripts creates a lockfile in @@STATEDIR@@. Everytime a script starts, it checks if the pid in the lockfile is alive before starting.

munin.conf

See munin.conf for syntax and options.

munin-update

Munin-update reads /etc/munin/munin.conf, searches for nodes, and connect to the munin-nodes using the address field. When connected it will run the list command to fetch available scripts, then it will run config for each script. This configuration will expand in the /etc/munin/munin.conf file and rdd databases will be created. Already expanded configuration will be skipped. Then munin-update? runs through its newly modified configuration file and runs fetch on all scripts.

munin-graph

Munin-graph reads /etc/munin/munin.conf and graphs all services unless [service].graph no. The following options are available in the configuration limited to 19 characters

[service].graph_titleThe title of the graph
[service].graph_orderWhich order to graph the lines.
[service].graph_argsExtra arguments to the graph
[field].labelREQUIRED, the name of the value to be graphed,
[field].typeType of value. COUNTER, GAUGE, defaults to GAUGE. NOTE: When GAUGE is used, only "snapshots" of every 5 minutes are recorded. Peaks in-between updates will not be graphed. When you use COUNTER, the numbers are averaged out over the past 5 minutes, so short peaks will show up as substantially lower than they were.

munin-html

Munin-html creates the html-pages for the graphs. Useful configuration in the server.conf file is:

node_order [node1] [node2] ....In which order the nodes should be listed, defaults to sorted. This is a domain-level option.
domain_order [domain1] [domain2] .... In which order the domains should be listed, defaults to sorted. This is a top-level option.
munin-nagiosMunin-nagios is a optional script to send a passive alert to a nagios-server.

For the munin-nagios connection to work, you need a nagios-nsca server, a working send_nsca configuration and the following configuration in /etc/munin/munin.conf:

nsca          /usr/bin/send_nsca
nsca_config   /etc/nagios/send_nsca.cfg
nsca_server   [nsca-server] 

Then add .warning and .critical fields in your configuration or directly into you plugin scripts. The value for these field can be a single maxvalue or a colon-separated range

processes.warning 10:300
processes.critical 5:500

A value lower than 10 or higher then 300 will result in a warning to nagios, a value lower than 5 or higher than 500 will result in a critical to nagios

Other useful ranges:

[service].warning :400

is equal to:

[service].warning 400

Only warn if lower than 300:

[service].warning 300:

When a service contains .critical or .warning it will check it's status against the last fetched value. If it's ok, a "{service}.ok" file will be created in the $dbdir/$domain directory. If the value is not ok. This file will be removed and munin-nagios will update nagios every 5 minutes untill the value is ok and a new ".ok" file will be created.

File locations

According to FHS, this is where you should place the files.

System package (Debian, RedHat?, maybe others)

CONFDIR/etc/munin/
SBINDIR/usr/sbin/
LIBDIR /usr/share/munin/
STATEDIR/var/run/munin/
LOGDIR /var/log/munin/
DBDIR /var/lib/munin/

Independent install (tarball)

CONFDIR/etc/opt/munin/
SBINDIR/opt/munin/sbin/
LIBDIR/opt/munin/lib/
STATEDIR/var/run/munin/
LOGDIR/var/log/munin/
DBDIR/var/opt/munin/
Last modified at 2016-10-21T16:06:14+02:00 Last modified on 2016-10-21T16:06:14+02:00