### Build and Install Munin from Source Source: https://github.com/munin-monitoring/munin/blob/master/INSTALL.rst After installing build requirements, run these commands to compile, test, and install Munin. Execute as root or use sudo for the install step. ```bash make make test # run as root or use something like "sudo" make install ``` -------------------------------- ### Build and Install All Munin Components from Source Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Compile and install all Munin components, including master and documentation, when building from source. ```bash make make install ``` -------------------------------- ### Build and Install Munin Node Components from Source Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Compile and install the common parts, node, and plugins for a Munin node when building from source. ```bash make make install-common-prime install-node-prime install-plugins-prime ``` -------------------------------- ### Example munin-node.conf Configuration Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/munin-node.conf.md A comprehensive example of a typical munin-node.conf file, demonstrating various directives for logging, process management, security, and network binding. ```default # # Example config-file for munin-node # log_level 4 log_file /var/log/munin-node/munin-node.log pid_file /var/run/munin/munin-node.pid background 1 setsid 1 user root group root # This is the timeout for the whole transaction. # Units are in sec. Default is 15 min # # global_timeout 900 # This is the timeout for each plugin. # Units are in sec. Default is 1 min # # timeout 60 # Regexps for files to ignore ignore_file [\#~]$ ignore_file DEADJOE$ ignore_file \.bak$ ignore_file %$ ignore_file \.dpkg-(tmp|new|old|dist)$ ignore_file \.rpm(save|new)$ ignore_file \.pod$ # Set this if the client doesn't report the correct hostname when # telnetting to localhost, port 4949 # host_name localhost.localdomain # A list of addresses that are allowed to connect. This must be a # regular expression, since Net::Server does not understand CIDR-style # network notation unless the perl module Net::CIDR is installed. You # may repeat the allow line as many times as you'd like allow ^127\.0\.0\.1$ allow ^::1$ # If you have installed the Net::CIDR perl module, you can use one or more # cidr_allow and cidr_deny address/mask patterns. A connecting client must # match any cidr_allow, and not match any cidr_deny. Note that a netmask # *must* be provided, even if it's /32 # # Example: # # cidr_allow 127.0.0.1/32 # cidr_allow 192.0.2.0/24 # cidr_deny 192.0.2.42/32 # Which address to bind to; host * # host 127.0.0.1 # And which port port 4949 # if only ipv4 is working, uncomment this line # ipv 4 ``` -------------------------------- ### Example Plugin Configuration with Group and Environment Variable Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/plugins/plugin-concise.md A comprehensive example demonstrating how to set both the group and an environment variable for a plugin, useful when the plugin needs specific file access and configuration. ```default [example] group adm env.logfile /var/log/example.log ``` -------------------------------- ### Start Munin HTTPD Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/environment.md Start the Munin HTTPD service, which listens on http://localhost:4948/ by default. ```bash dev_scripts/run munin-httpd ``` -------------------------------- ### Install Munin Master on Debian/Ubuntu Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Install the main munin package on the server designated as the Munin master. ```bash sudo apt-get install munin ``` -------------------------------- ### Munin Plugin Output Example with munin-run Source: https://github.com/munin-monitoring/munin/blob/master/doc/plugin/use.md Example of running a plugin (`df_abs`) with `munin-run` and its corresponding output, including configuration details and data values. ```default # munin-run df_abs config graph_title Filesystem usage (in bytes) graph_args --base 1024 --lower-limit 0 graph_vlabel bytes graph_category disk graph_total Total _dev_mapper_vg_demo_lv_root__.label / _dev_mapper_vg_demo_lv_root__.cdef _dev_mapper_vg_demo_lv_root__,1024,* tmpfs__dev_shm.label /dev/shm tmpfs__dev_shm.cdef tmpfs__dev_shm,1024,* _dev_vda1__boot.label /boot _dev_vda1__boot.cdef _dev_vda1__boot,1024,* _dev_mapper_vg_demo_lv_tmp__tmp.label /tmp _dev_mapper_vg_demo_lv_tmp__tmp.cdef _dev_mapper_vg_demo_lv_tmp__tmp,1024,* _dev_mapper_vg_demo_lv_var__var.label /var _dev_mapper_vg_demo_lv_var__var.cdef _dev_mapper_vg_demo_lv_var__var,1024,* # munin-run -d df_abs # Processing plugin configuration from /etc/munin/plugin-conf.d/df # Processing plugin configuration from /etc/munin/plugin-conf.d/fw_ # Processing plugin configuration from /etc/munin/plugin-conf.d/hddtemp_smartctl # Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node # Processing plugin configuration from /etc/munin/plugin-conf.d/postfix # Processing plugin configuration from /etc/munin/plugin-conf.d/sendmail # Setting /rgid/ruid/ to /99/99/ # Setting /egid/euid/ to /99 99/99/ # Setting up environment # Environment exclude = none unknown iso9660 squashfs udf romfs ramfs debugfs binfmt_misc rpc_pipefs fuse.gvfs-fuse-daemon # About to run '/etc/munin/plugins/df_abs' _dev_mapper_vg_demo_lv_root__.value 1314076 tmpfs__dev_shm.value 0 _dev_vda1__boot.value 160647 _dev_mapper_vg_demo_lv_tmp__tmp.value 34100 _dev_mapper_vg_demo_lv_var__var.value 897644 ``` -------------------------------- ### Install Munin Node and Master Source: https://context7.com/munin-monitoring/munin/llms.txt Commands to install Munin node and master packages on Debian/Ubuntu, RedHat/CentOS/Fedora, and FreeBSD. Also includes source installation steps. ```bash # On every monitored host sudo apt-get install munin-node # On the master (collector + web interface) sudo apt-get install munin # RedHat / CentOS / Fedora sudo yum install munin-node # on nodes sudo yum install munin # on master # FreeBSD (binary) pkg install munin-node pkg install munin-master # From source (for development) git clone git://github.com/munin-monitoring/munin cd munin make make install-common-prime install-node-prime install-plugins-prime # node only make install # master (all) ``` -------------------------------- ### Wildcard Plugin Suggestion Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/plugins/plugin-concise.md Demonstrates how a wildcard plugin, when invoked with 'suggest', should output a list of configurable items. ```shell # ./if_ suggest eth0 eth1 ``` -------------------------------- ### Install Munin Master and Node using pkg on FreeBSD Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Install Munin master and node packages directly using the pkg command on FreeBSD. ```bash pkg install munin-master pkg install munin-node ``` -------------------------------- ### Install Munin Master and Node from FreeBSD Ports Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Use these commands to install Munin master and node from source on FreeBSD systems. ```bash cd /usr/ports/sysutils/munin-master && make install clean cd /usr/ports/sysutils/munin-node && make install clean ``` -------------------------------- ### Start Munin Node in Sandbox Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/environment.md Start a Munin node in the background within the sandbox environment and tail its log output. ```bash dev_scripts/start_munin-node ``` -------------------------------- ### Munin Node 'fetch' Command Example (Simple) Source: https://github.com/munin-monitoring/munin/blob/master/doc/master/network-protocol.md Illustrates fetching the current value for the 'load' plugin, showing the expected output format. ```text > fetch load < load.value 0.42 < . ``` -------------------------------- ### Munin Autoconfigure Command Example Source: https://context7.com/munin-monitoring/munin/llms.txt Demonstrates how to use `munin-node-configure` to automatically link plugins based on autoconf and suggest markers. ```bash # munin-node-configure will now find and link this plugin automatically: munin-node-configure --shell --families=auto | sh -x # + ln -s /usr/share/munin/plugins/if_ /etc/munin/plugins/if_eth0 # + ln -s /usr/share/munin/plugins/if_ /etc/munin/plugins/if_eth1 ``` -------------------------------- ### Munin Node 'fetch' Command Example (Complex) Source: https://github.com/munin-monitoring/munin/blob/master/doc/master/network-protocol.md Demonstrates fetching multiple values for the 'memory' plugin, including labels and their corresponding values. ```text > fetch memory < used.value 98422784 < shared.value 1058086912 < buffers.value 2912256 < cache.value 8593408 < free.value 235753472 < swap.value 85053440 < . ``` -------------------------------- ### Install Munin Node on Debian/Ubuntu Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Install the munin-node package on machines that will be monitored by Munin. ```bash sudo apt-get install munin-node ``` -------------------------------- ### Install Munin Master on RedHat/CentOS/Fedora Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Install the munin package on the master server, assuming EPEL repository is enabled. ```bash sudo yum install munin ``` -------------------------------- ### Example munin-node Configuration Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/munin-node.md This is an example configuration file for the munin-node daemon. It specifies settings such as hostname, log level, file paths, network binding, and allowed client CIDRs. ```shell # /etc/munin/munin-node.conf - config-file for munin-node host_name random.example.org log_level 4 log_file /var/log/munin/munin-node.log pid_file /var/run/munin/munin-node.pid background 1 setsid 1 # Which port to bind to; host [::] port 4949 user root group root # Regexps for files to ignore ignore_file ~$ ignore_file \.bak$ ignore_file %$ ignore_file \.dpkg-(tmp|new|old|dist)$ ignore_file \.rpm(save|new)$ ignore_file \.puppet-bak$ # Hosts to allow cidr_allow 127.0.0.0/8 cidr_allow 192.0.2.129/32 ``` -------------------------------- ### Service FQN Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/fqn.md Demonstrates the structure of a service FQN, which extends a node FQN by appending a colon and the service name. ```text acme;webservers;www1.example.net:https_requests ---- ---------- ---------------- -------------- | | | | | | | `--- service "https_requests" | | `-------------------- node "www1.example.net" | `------------------------------- group "webservers" `------------------------------------ group "acme" ``` -------------------------------- ### Munin Master Configuration (`munin.conf`) Source: https://context7.com/munin-monitoring/munin/llms.txt Example configuration for `/etc/munin/munin.conf`, defining global settings, alerting contacts, and monitored nodes. Includes examples for direct node addresses, SSH tunnels, and virtual aggregate nodes. ```ini # /etc/munin/munin.conf # --- Global directives --- dbdir /var/lib/munin # RRD storage htmldir /var/cache/munin/www # Generated HTML + graphs logdir /var/log/munin rundir /var/run/munin tmpldir /etc/munin/templates # Parallelism max_processes 16 max_graph_jobs 6 # Graph rendering: "cron" pre-generates all graphs; "cgi" renders on demand graph_strategy cron html_strategy cron # RRD data retention: "normal" (default) | "huge" | "custom" graph_data_size normal # Enable lazy-loading of graph images in HTML (available since 2.1) # html_dynamic_images 1 # Use rrdcached to reduce I/O # rrdcached_socket /var/run/rrdcached.sock # --- Alerting contact --- contact.email.command mail -s "Munin alert" ops@example.com contact.email.always_send critical warning # --- Three monitored nodes --- [mail.example.com] address mail.example.com [web.example.com] address web.example.com [munin.example.com] address localhost # --- Node via SSH tunnel --- [remote.site2.example.org] address ssh://bastion.site2.example.org/bin/nc remote.site2.example.org 4949 # --- Virtual aggregate node (no real polling, borrows data) --- [example.com;Totals] update no load.graph_title Total load across all servers load.sum_load.label load load.sum_load.stack mail=mail.example.com web=web.example.com munin=munin.example.com # --- Per-node plugin threshold overrides --- [web.example.com] address web.example.com load.load.warning 5 load.load.critical 20 ``` -------------------------------- ### Multigraph Plugin Example Source: https://context7.com/munin-monitoring/munin/llms.txt This is a placeholder for a multigraph plugin example, which allows emitting multiple named graphs from a single plugin execution. This is efficient for monitoring many similar items, such as network interfaces on a switch. ```bash # Multigraph plugin: reports bytes + errors for each network interface ``` -------------------------------- ### Example Plugin Names Source: https://github.com/munin-monitoring/munin/blob/master/doc/example/graph/aggregate.md Illustrates the naming convention for Munin plugins, particularly when using symlinks for host and monitored aspect. ```text snmp_ups_ups-5a_current snmp_ups_ups-5b_current snmp_ups_ups-5a_power snmp_ups_ups-5b_power ``` -------------------------------- ### Example Shell Plugin Source: https://github.com/munin-monitoring/munin/blob/master/doc/plugin/writing.md A complete example of a Munin plugin written in shell script. It includes functions for outputting configuration and values, and a basic argument parser. ```bash #!/bin/sh output_config() { echo "graph_title Example graph" echo "plugins.label Number of plugins" } output_values() { printf "plugins.value %d\n" $(number_of_plugins) } number_of_plugins() { find /etc/munin/plugins -type l | wc -l } output_usage() { printf >&2 "%s - munin plugin to graph an example value\n" ${0##*/} printf >&2 "Usage: %s [config]\n" ${0##*/} } case $# in 0) output_values ;; 1) case $1 in config) output_config ;; *) output_usage exit 1 ;; esac ;; *) output_usage exit 1 ;; esac ``` -------------------------------- ### Node FQN Examples Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/fqn.md Shows how a node FQN is formed by combining a group FQN with a hostname, separated by a semicolon. ```text example.com;foo.example.com ----------- | | | `--- node "foo.example.com" `--------------- group "example.com" ``` ```text acme;webservers;www1.example.net ---- ---------- ---------------- | | | | | `-------------- node "www1.example.net" | `------------------------- group "webservers" `------------------------------ group "acme" ``` -------------------------------- ### Install Wildcard Plugin Source: https://github.com/munin-monitoring/munin/blob/master/doc/tutorial/wildcard-plugins.md Move the new wildcard plugin to the system-wide plugin directory. ```default # mv /tmp/smart_ /usr/share/munin/plugins/smart_ ``` -------------------------------- ### Munin Node 'fetch' Command Example (Time Series) Source: https://github.com/munin-monitoring/munin/blob/master/doc/master/network-protocol.md Shows fetching time-series data for the 'load_1sec' plugin, including timestamps and values. ```text > fetch load_1sec < load.value 2148659:0.42 < load.value 2148660:0.23 < load.value 2148661:0.12 ``` -------------------------------- ### Plugin autoconf response: yes Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/plugins/plugin-concise.md Example of a plugin responding 'yes' to the 'autoconf' argument, indicating it can be useful on the host. ```default # ./load autoconf yes ``` -------------------------------- ### Start rrdcached Instance Source: https://github.com/munin-monitoring/munin/blob/master/doc/master/rrdcached.md This command starts an rrdcached instance. Use the -g flag for testing to keep it in the foreground. Ensure the 'munin' user owns the journal directory. ```bash sudo -u munin /usr/bin/rrdcached \ -p /run/munin/rrdcached.pid \ -B -b /var/lib/munin/ \ -F -j /var/lib/munin/rrdcached-journal/ \ -m 0660 -l unix:/run/munin/rrdcached.sock \ -w 1800 -z 1800 -f 3600 ``` -------------------------------- ### Upstart Configuration for rrdcached Source: https://github.com/munin-monitoring/munin/blob/master/doc/example/rrdcached/upstart.md This configuration sets up a dedicated rrdcached instance for Munin, ensuring it restarts if it stops. It includes scripts to create necessary directories before starting and to grant permissions to the Munin fastcgi process after starting. ```default description "munin instance of rrdcached" author "Stig Sandbeck Mathisen " start on filesystem stop on runlevel [!2345] # respawn umask 022 pre-start script install -d -o munin -g munin -m 0755 /var/lib/munin/rrdcached-journal install -d -o munin -g munin -m 0755 /run/munin end script script start-stop-daemon \ --start \ --chuid munin \ --exec /usr/bin/rrdcached \ --pidfile /run/munin/rrdcached.pid \ -- \ -g \ -p /run/munin/rrdcached.pid \ -B -b /var/lib/munin/ \ -F -j /var/lib/munin/rrdcached-journal/ \ -m 0660 -l unix:/run/munin/rrdcached.sock \ -w 1800 -z 1800 -f 3600 end script post-start script sleep 1 setfacl -m u:www-data:rw /run/munin/rrdcached.sock end script ``` -------------------------------- ### Example Alert Message Format Source: https://github.com/munin-monitoring/munin/blob/master/doc/tutorial/alert.md This is an example of the alert message format that Munin might pipe to an external script. It includes host, plugin, and critical status details. ```text localhost :: localdomain :: Inode table usage CRITICALs: open inodes is 32046.00 (outside range [:6]). ``` -------------------------------- ### Munin RRD Tree Symlink Structure Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/example/tips/multimaster.md This example demonstrates how to set up symbolic links for RRD directories across multiple update masters and a central HTML master to share a common RRD storage. This avoids duplicating RRD files and keeps them synchronized via shared NFS. ```default /nfs/munin/db/shared-rrd/customer1/ /nfs/munin/db/shared-rrd/customer2/ /nfs/munin/db/shared-rrd/customer3/ /nfs/munin/db/shared-rrd/customer4/ /nfs/munin/db/update1/customer1 -> ../shared-rrd/customer1 /nfs/munin/db/update1/customer2 -> ../shared-rrd/customer2 /nfs/munin/db/update1/customer3 -> ../shared-rrd/customer3 /nfs/munin/db/update1/customer4 -> ../shared-rrd/customer4 /nfs/munin/db/update2/customer1 -> ../shared-rrd/customer1 /nfs/munin/db/update2/customer2 -> ../shared-rrd/customer2 /nfs/munin/db/update2/customer3 -> ../shared-rrd/customer3 /nfs/munin/db/update2/customer4 -> ../shared-rrd/customer4 /nfs/munin/db/html/customer1 -> ../shared-rrd/customer1 /nfs/munin/db/html/customer2 -> ../shared-rrd/customer2 /nfs/munin/db/html/customer3 -> ../shared-rrd/customer3 /nfs/munin/db/html/customer4 -> ../shared-rrd/customer4 ``` -------------------------------- ### Data Source FQN Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/fqn.md Illustrates the complete FQN for a data source, formed by appending a dot and the data source name to a service FQN. ```text acme;webservers;www1.example.net:https_requests.denied ---- ---------- ---------------- -------------- ------ | | | | | | | | | `--- data source "denied" | | | `------------------ service "https_requests" | | `----------------------------------- node "www1.example.net" | `---------------------------------------------- group "webservers" `--------------------------------------------------- group "acme" ``` -------------------------------- ### Start Interactive Munin Node Session with Spool Fetch Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/munin-async.md Starts an interactive munin node session, enabling the 'spoolfetch' command. This configuration reads from the spool directory instead of connecting to a local munin node. ```bash munin-async --spoolfetch ``` -------------------------------- ### NSCA Configuration File Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/tutorial/nagios.md Define NSCA behavior in nsca.cfg. Key directives include nsca_user and command_file, which must match Nagios configuration. ```default nsca_user=nagios command_file=/var/run/nagios/nagios.cmd ``` -------------------------------- ### Plugin autoconf response: no with reason Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/plugins/plugin-concise.md Example of a plugin responding 'no' to the 'autoconf' argument, providing a reason for its inutility. This helps users troubleshoot. ```default # ./load autoconf no (No /proc/loadavg) ``` -------------------------------- ### Multigraph Hierarchy Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/plugin/multigraphing.md Illustrates the hierarchical structure of multigraph definitions using dot notation. This shows how root graphs are extended for individual devices. ```munin multigraph if_bytes multigraph if_bytes.if_1 multigraph if_bytes.if_2 ... multigraph if_errors multigraph if_errors.if_1 multigraph if_errors.if_2 ... ``` -------------------------------- ### Install Munin in Sandbox Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/environment.md Install Munin into a sandbox environment and disable taint mode for development scripts. ```bash dev_scripts/install node dev_scripts/disable_taint ``` -------------------------------- ### Install Munin Node on Debian Source: https://github.com/munin-monitoring/munin/blob/master/doc/tutorial/getting-started.md Installs the Munin node package and its default plugins. This command is suitable for Debian and Ubuntu systems. After installation, you will need to configure `munin-node.conf` to allow network access and authorize the master's IP address. ```bash $ apt-get install munin-node ``` -------------------------------- ### Run Munin Plugin Interactively (Config) Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/plugins/plugin-concise.md Demonstrates how to use the `munin-run` command to fetch the configuration details of a plugin, showing its output format and parameters. ```default ssm@mavis:~$ munin-run load config graph_title Load average graph_args --base 1000 -l 0 graph_vlabel load graph_scale no graph_category system load.label load load.warning 10 load.critical 120 graph_info The load average of the machine describes how many processes \ are in the run-queue (scheduled to run "immediately"). load.info Average load for the five minutes. ``` -------------------------------- ### Install Munin Node on RedHat/CentOS/Fedora Source: https://github.com/munin-monitoring/munin/blob/master/doc/installation/install.md Install the munin-node package on machines to be monitored, ensuring EPEL repository is enabled. ```bash sudo yum install munin-node ``` -------------------------------- ### Install CPAN Perl Dependencies Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/environment.md Install Munin's Perl dependencies using the Build.PL script and CPAN modules. ```bash perl Build.PL ./Build installdeps ``` -------------------------------- ### Download and Enable a Plugin Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/munin-get.md Use this sequence to update the plugin list, install a specific plugin like 'traffic', and then enable it. Remember to restart the munin-node service for changes to take effect. ```bash munin-get update munin-get install traffic munin-get enable traffic service munin-node restart # for systemd: systemctl restart munin-node ``` -------------------------------- ### Install Debian Perl Dependencies Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/environment.md Install the necessary Perl modules for running Munin from a development environment on Debian-based systems. ```bash apt install libdbd-sqlite3-perl libdbi-perl \ libfile-copy-recursive-perl libhtml-template-perl \ libhtml-template-pro-perl libhttp-server-simple-perl \ libio-socket-inet6-perl liblist-moreutils-perl \ liblog-dispatch-perl libmodule-build-perl libnet-server-perl \ libnet-server-perl libnet-snmp-perl librrds-perl \ libnet-ssleay-perl libparams-validate-perl liburi-perl \ libwww-perl libxml-dumper-perl ``` -------------------------------- ### Munin Node 'config' Command Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/master/network-protocol.md Shows the output of the 'config' command for 'load' and 'memory' plugins, detailing graph arguments, labels, and drawing styles. ```text > config load < graph_args --title "Load average" < load.label Load < . > config memory < graph_args --title "Memory usage" --base 1024 < used.label Used < used.draw AREA < shared.label Shared < shared.draw STACK < buffers.label Buffers < buffers.draw STACK < cache.label Cache < cache.draw STACK < free.label Free < free.draw STACK < swap.label Swap < swap.draw STACK ``` -------------------------------- ### Munin Plugin Data Fetch Example (df) Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/plugin.md This snippet demonstrates the data output for the 'df' plugin when run without arguments, providing the current value for a specific device. ```shell # munin-run df _dev_hda1.value 83 ``` -------------------------------- ### Install Debian Test Perl Dependencies Source: https://github.com/munin-monitoring/munin/blob/master/doc/develop/environment.md Install Perl modules required for running Munin's development tests on Debian-based systems. ```bash apt install libdbd-pg-perl libfile-readbackwards-perl \ libfile-slurp-perl libio-stringy-perl libnet-dns-perl \ libnet-ip-perl libtest-deep-perl libtest-differences-perl \ libtest-longstring-perl libtest-mockmodule-perl \ libtest-mockobject-perl libtest-perl-critic-perl \ libxml-libxml-perl libxml-parser-perl ``` -------------------------------- ### Rescan for Installed Plugin and Generate Symlinks Source: https://github.com/munin-monitoring/munin/blob/master/doc/tutorial/wildcard-plugins.md After installing a new wildcard plugin, run this command again to generate the necessary symlink commands for your munin-node configuration. ```default # munin-node-configure --shell ln -s /usr/share/munin/plugins/smart_ /etc/munin/plugins/smart_hda ln -s /usr/share/munin/plugins/smart_ /etc/munin/plugins/smart_hdc ``` -------------------------------- ### Munin Plugin Configuration Example (df) Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/plugin.md This snippet shows the configuration output for the 'df' plugin when run with the 'config' argument. It defines graph properties and dataset labels. ```shell # munin-run df config graph_title Filesystem usage (in %) graph_args --upper-limit 100 -l 0 graph_vlabel % graph_category disk graph_info This graph shows disk usage on the machine. _dev_hda1.label / _dev_hda1.info / (ext3) -> /dev/hda1 _dev_hda1.warning 92 _dev_hda1.critical 98 ``` -------------------------------- ### Munin Plugin Configuration Example Source: https://context7.com/munin-monitoring/munin/llms.txt This configuration snippet sets up basic parameters for a Munin plugin, defining labels, types, and minimum values for user and system metrics. ```munin update_rate 1 user.label user user.type DERIVE user.min 0 system.label system system.type DERIVE system.min 0 ``` -------------------------------- ### Add and List Plugins from a Custom Repository Source: https://github.com/munin-monitoring/munin/blob/master/doc/reference/munin-get.md This demonstrates how to add a new external repository named 'foo' pointing to a Git URL, update the plugin index, and then list available plugins. ```bash munin-get add-repository foo http://example.org/foo.git munin-get update munin-get list ``` -------------------------------- ### RRDtool Graphing Error Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/plugin/multigraphing.md This example illustrates the error messages generated by rrdtool when a multigraph configuration is incorrect, specifically when a sub-graph name conflicts with a field name. ```log [RRD ERROR] Unable to graph /var/cache/munin/www/host/base-day.png : opening '/var/lib/munin/host/base-sub-g.rrd': No such file or directory [RRD ERROR] rrdtool 'graph' '/var/cache/munin/www/host/base-day.png' \ ... 'DEF:gfield1=/var/lib/munin/host/base-field1-g.rrd:42:AVERAGE' \ ... 'DEF:gsub=/var/lib/munin/host/base-sub-g.rrd:42:AVERAGE' \ ... '--end' \ '1592289000' [WARNING] Could not draw graph " /var/cache/munin/www/host/base-day.png": /var/cache/munin /var/cache/munin/www/host/base-day.png ``` -------------------------------- ### Example rrdcached Spool File Name Source: https://github.com/munin-monitoring/munin/blob/master/doc/master/rrdcached.md This is an example of an rrdcached spool file name. The file name includes a timestamp and a random number, and its size can grow significantly depending on configuration. ```default /var/lib/munin/rrdcached-journal/rrd.journal.1340869388.141124 ``` -------------------------------- ### Munin Plugin Configuration Output Source: https://github.com/munin-monitoring/munin/blob/master/doc/plugin/index.md Example of a Munin plugin responding to the 'config' argument, providing metadata for visualization. All plugins must support this argument. ```default # munin-run load config graph_title Load average graph_args --base 1000 -l 0 graph_vlabel load graph_scale no graph_category system load.label load graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately"). load.info 5 minute load average ``` -------------------------------- ### Dirty Config Logic Example Source: https://github.com/munin-monitoring/munin/blob/master/doc/others/index.md This pseudo-code illustrates how a plugin can check for the 'dirty config' capability and conditionally execute the fetch operation. It's designed for plugins that can gather data during the config phase to potentially halve execution time. ```pseudo if ( is_dirtyconfig() ) then do_fetch(); endif; ``` -------------------------------- ### Example: Update MAX values for xvm_ plugins Source: https://github.com/munin-monitoring/munin/blob/master/doc/howtos/remove-spikes.md An example demonstrating the Perl one-liner to update the MAX value for 'xvm_' plugins within a specific Munin domain. This script iterates through matching RRD files, tunes them with the new max value, and updates ownership. ```bash cd /var/lib/munin/example.com perl -ne 'next unless /:xvm_/; if (/.*;(\S+):(\S+)\.(\S+)\.max\s+(\d+)/) {foreach (glob "$1-$2-$3-?.rrd") {print qq{File: $_\tMax: $4\n};qx{rrdtool tune $_ -a 42:$4};qx{rrdtool dump $_ > /tmp/rrdtool-xml};qx{mv $_ $_.bak};qx{rrdtool restore -r /tmp/rrdtool-xml $_};qx{chown munin:munin $_}}}' ../datafile File: ic5.example.com-xvm_arch4-xvm_arch4_read_bytes-c.rrd Max: 34359738352 File: ic6.example.com-xvm_arch3-xvm_arch3_read_bytes-c.rrd Max: 34359738352 File: ic3.example.com-xvm_dwork-xvm_dwork_write_bytes-c.rrd Max: 25769803764 ``` -------------------------------- ### Munin Plugin Demonstrating Environment Variables Source: https://context7.com/munin-monitoring/munin/llms.txt Shows how a Munin plugin can utilize standard MUNIN_* environment variables for state management and configuration, such as MUNIN_STATEFILE and MUNIN_CAP_DIRTYCONFIG. ```bash # Plugin demonstrating use of standard MUNIN_ environment variables # MUNIN_STATEFILE — unique per-plugin, per-master persistent state file # MUNIN_PLUGSTATE — shared state directory for same-user plugins # MUNIN_CAP_DIRTYCONFIG — 1 if master supports combined config+values # MUNIN_CAP_MULTIGRAPH — 1 if master supports multigraph # MUNIN_DEBUG — set to 1 by --pidebug flag # MUNIN_MASTER_IP — IP of the connecting master STATEFILE="${MUNIN_STATEFILE}" LAST_VALUE=0 if [ -f "$STATEFILE" ]; then LAST_VALUE=$(cat "$STATEFILE") fi case $1 in config) echo "graph_title Event counter" echo "graph_category system" echo "events.label events/min" echo "events.type GAUGE" if [ "${MUNIN_CAP_DIRTYCONFIG:-0}" = "1" ]; then echo "events.value ${LAST_VALUE}" fi exit 0 ;; esac CURRENT=$(count_events) # hypothetical function echo "${CURRENT}" > "$STATEFILE" echo "events.value ${CURRENT}" # Debug output goes to STDERR and appears in munin-node.log if [ "${MUNIN_DEBUG:-0}" = "1" ]; then echo "# DEBUG: current=${CURRENT} last=${LAST_VALUE}" >&2 fi ``` -------------------------------- ### Munin Plugin Configuration Examples Source: https://github.com/munin-monitoring/munin/blob/master/doc/plugin/use.md Configure environment variables and user/group privileges for specific Munin plugins or groups of plugins. Use `env.` for environment variables and `user`/`group` for privileges. ```default [mysql*] user root env.mysqlopts --defaults-extra-file=/etc/mysql/debian.cnf [exim_mailqueue] group mail, (Debian-exim) [exim_mailstats] group mail, adm [ldap_*] env.binddn cn=munin,dc=foo,dc=bar env.bindpw secret [snmp_*] env.community SecretSNMPCommunityString [smart_*] # The following configuration affects # every plugin called by a service-link starting with smart_ # Examples: smart_hda, smart_hdb, smart_sda, smart_sdb user root group disk ```