Thứ Tư, 24 tháng 2, 2016

MONITOR MACOSX USING MUNIN

Munin
Munin is a great monitoring tool that I started using on one of my daily work projects(linux servers recently), it gives you beautiful graphs out of the box, without all the installing problems of other great tools (nagios, cacti).
Due that the documentation in the official page is somewhat incomplete for a full installation case, I found that these steps are the most easy to follow to make your Mac up&running with monitoring on!

Install
1. Install Xcode
2. Install Xcode Developer Tools, the easy way is to type in terminal:
sudo xcode-select --install
3. Install MacPorts
4. Update port(always useful)
sudo port selfupdate
5. Check that you have Java SE SDK installed(javac required) if not install it
6. Install munin(server & node) using port:
sudo port install munin +server
if this fails install rrdtool first and try again, rrdtool is a dependency of munin, but in my case port failed building rrdtool the firts time
sudo port install rrdtool
7. Install suggested plugins
sudo -u munin munin-node-configure --suggest --shell | sudo sh
8. Enable munin at startup
sudo port load munin
9. Munin paths
We need apache(or some web server) to fetch the graphs, with this in mind is useful to mention that this default installation creates several paths, with the relevant ones being:

Munin pid
/opt/local/var/run/munin/munin-node.pid
Config scripts
/opt/local/etc/munin/munin.conf
/opt/local/etc/munin/munin-node.conf
Html dir
/opt/local/www/munin
Data dir
/opt/local/var/munin


10. Creating virtual host for munin
Uncomment in /etc/apache2/httpd.conf
from
#Include /private/etc/apache2/extra/httpd-vhosts.conf
to
Include /private/etc/apache2/extra/httpd-vhosts.conf
Add virtual host in /private/etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80>
    ServerName munin.localhost
    DocumentRoot "/opt/local/www/"
    ErrorLog "/private/var/log/apache2/munin.localhost-error_log"
    CustomLog "/private/var/log/apache2/munin.localhost-access_log" common
    <Directory "/opt/local/www/munin">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from 127.0.0.1
    </Directory>
</VirtualHost>
11. Modify /etc/hosts to your liking adding the following line
127.0.0.1    munin.localhost
12. Start apache:
sudo apachectl start
13. .htaccess permissions
By default munin places an .htaccess file in /opt/local/www/munin/.htaccess that configures basic http auth, in my case, i have my apache listening only in 127.0.0.1 so I disabled the basic auth commenting the lines:
#AuthUserFile /opt/local/etc/munin/munin-htpasswd
#AuthName "Munin"
#AuthType Basic
#require valid-user
14. Make apache load on startup[optional]:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
15. In a couple of minutes go to your monitoring page and have fun port default: 4949. http://munin.localhost:4949/munin
And that’s all.

Không có nhận xét nào:

Đăng nhận xét