Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

6.4. Munin

http://munin-monitoring.org/

6.4.1. Ubuntu

http://munin-monitoring.org/

6.4.1.1. Installation Monitor Server

$ sudo apt-get install munin

neo@monitor:~$ sudo vim /etc/munin/munin.conf
neo@monitor:~$ sudo service munin-node restart


[example.com]
        address 127.0.0.1
        use_node_name yes
        
[web2]
    address 172.16.1.2
    use_node_name yes

[web3]
    address 172.16.1.3
    use_node_name yes

[database]
    address 172.16.1.10
    use_node_name yes

		

6.4.1.2. Installation Node

sudo apt-get install munin-node

vim /etc/munin/munin-node.conf

allow ^172\.16\.1\.2$
		

6.4.1.3. Additional Plugins

sudo apt-get install munin-plugins-extra
		

6.4.1.4. plugins

6.4.1.4.1. mysql
ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins/
			

/etc/munin/plugin-conf.d/munin-node

$ sudo vim /etc/munin/plugin-conf.d/munin-node

[mysql*]
user root
env.mysqlopts --defaults-file=/etc/mysql/debian.cnf
env.mysqluser debian-sys-maint
env.mysqlconnection DBI:mysql:mysql;mysql_read_default_file=/etc/mysql/debian.cnf

[mysql*]
env.mysqlopts -h 192.168.3.40 -uneo -pchen
			
6.4.1.4.2. apache
$ sudo vim /etc/munin/plugin-conf.d/munin-node
			
[apache_*]
env.url   http://127.0.0.1/server-status?auto
env.ports 80			
			

6.4.2. CentOS

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm	
# yum install munin -y	
# yum install munin-node -y
# yum install munin-java-plugins -y
# yum install unbound-munin -y
# service munin-node start
# chkconfig munin-node on
		

test

# telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
# munin node at datacenter.example.com
list
cpu df df_inode entropy forks fw_packets http_loadtime if_err_eth0 if_eth0 interrupts iostat iostat_ios irqstats load memory munin_stats netstat open_files open_inodes proc_pri processes sendmail_mailqueue sendmail_mailstats sendmail_mailtraffic swap threads uptime users vmstat yum
		

http://localhost/munin/

6.4.3. 用戶認證

$ sudo vim /etc/apache2/conf.d/munin.conf
			
        AuthUserFile /etc/munin/munin-htpasswd
        AuthName "Munin"
        AuthType Basic
        require valid-user
			
		

6.4.4. munin-node and plugins

config: /etc/munin/munin-node.conf

plugins: /usr/share/munin/plugins/

6.4.4.1. munin-node.conf

allow ^127\.0\.0\.1$
allow ^192\.168\.3\.5$
			

6.4.4.2. mysql plugin

mysql

# ln -s /usr/share/munin/plugins/mysql_* /etc/munin/plugins		
			
# vim /etc/munin/plugin-conf.d/munin-node
env.mysqlopts -uneo -pchen

# or

env.mysqlopts -h 172.16.1.17 -u monitor -ppassword

# service munin-node start
			

驗證安裝,telnet localhost 4949 之後,執行 fetch mysql_queries

6.4.4.3. apache plugin

apache

# ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins		
			
			
# vim /etc/httpd/conf/httpd.conf
ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .example.com
	Allow from localhost    
</Location>
			
			
# /etc/init.d/httpd restart
# service munin-node restart
			

驗證安裝,telnet localhost 4949 之後,執行 fetch apache_processes

6.4.4.4. memcached plugin

memcached plugin要求符號連結名字的格式是: memcached_connections_[IP Address]_[Port], IP與Port是在符號連結名字中配置的

ln -s /usr/share/munin/plugins/memcached_bytes_ /etc/munin/plugins/memcached_bytes_127_0_0_1_11211
ln -s /usr/share/munin/plugins/memcached_connections_ /etc/munin/plugins/memcached_connections_127_0_0_1_11211
ln -s /usr/share/munin/plugins/memcached_hits_ /etc/munin/plugins/memcached_hits_127_0_0_1_11211
ln -s /usr/share/munin/plugins/memcached_items_ /etc/munin/plugins/memcached_items_127_0_0_1_11211
ln -s /usr/share/munin/plugins/memcached_requests_ /etc/munin/plugins/memcached_requests_127_0_0_1_11211
ln -s /usr/share/munin/plugins/memcached_traffic_ /etc/munin/plugins/memcached_traffic_127_0_0_1_11211
			

驗證安裝,telnet localhost 4949 之後,執行 fetch memcached_requests_127_0_0_1_11211

6.4.5. munin.conf

# vim /etc/munin/munin.conf
# a simple host tree
[localhost]
    address 127.0.0.1
    use_node_name yes
[database]
    address 192.168.3.40
    use_node_name yes
		

6.4.6. munin-node

# yum install munin-node -y
# chkconfig munin-node on
# service munin-node start
		

6.4.6.1. munin-node.conf

vim /etc/munin/munin-node.conf allow ^127\.16\.1\.2$