Initial commit of munin role for RedHat/CentOS.

master
Jeff Geerling 2014-05-11 13:10:54 -05:00
commit 525585fb83
9 changed files with 204 additions and 0 deletions

35
README.md Normal file
View File

@ -0,0 +1,35 @@
# Ansible Role: Munin
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-munin.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-munin)
Installs munin, a monitoring system, on RedHat/CentOS.
## Requirements
None.
## Role Variables
Available variables are listed below, along with default values (see `vars/main.yml`):
TODO
## Dependencies
- geerlingguy.repo-epel
Additionally, if you'd like to view the graphs via HTTP, you will need a server like Apache or Nginx running, to serve the munin-generated HTML and graphs.
## Example Playbook
- hosts: servers
roles:
- { role: geerlingguy.munin }
## License
MIT / BSD
## Author Information
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).

2
handlers/main.yml Normal file
View File

@ -0,0 +1,2 @@
---
# TODO

17
meta/main.yml Normal file
View File

@ -0,0 +1,17 @@
---
dependencies:
- { role: geerlingguy.repo-epel }
galaxy_info:
author: geerlingguy
description: Munin monitoring server for RedHat/CentOS.
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 1.4
platforms:
- name: EL
versions:
- all
categories:
- monitoring
- system

23
tasks/main.yml Normal file
View File

@ -0,0 +1,23 @@
---
- name: Ensure python-passlib is installed (RedHat).
yum: pkg=python-passlib state=installed
- name: Ensure munin is installed (RedHat).
yum: pkg=munin state=installed
- name: Copy munin configurations.
template: >
src={{ item.src }}
dest={{ item.dest }}
owner=root group=root mode=644
with_items:
- { src: munin.conf.j2, dest: /etc/munin/munin.conf }
- { src: hosts.conf.j2, dest: /etc/munin/conf.d/hosts.conf }
- name: Create munin user via htpasswd.
htpasswd: >
create=yes
name={{ munin_admin_user }}
password={{ munin_admin_password }}
path=/etc/munin/munin-htpasswd
state=present

11
templates/hosts.conf.j2 Normal file
View File

@ -0,0 +1,11 @@
# Munin hosts.
{% for host in munin_hosts %}
[{{ host.name }}]
address {{ host.address }}
{% if host.extra %}
{% for extra in host.extra %}
{{ extra }}
{% endfor %}
{% endif %}
{% endfor %}

82
templates/munin.conf.j2 Normal file
View File

@ -0,0 +1,82 @@
# Munin master configuration.
# Location of the databases, HTML output, logs, and pid files.
dbdir {{ munin_dbdir }}
htmldir {{ munin_htmldir }}
logdir {{ munin_logdir }}
rundir {{ munin_rundir }}
# Where to look for the HTML templates
tmpldir /etc/munin/templates
# Where to look for the static www files
#staticdir /etc/munin/static
# temporary cgi files are here. note that it has to be writable by
# the cgi user (usually nobody or httpd).
#
# cgitmpdir @@CGITMPDIR@@
# (Exactly one) directory to include all files from.
includedir /etc/munin/conf.d
# You can choose the time reference for "DERIVE" like graphs, and show
# "per minute", "per hour" values instead of the default "per second"
#graph_period second
# Graphics files are generated either via cron or by a CGI process.
# See http://munin-monitoring.org/wiki/CgiHowto2 for more
# documentation.
# Since 2.0, munin-graph has been rewritten to use the cgi code.
# It is single threaded *by design* now.
graph_strategy cron
# munin-cgi-graph is invoked by the web server up to very many times at the
# same time. This is not optimal since it results in high CPU and memory
# consumption to the degree that the system can thrash. Again the default is
# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as
# max_graph_jobs.
#munin_cgi_graph_jobs 6
# If the automatic CGI url is wrong for your system override it here:
cgiurl_graph /munin-cgi/munin-cgi-graph
# max_size_x and max_size_y are the max size of images in pixel.
# Default is 4000. Do not make it too large otherwise RRD might use all
# RAM to generate the images.
#max_size_x 4000
#max_size_y 4000
# HTML files are normally generated by munin-html, no matter if the
# files are used or not. You can change this to on-demand generation
# by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2
# Notes:
# - moving to CGI for HTML means you cannot have graph generated by cron.
# - cgi html has some bugs, mostly you still have to launch munin-html by hand
html_strategy {{ munin_html_strategy }}
# munin-update runs in parallel.
#
# The default max number of processes is 16, and is probably ok for you.
#
# If set too high, it might hit some process/ram/filedesc limits.
# If set too low, munin-update might take more than 5 min.
#
# If you want munin-update to not be parallel set it to 0.
max_processes {{ munin_max_processes }}
# RRD updates are per default, performed directly on the rrd files.
# To reduce IO and enable the use of the rrdcached, uncomment it and set it to
# the location of the socket that rrdcached uses.
#rrdcached_socket /var/run/rrdcached.sock
# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
# something changes (OK -> WARNING, CRITICAL -> OK, etc)
#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
#
# For those with Nagios, the following might come in handy. In addition,
# the services must be defined in the Nagios server as well.
#contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf
# Hosts are defined separately, in /etc/munin/conf.d/hosts.conf

1
tests/inventory Normal file
View File

@ -0,0 +1 @@
localhost

5
tests/test.yml Normal file
View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- ansible-role-munin

28
vars/main.yml Normal file
View File

@ -0,0 +1,28 @@
---
munin_dbdir: /var/lib/munin
munin_htmldir: /var/www/html/munin
munin_logdir: /var/log/munin
munin_rundir: /var/run/munin
munin_html_strategy: cron
munin_max_processes: 12
munin_admin_user: munin
munin_admin_password: munin
# Will be translated into:
# [host]
# address: [name]
# [extra.0]
# [extra.1]
# [...]
#
# Note that `name` can be hostname, or group + hostname, for example:
# [example.com;foo.example.com]
munin_hosts:
- {
name: "localhost",
address: "127.0.0.1",
extra: ["use_node_name yes"]
}