User Tools

Site Tools


munin_statistics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
munin_statistics [2022/07/19 21:13] – external edit 127.0.0.1munin_statistics [2022/07/21 23:06] (current) admin
Line 10: Line 10:
   * System - CPU, Load, Memory etc.   * System - CPU, Load, Memory etc.
  
-**Updated for Debian Squeeze**+<del>**Updated for Debian Squeeze**</del> 
 +** Updated for Debian Bullseye **
  
-====== Installation ====== +===== Installation ===== 
-(munin=graphing servermunin-node=server sending stats):+<code> 
 +#Note: munin=graphing server and munin-node=server sending stats:
  apt-get install munin munin-node  apt-get install munin munin-node
 +</code>
  
-It should work out of the box. Default web is located in <del>/var/www/munin</del> /var/cache/munin/www with config files in /etc/munin with a config for munin and munin-node. You can go: ln -s /var/cache/munin/www /var/www/munin and then visit http://server/munin to look at the graphs **or** look at /etc/munin/apache2.conf+It will work out of the box. Wait at least 5 minutes ( /etc/cron.d/munin 
 + 
 +<del>Default web is located in /var/cache/munin/www with config files in /etc/munin with a config for munin and munin-node. You can go: ln -s /var/cache/munin/www /var/www/munin and then visit http://server/munin to look at the graphs **or** look at /etc/munin/apache2.conf </del>
  
 Remember to open firewall to allow munin-node to connect to the graphing server! It uses port 4949. Remember to open firewall to allow munin-node to connect to the graphing server! It uses port 4949.
  
