Install Munin server

Munin is used for monitoring.

Install prerequisites

apt-get update && apt-get dist-upgrade
apt-get -y install apache2 libcgi-fast-perl libapache2-mod-fcgid
apt-get -y install smartmontools
perl -MCPAN -e shell
cpan[1]> install LWP::UserAgent
cpan[2]> exit

Enable the fcgid module in apache

a2enmod fcgid
service apache2 restart

Install Munin

apt-get -y install munin munin-node munin-plugins-extra

Configure Munin

vi /etc/munin/munin.conf
dbdir   /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir  /var/run/munin

tmpldir /etc/munin/templates

includedir /etc/munin/munin-conf.d

[localhost.localdomain]
    address 127.0.0.1
    use_node_name yes
vi /etc/apache2/conf-enabled/munin.conf
Alias /munin /var/cache/munin/www

<Directory /var/cache/munin/www>
    # Require local
    # Require all granted
    AuthUserFile /etc/munin/munin-htpasswd
    AuthName "Munin"
    AuthType Basic
    Require valid-user
    Options FollowSymLinks SymLinksIfOwnerMatch
    Options None
</Directory>

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
    # Require local
    # Require all granted
    AuthUserFile /etc/munin/munin-htpasswd
    AuthName "Munin"
    AuthType Basic
    Require valid-user
    Options FollowSymLinks SymLinksIfOwnerMatch
    <IfModule mod_fcgid.c>
        SetHandler fcgid-script
    </IfModule>
    <IfModule !mod_fcgid.c>
        SetHandler cgi-script
    </IfModule>
</Location>
htpasswd -c /etc/munin/munin-htpasswd admin
service apache2 restart
service munin-node restart

Congratulations! Munin is now installed and running.

netstat -pant|grep 4949
tcp6   0   0 :::4949       :::*          LISTEN      12890/perl

Log in to Munin

http://your-ip/munin

Additional Munin plugins

cd /etc/munin/plugins
ln -s /usr/share/munin/apache_accesses
service munin-node restart

Additional commands

The Munin command munin-node-configure –suggest can be used to get recommendations for additional Munin modules that can be enabled on the server.

