MT6 monitoring
Jump to navigation
Jump to search
For statistics and trends collection, munin is a great tool. For monitoring, nagios is free and excellent.
Install Munin Server
jailmanage monitor
install lighttpd
pkg install -y lighttpd mkdir -p /var/spool/lighttpd/sockets chown -R www /var/spool/lighttpd/sockets
Configure Lighttpd
cd /usr/local/etc/lighttpd grep munin lighttpd.conf || cat << EO_LIGHTTPD >> lighttpd.conf server.modules += ( "mod_alias" ) alias.url = ( "/munin/" => "/usr/local/www/munin/", "/nagios/" => "/usr/local/www/nagios/", ) EO_LIGHTTPD
If you don't have an IPv6 address bound to this jail, disable IPv6 and the IPv4 port binding:
cd /usr/local/etc/lighttpd sed -i .bak -e 's/server.use-ipv6 = "enable"/server.use-ipv6 = "disable"/' lighttpd.conf sed -i .bak -e 's/^\$SERVER\["socket"\]/#\$SERVER\["socket"\]/' lighttpd.conf
start lighttpd
echo 'lighttpd_enable=YES' >> /etc/rc.conf service lighttpd start
install munin-master
Install the munin master (data collector):
pkg install -y munin-master
configure munin master
cat << EO_MUNIN_CONF >> /usr/local/etc/munin/munin.conf [dns] address 127.0.0.3 [mysql] address 127.0.0.4 [clamav] address 127.0.0.5 [spamassassin] address 127.0.0.6 #[dspam] # address 127.0.0.7 [vpopmail] address 127.0.0.8 [smtp] address 127.0.0.9 [webmail] address 127.0.0.10 [monitor] address 127.0.0.11 EO_MUNIN_CONF
configure munin-node in each jail
exit jailmanage all
in dns
cd /usr/local/etc/munin ln -s /usr/local/share/munin/plugins/munin_* plugins/ cat <<EO_MUNIN >> plugin-conf.d/plugins.conf [unbound*] user root env.statefile /usr/local/var/munin/plugin-state/unbound-state env.unbound_conf /usr/local/etc/unbound/unbound.conf env.unbound_control /usr/local/sbin/unbound-control EO_MUNIN sed -i .bak -e 's/# extended-statistics: no/extended-statistics: yes/' /usr/local/etc/unbound/unbound.conf service unbound restart service munin-node restart exit
in mysql
cd /usr/local/etc/munin ln -s /usr/local/share/munin/plugins/mysql_queries plugins ln -s /usr/local/share/munin/plugins/mysql_threads plugins ln -s /usr/local/share/munin/plugins/mysql_slowqueries plugins service munin-node restart exit
for clamav
cd /usr/local/etc/munin fetch -o plugins/clamav http://mail-toaster.org/install/mt6-munin-clamav.txt chmod 755 plugins/clamav tee << EO_CLAM_MUNIN >> plugin-conf.d/plugins.conf [clam*] user root EO_CLAM_MUNIN service munin-node restart exit
for spamassassin
cd /usr/local/etc/munin cp /usr/local/share/munin/plugins/spamstats plugins/ sed -i .bak -e 's/syslog/maillog/' plugins/spamstats cat <<EO_SPAM >> plugin-conf.d/plugins.conf [spam*] group wheel EO_SPAM service munin-node restart exit
for dspam
for vpopmail
cd /usr/local/etc/munin ln -s /usr/local/share/munin/plugins/qmailqstat plugins/ fetch -o plugins/dovecot http://mail-toaster.org/install/mt6-munin-dovecot.txt chmod 755 plugins/dovecot cat <<EO_DOVECOT >> plugin-conf.d/plugins.conf [qmailqstat] user qmailq env.qmailstat /var/qmail/bin/qmail-qstat [dovecot] user root env.logfile /var/log/maillog EO_DOVECOT service munin-node restart exit
smtp / haraka
for webmail
for monitor
ln -s /usr/local/share/munin/plugins/munin_* /usr/local/etc/munin/plugins/ service munin-node restart exit
Install Nagios
install nrpe client
pkg install nrpe