lost and found ( for me ? )

Showing posts with label munin. Show all posts
Showing posts with label munin. Show all posts

ubuntu 12.04 unbound : monitor DNS statistics with munin

Here is how to monitor unbound DNS stats via munin within one box.

install apache2, munin and munin-node within one box.
# tail -1 /etc/lsb-release ;uname -ri
DISTRIB_DESCRIPTION="Ubuntu 12.04.3 LTS"
3.5.0-41-generic x86_64

# apt-get install unbound munin munin-node apache2

[ Apache ]

configure Apache to view munin stats via an web browser
# cp /etc/munin/apache.conf /etc/apache2/sites-available/munin

edit /etc/apache2/sites-available/munin like this:
# egrep -v \# /etc/apache2/sites-available/munin
Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
       Order allow,deny
       Allow from all
       Options None

   <IfModule mod_expires.c>
       ExpiresActive On
       ExpiresDefault M310
   </IfModule>

</Directory>


# a2ensite munin



[ munin and unbound ]

download unbound source code to get munin plugin

download source code and copy munin ubnound plugin
# apt-get source unbound
# cp unbound-1.4.18/contrib/unbound_munin_ /usr/share/munin/plugins/
# chown root.root /usr/share/munin/plugins/unbound_munin_
# chmod 755 /usr/share/munin/plugins/unbound_munin_

# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_class
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_flags
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_opcode
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_rcode
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_by_type
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_histogram
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_hits
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_memory
# ln -s /usr/share/munin/plugins/unbound_munin_ /etc/munin/plugins/unbound_munin_queue

edit unbound.conf
# egrep -v ^# unbound.conf | grep -v ^$ | grep -v \#
server:
       verbosity: 1
        statistics-interval: 0
        statistics-cumulative: no
        extended-statistics: yes
        interface: 0.0.0.0
        do-ip6: no
        access-control: 0.0.0.0/0 allow

python:
remote-control:
        control-enable: yes

restart unbound, munin-node and apache
# service unbound restart
# service munin-node restart
# service apache2 restart

access to http:// IP address/munin




CentOS6 64bit: install munin server and node by using EPEL repository


munin-server: 192.168.122.223
munin-node: 192.168.122.200

[ munin server ]


# rpm -ivh epel-release-6-8.noarch.rpm

# yum update

# yum install munin

config
[root@localhost munin]# pwd
/etc/munin

[root@localhost munin]# ls
conf.d          munin-node.conf  node.d         plugins  templates
munin-htpasswd  munin.conf       plugin-conf.d  static

# egrep -v ^# munin.conf | egrep -v ^$
dbdir   /var/lib/munin
htmldir /var/www/html/munin
logdir /var/log/munin
rundir  /var/run/munin
includedir /etc/munin/conf.d
graph_strategy cron
cgiurl_graph /munin-cgi/munin-cgi-graph
html_strategy cron
[localhost]
   address 127.0.0.1
   use_node_name yes
[node1]
   address 192.168.122.200
   use_node_name yes
+fork no

# chown -R munin.munin /var/www/html/munin

# /etc/init.d/munin-node start
Starting Munin Node: [  OK  ]

to view statistics over HTTP
# yum install httpd

# htpasswd -c /etc/munin/munin-htpasswd hattori
New password:
Re-type new password:
Adding password for user hattori

# apachectl start

the munin-server and munin-nodes use TCP4949 for its communication.

cron job for munin are executed every 5 minutes.
[root@localhost cron.d]# pwd
/etc/cron.d
[root@localhost cron.d]# cat munin
#
# cron-jobs for munin
#

MAILTO=root

*/5 * * * *     munin test -x /usr/bin/munin-cron && /usr/bin/munin-cron

[ munin node ]

install munin-node

# rpm -ivh epel-release-6-8.noarch.rpm


# yum install munin-node -y

config
allow access from the munin-server
egrep -v ^# munin-node.conf | grep -v ^$
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
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$
allow ^127\.0\.0\.1$
allow ^::1$
allow ^192\.168\.122\.223$
host *
port 4949

# /etc/init.d/munin-node start
Starting Munin Node: [  OK  ]



[ access to the munin-server]

http:// munin server IP/munin