-====== Temperature Monitoring with Munin ======+Ok - so, after apt-get installing munin, the following apache config gets enabled: 
 +<code> 
 +vi /etc/apache2/conf-enabled/munin.conf 
 +#update lines to: 
 +<Directory /var/cache/munin/www> 
 +    #Require local 
 +    Require all granted 
 +</code> 
 + 
 +How with a web browser navigate to http://server/munin 
 +Because Require local was changed to all, you can view stats instead of a 403. 
 + 
 +==== Change servername on graphs==== 
 +<code> 
 +vi /etc/munin/munin-node.conf 
 +#uncomment and update to: 
 +host_name server.domain.com 
 +</code> 
 + 
 +<code> 
 +vi /etc/munin/munin.conf 
 +#Change 
 +#[localhost.localdomain] 
 +#to 
 +[server.domain.com] 
 +    address 127.0.0.1 
 +    use_node_name yes 
 + 
 +</code> 
 +...A few minutes later, you should see updates. 
 + 
 + 
 +==== Removing graphs / plugins ==== 
 +All possible plugins are stored in: /usr/share/munin/plugins/ and symlinked into: /etc/munin/plugins 
 + 
 +To delete a plugin, simply delete it from /etc/munin/plugins 
 + 
 +==== Adding graphs / plugins ==== 
 +=== Apache plugins === 
 +<code> 
 +ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses 
 +ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes 
 +ln -s /usr/share/munin/plugins/apache_volume /etc/munin/plugins/apache_volume 
 +ln -s /usr/share/munin/plugins/port_ /etc/munin/plugins/port_80 
 + 
 +#You may need to do: 
 +a2enmod status 
 +#reported: Module status already enabled 
 +#check /etc/apache2/mods-enabled/status.conf 
 + 
 +</code> 
 +Note: there are lots more graphs for apache, but require apache mod_watch. See [[munin_statistics#apache_mod_watch_munin_graphs_showing_vhost_accesses|here]] 
 + 
 +=== SQL plugins === 
 +Well MySQL is now MariaDb. 
 +<code> 
 +ln -s /usr/share/munin/plugins/mysql_queries /etc/munin/plugins/mysql_queries 
 +ln -s /usr/share/munin/plugins/mysql_slowqueries /etc/munin/plugins/mysql_slowqueries 
 +ln -s /usr/share/munin/plugins/mysql_bytes /etc/munin/plugins/mysql_bytes 
 +</code> 
 + 
 +=== Other useful plugins === 
 +<code> 
 +ln -s /usr/share/munin/plugins/postfix_mailstats /etc/munin/plugins/postfix_mailstats 
 + 
 +ln -s /usr/share/munin/plugins/multips_memory /etc/munin/plugins/multips_memory 
 +^ For the above, to monitor just certain processes 
 +vi /etc/munin/plugin-conf.d/munin-node 
 +#Add 
 +[multips_memory] 
 +env.names apache2 mariadbd 
 + 
 +</code> 
 + 
 +===== Temperature Monitoring with Munin =====
 This is with a 2.6 kernel and udev! This is with a 2.6 kernel and udev!
 +<code>
  apt-get install lm-sensors  apt-get install lm-sensors
    
  sensors-detect  sensors-detect
- <nowiki>//</nowiki> The above should edit /etc/modules and include extra lines. The next line adds the sensors in manually (not to the file tho!)+ #The above should edit /etc/modules and include extra lines. The next line adds the sensors in manually (not to the file tho!)
  modprobe -a i2c-viapro i2c-isa eeprom w83627hf  modprobe -a i2c-viapro i2c-isa eeprom w83627hf
    
- <nowiki>//</nowiki>A reboot should sort everything. (Cant remember if a reboot is required or not.)+ #A reboot should sort everything. (Cant remember if a reboot is required or not.) 
 +</code>
  
 Onto config of Munin. All munin templates are kept in /usr/share/munin/plugins. Onto config of Munin. All munin templates are kept in /usr/share/munin/plugins.
 +<code>
  ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_fan  ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_fan
  ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_temp  ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_temp
  ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_volt  ln -s /usr/share/munin/plugins/sensors_ /etc/munin/plugins/sensors_volt
 +</code>
  
 The above lines should pick up all required - and should not need editing - once the sensor modules are included. The above lines should pick up all required - and should not need editing - once the sensor modules are included.
 +
  
 ** Test Sensors ** ** Test Sensors **
-Test the sensors by simply going:+<code> 
 +#Test the sensors by simply going:
  sensors  sensors
 +</code>
  
-http://www.debian-administration.org/articles/229 +  * http://munin.projects.linpro.no/wiki/Documentation 
- +  http://www.debianhelp.co.uk/munin.htm 
-http://munin.projects.linpro.no/wiki/Documentation +  http://munin.projects.linpro.no/wiki/PluginCat 
- +  http://www.valerie-et-guillaume.com/categorie/geek/
-http://www.debianhelp.co.uk/munin.htm +
- +
-http://www.debian-administration.org/articles/327 +
- +
-http://munin.projects.linpro.no/wiki/PluginCat +
- +
-http://www.valerie-et-guillaume.com/categorie/geek/+
  
-====== SMART Monitoring with Munin ======+===== SMART Monitoring with Munin =====
 Note that smartmontools must be installed and smartd running before munin will pick up and use smart. Configure smart using the way mentioned on this wiki here: [[SMART]] Note that smartmontools must be installed and smartd running before munin will pick up and use smart. Configure smart using the way mentioned on this wiki here: [[SMART]]
  
 After SMART is running: After SMART is running:
 +<code>
  ln -s /usr/share/munin/plugins/smart_ /etc/munin/plugins/smart_sda  ln -s /usr/share/munin/plugins/smart_ /etc/munin/plugins/smart_sda
  ln -s /usr/share/munin/plugins/smart_ /etc/munin/plugins/smart_sdb  ln -s /usr/share/munin/plugins/smart_ /etc/munin/plugins/smart_sdb
  
- <nowiki>//</nowiki>edit the following only for Debian Etch or older+ #edit the following only for Debian Etch or older
  vi /etc/munin/plugin-conf.d/munin-node  vi /etc/munin/plugin-conf.d/munin-node
  #uncomment  #uncomment
Line 74: Line 154:
  env.smartargs -d ata -a  env.smartargs -d ata -a
  
 +</code>
 That should do it. Apologies for the lack of a reference. That should do it. Apologies for the lack of a reference.
  
Line 94: Line 175:
  
 The known fix was: The known fix was:
 +<code>
  vi /etc/munin/plugins/postfix_mailstats  vi /etc/munin/plugins/postfix_mailstats
  #on line 239 change from:  #on line 239 change from:
Line 99: Line 181:
  #to:  #to:
  $cause = 'OTHER' unless $1 =~/^\d+$/;  $cause = 'OTHER' unless $1 =~/^\d+$/;
 +</code>
 That should solve that little error. Restart munin-node and then see. That should solve that little error. Restart munin-node and then see.
 Reference: http://www.nabble.com/Bug-403341:-munin-node:-missing-~-in-postfix_mailstats:239-breaks-plugin-t2831828.html Reference: http://www.nabble.com/Bug-403341:-munin-node:-missing-~-in-postfix_mailstats:239-breaks-plugin-t2831828.html
Line 113: Line 195:
 Refs: http://osdir.com/ml/db.rddtool.munin.general/2005-08/msg00046.html Refs: http://osdir.com/ml/db.rddtool.munin.general/2005-08/msg00046.html
  
-====== Disk Usage (DU) Monitoring of home and mail Directories plugin for Munin ======+===== Disk Usage (DU) Monitoring of home and mail Directories plugin for Munin =====
 The following file is placed in: The following file is placed in:
 +<code>
 /usr/share/munin/plugins/du /usr/share/munin/plugins/du
  #!/usr/bin/perl -w  #!/usr/bin/perl -w
Line 190: Line 273:
    
  # vim:syntax=perl  # vim:syntax=perl
 +</code>
  
 Note: The above file is modified from the original which can be obtained at: Note: The above file is modified from the original which can be obtained at:
-http://munin.projects.linpro.no/wiki/plugin-homedirs +  * http://munin.projects.linpro.no/wiki/plugin-homedirs 
-http://www.mega2000.de/~philipp/homedirs+  http://www.mega2000.de/~philipp/homedirs
  
 The above munin plugin reads the information from a temp file in /tmp/munin-du.cache. A cronjob running once daily refreshes this cache file. The following command is used for the cronjob: The above munin plugin reads the information from a temp file in /tmp/munin-du.cache. A cronjob running once daily refreshes this cache file. The following command is used for the cronjob:
 +<code>
  #!/bin/bash  #!/bin/bash
  du -B 1 --max-depth=1 /home /srv /var /tmp /usr | sort -nr | grep -Ev '/home$' | grep -Ev '/var$' | grep -Ev '/usr$' | grep -Ev '/srv$' | sed "s/\<nowiki>//</nowiki>-/g" > /tmp/munin-du.cache  du -B 1 --max-depth=1 /home /srv /var /tmp /usr | sort -nr | grep -Ev '/home$' | grep -Ev '/var$' | grep -Ev '/usr$' | grep -Ev '/srv$' | sed "s/\<nowiki>//</nowiki>-/g" > /tmp/munin-du.cache
  #Its not very tidy, I know, but it does the trick.  #Its not very tidy, I know, but it does the trick.
 +</code>
  
-====== Munin Monitoring of Xen CPU and Network Traffic ====== +===== Munin Monitoring of Xen CPU and Network Traffic ===== 
-The following websites provide the original information: <br> +The following websites provide the original information:
-http://munin.projects.linpro.no/attachment/wiki/PluginCat/xen_traffic_all <br> +
-http://www.skullkrusher.net/linux/scripts/xen_percent  (Original source: http://lists.xensource.com/archives/html/xen-users/2006-01/msg00323.html  )+
  
 +  * http://munin.projects.linpro.no/attachment/wiki/PluginCat/xen_traffic_all
 +  * http://www.skullkrusher.net/linux/scripts/xen_percent  
 +  * http://lists.xensource.com/archives/html/xen-users/2006-01/msg00323.html  
 +
 +<code>
  cd /usr/share/munin/plugins/  cd /usr/share/munin/plugins/
  wget http://wiki.kartbuilding.net/xen_traffic_all  wget http://wiki.kartbuilding.net/xen_traffic_all
Line 219: Line 308:
    
  /etc/init.d/munin-node restart  /etc/init.d/munin-node restart
 +</code>
 That should do it. That should do it.
    
Line 228: Line 318:
  
  
-====== Email Notifications from Munin ======+===== Email Notifications from Munin =====
 Typically I use nagios to monitor services, while munin monitors individual systems, with each system having munin-node installed. Instead of having nice pretty graphs to monitor performance on an hourly, daily or weekely basis, munin can easily be set to send warning and critical email notifications. Typically I use nagios to monitor services, while munin monitors individual systems, with each system having munin-node installed. Instead of having nice pretty graphs to monitor performance on an hourly, daily or weekely basis, munin can easily be set to send warning and critical email notifications.
  
 The information on notifications using munin is quite scarse. It took quite a bit of trial and error to get everything fully corrected. Below is the most simple config. It sends one email when a service is exceeded. It sends a final email when the service is below the threshold set. The information on notifications using munin is quite scarse. It took quite a bit of trial and error to get everything fully corrected. Below is the most simple config. It sends one email when a service is exceeded. It sends a final email when the service is below the threshold set.
  
 +<code>
  vi /etc/munin/munin.conf  vi /etc/munin/munin.conf
  #include the following:  #include the following:
Line 244: Line 335:
     df._dev_sda1.critical 95     df._dev_sda1.critical 95
  
 +</code>
 Its that simple. With a minimum of two entries all can be up and running. Now, lets explain a little: Its that simple. With a minimum of two entries all can be up and running. Now, lets explain a little:
  
 The values/variable which will be monitored can be obtained on the client/host running munin-node using munin-run. For example, we want to monitor postfix mail usage with Munin and to send email notifications if queues are exceeded. The values/variable which will be monitored can be obtained on the client/host running munin-node using munin-run. For example, we want to monitor postfix mail usage with Munin and to send email notifications if queues are exceeded.
 +<code>
  ssh root@mail  ssh root@mail
  cd /etc/munin/plugins  cd /etc/munin/plugins
Line 262: Line 355:
     postfix_mailqueue.active.warning 90     postfix_mailqueue.active.warning 90
  
 +</code>
 See the following for allowing contacts for particular servers and/or for particular services: See the following for allowing contacts for particular servers and/or for particular services:
 http://munin.projects.linpro.no/wiki/HowToContactNagios http://munin.projects.linpro.no/wiki/HowToContactNagios
 +<code>
  contact.nagios.command /usr/local/nagios/bin/send_nsca nagioshost.example.com -c /usr/local/nagios/etc/send_nsca.cfg -to 60  contact.nagios.command /usr/local/nagios/bin/send_nsca nagioshost.example.com -c /usr/local/nagios/etc/send_nsca.cfg -to 60
    
Line 282: Line 376:
                                # Useful if the receiving end does not accept all kinds of characters                                # Useful if the receiving end does not accept all kinds of characters
                                # NB: Only available in Munin-1.2.5 or with the patch described in ticket 34.                                # NB: Only available in Munin-1.2.5 or with the patch described in ticket 34.
 +</code>
  
-===== Summary of Checks ===== +==== Summary of Checks ==== 
-pluginname.service.warning 90  <br> +<code> 
-pluginname.service.critical 95  <br>+pluginname.service.warning 90  
 +pluginname.service.critical 95 
  
-pluginname = ls /etc/munin/plugins/   <br>+pluginname = ls /etc/munin/plugins/  
 servicename = munin-run pluginname servicename = munin-run pluginname
 +</code>
  
  
- +==== Subject Title of Email ====
-===== Subject Title of Email =====+
 contact.me.command mail -s "Munin Notification ${var:host} ${var:graph_title}" user@emailaddress.com contact.me.command mail -s "Munin Notification ${var:host} ${var:graph_title}" user@emailaddress.com
  
Line 299: Line 395:
 Number of Alerts (max messages). I didnt bother setting this. More info can be found at: http://munin.projects.linpro.no/wiki/contact.contact.max_messages Number of Alerts (max messages). I didnt bother setting this. More info can be found at: http://munin.projects.linpro.no/wiki/contact.contact.max_messages
  
-====== Munin via CGI (Reduce CPU Load) ======+===== Munin via CGI (Reduce CPU Load) =====
 As the cpu usage of Munin creating graphs every 5 minutes takes quite a while, munin ships with a cgi script which will render the graphs with all the data. By default the munin-cgi-graph (cgi) is installed with munin. To enable, do the following: As the cpu usage of Munin creating graphs every 5 minutes takes quite a while, munin ships with a cgi script which will render the graphs with all the data. By default the munin-cgi-graph (cgi) is installed with munin. To enable, do the following:
 +<code>
  vi /etc/munin/munin.conf  vi /etc/munin/munin.conf
  graph_strategy cgi  graph_strategy cgi
Line 318: Line 415:
  #create 640 munin adm  #create 640 munin adm
  create 660 munin www-data  create 660 munin www-data
- +</code> 
-Wait 5 minutes for munin to rebuild the html pages. Take a look at the source and you will see something like:<br>+Wait 5 minutes for munin to rebuild the html pages. Take a look at the source and you will see something like:\\
 <img src="/cgi-bin/munin-cgi-graph/burkesys.com/twister.burkesys.com/apache_watch_requests-day.png"... <img src="/cgi-bin/munin-cgi-graph/burkesys.com/twister.burkesys.com/apache_watch_requests-day.png"...
  
 If you see an error or a blank page or a error 500: If you see an error or a blank page or a error 500:
 +<code>
  tail /var/log/apache2/error.log  tail /var/log/apache2/error.log
  #the above error file will reveal all errors.  #the above error file will reveal all errors.
 +</code>
  
-References: <br> +References:
-http://waste.mandragor.org/munin_tutorial/munin.html  <br> +
-http://munin.projects.linpro.no/wiki/CgiHowto  <br>+
  
-Another option for munin (to reduce cpu load) is to edit /etc/cron.d/munin and change the graphing only to per hour.+  * http://waste.mandragor.org/munin_tutorial/munin.html  
 +  * http://munin.projects.linpro.no/wiki/CgiHowto 
  
 +Another option for munin (to reduce cpu load) is to edit /etc/cron.d/munin and change the graphing only to per hour.
  
-====== Monitor Memory Usage of Processes ======+===== Monitor Memory Usage of Processes =====
 <del>I came across a useful article showing how munin can monitor and show the memory usage of a process (apache2 for example) over time. Seeing as I was doing tweaks with MySQL and apache and caching websites, I wanted to see how progress was going. Source website: http://somethingemporium.com/2009/06/monitoring-per-process-memory-usage-with-munin-memory-mod-php <del>I came across a useful article showing how munin can monitor and show the memory usage of a process (apache2 for example) over time. Seeing as I was doing tweaks with MySQL and apache and caching websites, I wanted to see how progress was going. Source website: http://somethingemporium.com/2009/06/monitoring-per-process-memory-usage-with-munin-memory-mod-php
  
Line 351: Line 450:
  #That should do it. Wait and watch for the graphs.  #That should do it. Wait and watch for the graphs.
 </del> </del>
 +<code>
  ln -s /usr/share/munin/plugins/multips_memory /etc/munin/plugins/  ln -s /usr/share/munin/plugins/multips_memory /etc/munin/plugins/
  vi /etc/munin/plugin-conf.d/munin-node  vi /etc/munin/plugin-conf.d/munin-node
Line 358: Line 458:
  :wq  :wq
  /etc/init.d/munin-node restart  /etc/init.d/munin-node restart
 +</code>
  
-Related links: <br> +Related links:  
-http://github.com/dominics/munin-plugins/blob/master/multimemory <br> +  http://github.com/dominics/munin-plugins/blob/master/multimemory 
-http://somethingemporium.com/2009/06/monitoring-per-process-memory-usage-with-munin-memory-mod-php <br> +  http://somethingemporium.com/2009/06/monitoring-per-process-memory-usage-with-munin-memory-mod-php 
-http://www.linuxjournal.com/article/10248 <br> +  http://www.linuxjournal.com/article/10248 
-http://jazstudios.blogspot.com/2009/01/show-ram-memory-usage-linux.html  <br> +  http://jazstudios.blogspot.com/2009/01/show-ram-memory-usage-linux.html  
-http://elinux.org/Runtime_Memory_Measurement+  http://elinux.org/Runtime_Memory_Measurement
  
-====== Extra Links ====== +Extra Links 
-http://edseek.com/archives/2006/07/13/munin-alert-email-notification/  <br> +  http://edseek.com/archives/2006/07/13/munin-alert-email-notification/  
-http://munin.projects.linpro.no/wiki/HowToContact   <br> +  http://munin.projects.linpro.no/wiki/HowToContact   
-http://munin.projects.linpro.no/wiki/munin-man   <br> +  http://munin.projects.linpro.no/wiki/munin-man   
-http://munin.projects.linpro.no/wiki/munin.conf+  http://munin.projects.linpro.no/wiki/munin.conf
  
-====== Update: munin-node on Lenny ======+===== Update: munin-node on Lenny =====
 So I installed munin-node on debian lenny, and it took me a few minutes to see why there were no graphs been generated. Problem: it appears that by default no plugins are enabled by default when installing munin-node. Thats unforunate! So I installed munin-node on debian lenny, and it took me a few minutes to see why there were no graphs been generated. Problem: it appears that by default no plugins are enabled by default when installing munin-node. Thats unforunate!
  
Line 378: Line 479:
  
 To enable the most common plugins go: To enable the most common plugins go:
 +<code>
  /usr/sbin/munin-node-configure --shell | sh  /usr/sbin/munin-node-configure --shell | sh
  ls /etc/munin/plugins  ls /etc/munin/plugins
  /etc/init.d/munin-node restart  /etc/init.d/munin-node restart
 +</code>
  
-====== Split up Munin multi-graphs to separate graphs ======+===== Split up Munin multi-graphs to separate graphs =====
 I use munin to monitor my KVM VMs as outlined on http://wiki.kartbuilding.net/index.php/KVM_Setup_on_Debian_Lenny#Munin_Plugins_for_Libvirt_.2F_KVM This creates graphs like the following below. It shows all VMs listed together. I wanted to be able to separate out the VMs into separate munin graphs which I could then script out and make available to people running the VM. In the example below I wanted to have the VM called **deb04** have its own CPU Usage Graph. I use munin to monitor my KVM VMs as outlined on http://wiki.kartbuilding.net/index.php/KVM_Setup_on_Debian_Lenny#Munin_Plugins_for_Libvirt_.2F_KVM This creates graphs like the following below. It shows all VMs listed together. I wanted to be able to separate out the VMs into separate munin graphs which I could then script out and make available to people running the VM. In the example below I wanted to have the VM called **deb04** have its own CPU Usage Graph.
-===== Before =====+==== Before ====
 http://wiki.kartbuilding.net/images/libvirt_cputime-day.png http://wiki.kartbuilding.net/images/libvirt_cputime-day.png
 +<code>
  
  vi /etc/munin/munin.conf  vi /etc/munin/munin.conf
Line 392: Line 496:
         use_node_name yes         use_node_name yes
    
-        #libvirt_cputime.deb04_cputime.graph no                  <nowiki>//</nowiki>Uncomment this so the main Graph does not show Deb04+        #libvirt_cputime.deb04_cputime.graph no              #Uncomment this so the main Graph does not show Deb04
         libvirt_cputime_deb04.graph_title Deb04 CPU         libvirt_cputime_deb04.graph_title Deb04 CPU
         libvirt_cputime_deb04.update no         libvirt_cputime_deb04.update no
-        libvirt_cputime_deb04.graph_args -u 100                  <nowiki>//</nowiki>Set the Upper limit to 100% +        libvirt_cputime_deb04.graph_args -u 100              #Set the Upper limit to 100% 
-        libvirt_cputime_deb04.deb04.cdef deb04,8,              <nowiki>//</nowiki>Multiplier for number of cores (Core i7) to show 100% usage on graph at full cpu usage of VM+        libvirt_cputime_deb04.deb04.cdef deb04,8,          #Multiplier for number of cores (Core i7) to show 100% usage on graph at full cpu usage of VM
         libvirt_cputime_deb04.graph_category Virtual Machines         libvirt_cputime_deb04.graph_category Virtual Machines
         libvirt_cputime_deb04.graph_order deb04=server.domain.com:libvirt_cputime.deb04_cputime         libvirt_cputime_deb04.graph_order deb04=server.domain.com:libvirt_cputime.deb04_cputime
 +</code>
  
-===== After =====+==== After ====
 http://wiki.kartbuilding.net/images/libvirt_cputime_split-out-vm.gif http://wiki.kartbuilding.net/images/libvirt_cputime_split-out-vm.gif
  
 Because I use cgi to render the images, I can now script the URL: http://domain.com/cgi-bin/munin-cgi-graph/domain.com/server.domain.com/libvirt_cputime_deb04-day.pn g Because I use cgi to render the images, I can now script the URL: http://domain.com/cgi-bin/munin-cgi-graph/domain.com/server.domain.com/libvirt_cputime_deb04-day.pn g
  
-Links: <br> +Links: 
-No 1 source: http://ingvar.blog.linpro.no/2008/04/07/todays-munin-tip-splitting-out-a-noisy-graph-from-munin/  <br> +  No 1 source: http://ingvar.blog.linpro.no/2008/04/07/todays-munin-tip-splitting-out-a-noisy-graph-from-munin/  
-No 2 source: http://munin-monitoring.org/wiki/protocol-config  <br> +  No 2 source: http://munin-monitoring.org/wiki/protocol-config   
-http://munin-monitoring.org/wiki/graph_args <br> +  http://munin-monitoring.org/wiki/graph_args  
-http://munin-monitoring.org/wiki/munin-man  <br> +  http://munin-monitoring.org/wiki/munin-man  
-http://munin-monitoring.org/wiki/plugin-bcp#Graphscaling  <br> +  http://munin-monitoring.org/wiki/plugin-bcp#Graphscaling  
-http://munin-monitoring.org/wiki/fieldname.cdef  <br> +  http://munin-monitoring.org/wiki/fieldname.cdef  
-Sample http://munin-monitoring.org/wiki/PercentGraphHowto  <br>+  Sample http://munin-monitoring.org/wiki/PercentGraphHowto 
  
-====== Apache Mod_Watch & Munin Graphs showing vhost accesses ======+===== Apache Mod_Watch & Munin Graphs showing vhost accesses =====
 While this is more of an apache topic than a munin one, the main reason I wanted to compile the mod_watch module for apache is so I can graph vhost usage and access. Munin will then show graphs of how much a vhost is used. Also, while there are other how-to websites out there for this, they seem to drop off and disappear after a few years. While this is more of an apache topic than a munin one, the main reason I wanted to compile the mod_watch module for apache is so I can graph vhost usage and access. Munin will then show graphs of how much a vhost is used. Also, while there are other how-to websites out there for this, they seem to drop off and disappear after a few years.
  
Line 420: Line 525:
  
 The main reference I used was: http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ This worked perfectly. There was an issue with debian squeeze which will be sorted below. The main reference I used was: http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ This worked perfectly. There was an issue with debian squeeze which will be sorted below.
-===== Compile =====+ 
 +==== Compile ==== 
 +<code>
  apt-get install apache2-dev libcrypt-ssleay-perl libwww-perl make  apt-get install apache2-dev libcrypt-ssleay-perl libwww-perl make
  wget http://wiki.kartbuilding.net/mod_watch-4.3_apache22_mod.tar.gz  wget http://wiki.kartbuilding.net/mod_watch-4.3_apache22_mod.tar.gz
Line 430: Line 537:
  make -f Makefile.dso build  make -f Makefile.dso build
  make -f Makefile.dso install   make -f Makefile.dso install 
- +</code> 
-===== Add and config mod_watch apache module =====+==== Add and config mod_watch apache module ==== 
 +<code>
  vi /etc/apache2/mods-available/watch.load  vi /etc/apache2/mods-available/watch.load
- <nowiki>//</nowiki>add in+ #add in
  LoadModule watch_module /usr/lib/apache2/modules/mod_watch.so  LoadModule watch_module /usr/lib/apache2/modules/mod_watch.so
    
Line 452: Line 560:
    
  /etc/init.d/apache2 restart  /etc/init.d/apache2 restart
-===== Checking mod_watch for errors =====+</code> 
 + 
 +==== Checking mod_watch for errors ==== 
 +<code>
  elinks http://localhost/watch-list  elinks http://localhost/watch-list
  #check for output  #check for output
-===== mod_watch Errors received =====+</code> 
 + 
 +==== mod_watch Errors received ====
 in error.log with Debian Squeeze running 2.6.32-5-amd64 in error.log with Debian Squeeze running 2.6.32-5-amd64
 +<code>
  tail -f /var/log/apache2/error.log  tail -f /var/log/apache2/error.log
- <nowiki>//</nowiki>I noticed the following warns when I accessed any vhosts with mod_watch enabled+ #I noticed the following warns when I accessed any vhosts with mod_watch enabled
  [[Fri|Mar 18 22:35:36 2011]] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchPostReadRequestHash()  [[Fri|Mar 18 22:35:36 2011]] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchPostReadRequestHash()
  [[Fri|Mar 18 22:35:36 2011]] [error] shVerifyString(7fca84e5aae8, 7fca83c946f8) failed!  [[Fri|Mar 18 22:35:36 2011]] [error] shVerifyString(7fca84e5aae8, 7fca83c946f8) failed!
Line 464: Line 578:
  [[Fri|Mar 18 22:35:36 2011]] [error] shVerifyString(7fca84e5aae8, 7fca83c94718) failed!  [[Fri|Mar 18 22:35:36 2011]] [error] shVerifyString(7fca84e5aae8, 7fca83c94718) failed!
  [[Fri|Mar 18 22:35:36 2011]] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchLogHash()  [[Fri|Mar 18 22:35:36 2011]] [crit] (20014)Internal error: shGetLockedEntry(7fca84e5aae8, "SERVER") failed in watchLogHash()
-  +</code> 
-===== resolve mod_watch errors =====+=== resolve mod_watch errors ===
 Googling led me to http://forums.cacti.net/viewtopic.php?p=186639#p186639 Googling led me to http://forums.cacti.net/viewtopic.php?p=186639#p186639
 +<code>
  cd /root/mod_watch-4.3_apache22_mod/  cd /root/mod_watch-4.3_apache22_mod/
  vi SharedHash.c  vi SharedHash.c
- <nowiki>//</nowiki>on line 102 change to look like:+ #on line 102 change to look like:
  shVerifyString(struct shTable *tp, char *str)  shVerifyString(struct shTable *tp, char *str)
  {  {
Line 477: Line 592:
             return str;             return str;
     }     }
-So now browing various vhosts on the server showed no errors in error.log. Using elinks (apt-get install elinks) going to http://localhost/watch-list showed results.+</code> 
 +So now browsing various vhosts on the server showed no errors in error.log. Using elinks (apt-get install elinks) going to http://localhost/watch-list showed results.
  
-===== Munin Plugin for Mod_Watch =====+==== Munin Plugin for Mod_Watch ==== 
 +<code>
  cd /usr/share/munin/plugins  cd /usr/share/munin/plugins
  wget http://wiki.kartbuilding.net/apache_watch  wget http://wiki.kartbuilding.net/apache_watch
  chmod 755 apache_watch  chmod 755 apache_watch
  vi apache_watch  vi apache_watch
- <nowiki>//</nowiki>change my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://monitor2.burkesys.com:%d/watch-list"; to:+ #change my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://monitor2.burkesys.com:%d/watch-list"; to:
  my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://server.com:%d/watch-list";  my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://server.com:%d/watch-list";
    
  ln -s /usr/share/munin/plugins/apache_watch /etc/munin/plugins/apache_watch_requests  ln -s /usr/share/munin/plugins/apache_watch /etc/munin/plugins/apache_watch_requests
  
 +</code>
 That should do it. Once mod_watch is working and accessible munin should pick it up ok. That should do it. Once mod_watch is working and accessible munin should pick it up ok.
 References: References:
-http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ <br> +  * http://stubbedtoe.co.nz/index.php/2009/09/apache-vhost-monitoring-with-munin/ 
-http://exchange.munin-monitoring.org/plugins/apache_watch_/version/<br> +  http://exchange.munin-monitoring.org/plugins/apache_watch_/version/
-http://forums.cacti.net/about15475.html+  http://forums.cacti.net/about15475.html
  
 This is a nice apache module. I'm surprised that there is no maintained similar apache module. I've seen another similar munin plugin that parses /var/log/apache2/vhost%_access.log to generate these graphs, however it requires separate log files for each vhost and parses the logs every so often. Any more info /queries / suggestions drop us a mail sburke[[at]]burkesys.com This is a nice apache module. I'm surprised that there is no maintained similar apache module. I've seen another similar munin plugin that parses /var/log/apache2/vhost%_access.log to generate these graphs, however it requires separate log files for each vhost and parses the logs every so often. Any more info /queries / suggestions drop us a mail sburke[[at]]burkesys.com
  
-====== Migrate Munin RRD Graphs between x32 and x64 ======+===== Migrate Munin RRD Graphs between x32 and x64 =====
 Although not critical, on setting up a new munin server on x64 debian, I wanted to keep the existing graphs which were made on a x32 debian server. Copying across the various folders in /etc/munin/munin.conf was easy. However when munin ran on the new x64 server errors appeared in /var/log/munin/ The reason for this is that RRD is x32 or x64 specific. Although not critical, on setting up a new munin server on x64 debian, I wanted to keep the existing graphs which were made on a x32 debian server. Copying across the various folders in /etc/munin/munin.conf was easy. However when munin ran on the new x64 server errors appeared in /var/log/munin/ The reason for this is that RRD is x32 or x64 specific.
  
Line 504: Line 622:
 The above kind person created two scripts, a dump.sh and a restore.sh that goes through all rrd files munin created and exports them out as xml files. The above kind person created two scripts, a dump.sh and a restore.sh that goes through all rrd files munin created and exports them out as xml files.
 It worked nicely. It worked nicely.
 +
 +<code>
  
  dump.sh:  dump.sh:
Line 517: Line 637:
  done  done
  
 +</code>
 Scp across /var/lib/munin onto the new server. (Might want to tar it up, as it'd be quite big in size). Scp across /var/lib/munin onto the new server. (Might want to tar it up, as it'd be quite big in size).
  
 +<code>
  restore.sh:  restore.sh:
   #!/bin/bash   #!/bin/bash
Line 531: Line 653:
  chown munin:munin "${f_rrd}"  chown munin:munin "${f_rrd}"
  done  done
 +</code>
  
 Code above from: http://ken.ipl31.net/2009/04/27/this-rrd-was-created-on-other-architecture/ Code above from: http://ken.ipl31.net/2009/04/27/this-rrd-was-created-on-other-architecture/
munin_statistics.1658261600.txt.gz · Last modified: 2022/07/19 21:13 by 127.0.0.1