munin-node-configure --suggest
Plugin                     | Used | Suggestions                            
------                     | ---- | -----------                            
acpi                       | no   | no [cannot read /proc/acpi/thermal_zone/*/temperature]
amavis                     | no   | no                                     
apache_accesses            | no   | yes                                    
apache_processes           | no   | yes                                    
apache_volume              | no   | yes                                    
apc_envunit_               | no   | no [no units to monitor]               
bonding_err_               | no   | no [No /proc/net/bonding]              
courier_mta_mailqueue      | no   | no [spooldir not found]                
courier_mta_mailstats      | no   | no [could not find executable]         
courier_mta_mailvolume     | no   | no [could not find executable]         
cps_                       | no   | no                                     
cpu                        | yes  | yes                                    
cpuspeed                   | no   | no [missing /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state]
cupsys_pages               | no   | no [could not find logdir]             
df                         | yes  | yes                                    
df_inode                   | yes  | yes                                    
diskstats                  | yes  | yes                                    
entropy                    | yes  | yes                                    
exim_mailqueue             | no   | no [no exiqgrep]                       
exim_mailstats             | no   | no [logdir does not exist]             
fail2ban                   | no   | no [/usr/bin/fail2ban-client not found]
forks                      | yes  | yes                                    
fw_conntrack               | no   | no                                     
fw_forwarded_local         | no   | no                                     
fw_packets                 | yes  | yes                                    
hddtemp_smartctl           | no   | no [first drive not supported, configure the plugin]
http_loadtime              | yes  | yes                                    
if_                        | yes  | yes (eth0)                             
if_err_                    | yes  | yes (eth0)                             
interrupts                 | yes  | yes                                    
ip_                        | no   | yes                                    
ipmi_                      | no   | no [missing ipmitool command]          
irqstats                   | yes  | yes                                    
load                       | yes  | yes                                    
lpstat                     | no   | no [lpstat not found]                  
memory                     | yes  | yes                                    
munin_stats                | no   | yes                                    
mysql_                     | no   | no [Missing dependency Cache::Cache]   
netstat                    | yes  | yes                                    
nfs4_client                | no   | no [no /proc/net/rpc/nfs]              
nfs_client                 | no   | no                                     
nfsd                       | no   | no [no /proc/net/rpc/nfsd]             
nfsd4                      | no   | no [no /proc/net/rpc/nfsd]             
nginx_request              | no   | no [no nginx status on http://localhost/nginx_status]
nginx_status               | no   | no [no nginx status on http://localhost/nginx_status]
ntp_                       | no   | no                                     
ntp_kernel_err             | yes  | yes                                    
ntp_kernel_pll_freq        | yes  | yes                                    
ntp_kernel_pll_off         | yes  | yes                                    
ntp_offset                 | yes  | yes                                    
ntp_states                 | no   | no                                     
nvidia_                    | no   | no [no nvclock executable at /usr/bin/nvclock, please configure]
open_files                 | yes  | yes                                    
open_inodes                | yes  | yes                                    
pgbouncer_connections      | no   | no [DBD::Pg not found, and cannot do psql yet]
pgbouncer_requests         | no   | no [DBD::Pg not found, and cannot do psql yet]
postfix_mailqueue          | yes  | yes                                    
postfix_mailvolume         | yes  | yes                                    
postgres_autovacuum        | no   | no                                     
postgres_bgwriter          | no   | no                                     
postgres_cache_            | no   | no                                     
postgres_checkpoints       | no   | no                                     
postgres_connections_      | no   | no                                     
postgres_connections_db    | no   | no                                     
postgres_locks_            | no   | no                                     
postgres_oldest_prepared_xact_ | no   | no                                     
postgres_prepared_xacts_   | no   | no                                     
postgres_querylength_      | no   | no                                     
postgres_scans_            | no   | no                                     
postgres_size_             | no   | no                                     
postgres_transactions_     | no   | no                                     
postgres_tuples_           | no   | no                                     
postgres_users             | no   | no                                     
postgres_xlog              | no   | no                                     
proc                       | no   | no                                     
proc_pri                   | yes  | yes                                    
processes                  | yes  | yes                                    
ps_                        | no   | no                                     
qmailqstat                 | no   | no                                     
selinux_avcstat            | no   | no [missing /selinux/avc/cache_stats file]
sendmail_mailqueue         | no   | no                                     
sendmail_mailstats         | no   | no                                     
sendmail_mailtraffic       | no   | no                                     
slapd_                     | no   | no [Net::LDAP not found]               
slapd_bdb_cache_           | no   | no [Can't execute db_stat file '/usr/bin/db4.6_stat']
slony_lag_                 | no   | no [DBD::Pg not found, and cannot do psql yet]
smart_                     | no   | no [no drives accessible]              
snort_alerts               | no   | no [/var/snort/snort.stats not readable]
snort_bytes_pkt            | no   | no [/var/snort/snort.stats not readable]
snort_drop_rate            | no   | no [/var/snort/snort.stats not readable]
snort_pattern_match        | no   | no [/var/snort/snort.stats not readable]
snort_pkts                 | no   | no [/var/snort/snort.stats not readable]
snort_traffic              | no   | no [/var/snort/snort.stats not readable]
squeezebox_                | no   | no [no connection on localhost port 9090]
squid_cache                | no   | no [could not connect: Connection refused]
squid_objectsize           | no   | no [could not connect: Connection refused]
squid_requests             | no   | no [could not connect: Connection refused]
squid_traffic              | no   | no [could not connect: Connection refused]
swap                       | yes  | yes                                    
threads                    | yes  | yes                                    
tomcat_                    | no   | no                                     
uptime                     | yes  | yes                                    
users                      | yes  | yes                                    
varnish_                   | no   | no                                     
vmstat                     | yes  | yes                                    
vserver_cpu_               | no   | no [/proc/virtual/info not found]      
vserver_loadavg            | no   | no [/proc/virtual/info not found]      
vserver_resources          | no   | no [/proc/virtual/info not found]      
yum                        | no   | no [Could not run yum]