install munin on Fedora 18

Here’s how to install munin on Fedora 18.


I’ve installed munin server and munin node on the same box , which means that one box acts as both munin server and client.

[root@f18 ~]# uname -ri
3.9.0-0.rc5.git1.1.vanilla.mainline.knurd.1.fc18.x86_64 x86_64
[root@f18 ~]# cat /etc/fedora-release
Fedora release 18 (Spherical Cow)

install munin , munin-node and httpd via yum.
# yum -y install munin munin-node httpd

[ munin server ]

use default configuration.
# egrep -v ^# /etc/munin/munin.conf | grep -v ^$
includedir /etc/munin/conf.d
graph_strategy cron
html_strategy cron
[localhost]
   address 127.0.0.1
   use_node_name yes

[ munin node ]

use default configuration as well.
# egrep -v ^# /etc/munin/munin-node.conf | grep -v ^$
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
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$
allow ^127\.0\.0\.1$
allow ^::1$
host *
port 4949
#

start munin-node
[root@f18 ~]# systemctl start munin-node.service

[root@f18 ~]# systemctl status munin-node.service
munin-node.service - Munin Node Server.
 Loaded: loaded (/usr/lib/systemd/system/munin-node.service; disabled)
 Active: active (running) since Sat 2013-04-13 02:50:12 JST; 1s ago
   Docs: man:munin-node
Process: 8403 ExecStart=/usr/sbin/munin-node (code=exited, status=0/SUCCESS)
Main PID: 8404 (munin-node)
 CGroup: name=systemd:/system/munin-node.service
 └─8404 /usr/bin/perl -wT /usr/sbin/munin-node

start munin-node when booting the OS
# systemctl enable munin-node.service
ln -s '/usr/lib/systemd/system/munin-node.service' '/etc/systemd/system/multi-user.target.wants/munin-node.service'

configure apache to browse statistics via HTTP.
# egrep -v ^# /etc/httpd/conf.d/munin.conf  | grep -v ^$
<directory /var/www/html/munin>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 192.168.11.0/24
ExpiresActive On
ExpiresDefault M310
</directory>
ScriptAlias /munin-cgi/munin-cgi-graph /var/www/cgi-bin/munin-cgi-graph

start httpd
# apachectl start


The following is an output of CPU usage.


list munin plugins
# munin-node-configure --suggest
Plugin                     | Used | Suggestions                            
------                     | ---- | -----------                            
acpi                       | no   | no [cannot read []                     
amavis                     | no   | no                                     
apache_accesses            | no   | no [apache server-status not found. check if mod_status is enabled]
apache_processes           | no   | no [apache server-status not found. check if mod_status is enabled]
apache_volume              | no   | no [apache server-status not found. check if mod_status is enabled]
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 [logfile not readable]              
df                         | yes  | yes                                    
df_inode                   | yes  | yes                                    
diskstats                  | yes  | yes                                    
entropy                    | yes  | yes                                    
exim_mailqueue             | no   | no [no exiqgrep]                       
exim_mailstats             | no   | no ['/usr/sbin/exim -bP log_file_path' returned an error]
fail2ban                   | no   | no [fail2ban-server does not respond to ping]
forks                      | yes  | yes                                    
fw_conntrack               | yes  | yes                                    
fw_forwarded_local         | yes  | yes                                                                                                    
<snip>

munin plugins are stored in /usr/share/munin/plugins directory
# ls /usr/share/munin/plugins/*
/usr/share/munin/plugins/acpi
/usr/share/munin/plugins/amavis
/usr/share/munin/plugins/apache_accesses
/usr/share/munin/plugins/apache_processes
/usr/share/munin/plugins/apache_volume
/usr/share/munin/plugins/apc_envunit_
/usr/share/munin/plugins/apc_nis
/usr/share/munin/plugins/apt
/usr/share/munin/plugins/apt_all
/usr/share/munin/plugins/asterisk_channels
/usr/share/munin/plugins/asterisk_channelstypes
/usr/share/munin/plugins/asterisk_codecs
/usr/share/munin/plugins/asterisk_meetme
/usr/share/munin/plugins/asterisk_meetmeusers
/usr/share/munin/plugins/asterisk_sipchannels
<snip>