Import rest of modules.
This commit is contained in:
parent
02fa10f33c
commit
3f225ced9b
39 changed files with 2056 additions and 0 deletions
78
munin/files/munin.conf.in
Normal file
78
munin/files/munin.conf.in
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Example configuration file for Munin, generated by 'make build'
|
||||
|
||||
# The next three variables specifies where the location of the RRD
|
||||
# databases, the HTML output, and the logs, severally. They all
|
||||
# must be writable by the user running munin-cron.
|
||||
dbdir /var/lib/munin
|
||||
htmldir /var/www/html/munin
|
||||
logdir /var/log/munin
|
||||
rundir /var/run/munin
|
||||
|
||||
# Where to look for the HTML templates
|
||||
tmpldir /etc/munin/templates
|
||||
|
||||
# Make graphs show values per minute instead of per second
|
||||
#graph_period minute
|
||||
|
||||
# Graphics files are normaly generated by munin-graph, no matter if
|
||||
# the graphs are used or not. You can change this to
|
||||
# on-demand-graphing by following the instructions in
|
||||
# http://munin.projects.linpro.no/wiki/CgiHowto
|
||||
#
|
||||
#graph_strategy cgi
|
||||
|
||||
# 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/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
|
||||
|
||||
# a simple host tree
|
||||
#[localhost]
|
||||
# address 127.0.0.1
|
||||
# use_node_name yes
|
||||
|
||||
#
|
||||
# A more complex example of a host tree
|
||||
#
|
||||
## First our "normal" host.
|
||||
# [fii.foo.com]
|
||||
# address foo
|
||||
#
|
||||
## Then our other host...
|
||||
# [fay.foo.com]
|
||||
# address fay
|
||||
#
|
||||
## Then we want totals...
|
||||
# [foo.com;Totals] #Force it into the "foo.com"-domain...
|
||||
# update no # Turn off data-fetching for this "host".
|
||||
#
|
||||
# # The graph "load1". We want to see the loads of both machines...
|
||||
# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
|
||||
# load1.graph_title Loads side by side
|
||||
# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
|
||||
#
|
||||
# # The graph "load2". Now we want them stacked on top of each other.
|
||||
# load2.graph_title Loads on top of each other
|
||||
# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
|
||||
# load2.dummy_field.draw AREA # We want area instead the default LINE2.
|
||||
# load2.dummy_field.label dummy # This is needed. Silly, really.
|
||||
#
|
||||
# # The graph "load3". Now we want them summarised into one field
|
||||
# load3.graph_title Loads summarised
|
||||
# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
|
||||
# load3.combined_loads.label Combined loads # Must be set, as this is
|
||||
# # not a dummy field!
|
||||
#
|
||||
## ...and on a side note, I want them listen in another order (default is
|
||||
## alphabetically)
|
||||
#
|
||||
# # Since [foo.com] would be interpreted as a host in the domain "com", we
|
||||
# # specify that this is a domain by adding a semicolon.
|
||||
# [foo.com;]
|
||||
# node_order Totals fii.foo.com fay.foo.com
|
||||
#
|
||||
|
2
munin/files/plugin-conf/vmware
Normal file
2
munin/files/plugin-conf/vmware
Normal file
|
@ -0,0 +1,2 @@
|
|||
[vmware*]
|
||||
user root
|
56
munin/files/plugins/vmware_vms
Executable file
56
munin/files/plugins/vmware_vms
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor running and registered virtual machines in the system.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x /usr/bin/vmware-vim-cmd ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title VMware virtual machines'
|
||||
echo 'graph_vlabel number of virtual machines'
|
||||
echo 'graph_category vmware'
|
||||
echo 'graph_info This graph monitors registered and running virtual machines.'
|
||||
|
||||
echo 'running.label running'
|
||||
echo 'running.info Running virtual machines.'
|
||||
|
||||
echo 'registered.label registered'
|
||||
echo 'registered.info Registered virtual machines.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vmware-vim-cmd vmsvc/getallvms | awk '
|
||||
BEGIN {
|
||||
registered = 0;
|
||||
running = 0;
|
||||
}
|
||||
{
|
||||
if (/^[0-9]+/) {
|
||||
registered++;
|
||||
("vmware-vim-cmd vmsvc/power.getstate " $1 " | grep Powered") | getline state;
|
||||
if (state == "Powered on") {
|
||||
running++;
|
||||
}
|
||||
}
|
||||
}
|
||||
END {
|
||||
print "registered.value " registered
|
||||
print "running.value " running
|
||||
}
|
||||
'
|
79
munin/files/plugins/vmware_vms,v
Executable file
79
munin/files/plugins/vmware_vms,v
Executable file
|
@ -0,0 +1,79 @@
|
|||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks; strict;
|
||||
comment @# @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2009.05.28.10.27.06; author root; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Initial revision
|
||||
@
|
||||
text
|
||||
@#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor running and registered virtual machines in the system.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x /usr/bin/vmware-vim-cmd ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title VMware virtual machines'
|
||||
echo 'graph_vlabel number of virtual machines'
|
||||
echo 'graph_category vmware'
|
||||
echo 'graph_info This graph monitors registered and running virtual machines.'
|
||||
|
||||
echo 'running.label running'
|
||||
echo 'running.info Running virtual machines.'
|
||||
|
||||
echo 'registered.label registered'
|
||||
echo 'registered.info Registered virtual machines.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vmware-vim-cmd vmsvc/getallvms | awk '
|
||||
BEGIN {
|
||||
registered = 0;
|
||||
running = 0;
|
||||
}
|
||||
{
|
||||
if (/^[0-9]+/) {
|
||||
registered++;
|
||||
("vmware-vim-cmd vmsvc/power.getstate " $1 " | grep Powered") | getline state;
|
||||
if (state == "Powered on") {
|
||||
running++;
|
||||
}
|
||||
}
|
||||
}
|
||||
END {
|
||||
print "registered.value " registered
|
||||
print "running.value " running
|
||||
}
|
||||
'
|
||||
@
|
141
munin/manifests/init.pp
Normal file
141
munin/manifests/init.pp
Normal file
|
@ -0,0 +1,141 @@
|
|||
|
||||
# Install and configure munin node.
|
||||
#
|
||||
class munin::node {
|
||||
|
||||
package { "munin-node":
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
service { "munin-node":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Package["munin-node"],
|
||||
}
|
||||
|
||||
file { "/etc/munin/munin-node.conf":
|
||||
ensure => present,
|
||||
content => template("munin/munin-node.conf.erb"),
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 0644,
|
||||
require => Package["munin-node"],
|
||||
notify => Service["munin-node"],
|
||||
}
|
||||
|
||||
@@file { "/etc/munin/nodes.d/${fqdn}.conf":
|
||||
content => "[${fqdn}]\n address ${ipaddress}\n use_node_name yes\n",
|
||||
ensure => present,
|
||||
tag => "munin",
|
||||
notify => Exec["generate-munin-conf"],
|
||||
}
|
||||
|
||||
exec { "munin-node-configure":
|
||||
command => "munin-node-configure ; true",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
user => root,
|
||||
refreshonly => true,
|
||||
require => Package["munin-node"],
|
||||
subscribe => Package["munin-node"],
|
||||
notify => Service["munin-node"],
|
||||
}
|
||||
|
||||
munin::plugin { "vmware_vms": config => "vmware" }
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Add new custom munin plugin.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# Plugin name to install.
|
||||
# $config:
|
||||
# Configuration file name associated with plugin. Defaults to none.
|
||||
#
|
||||
# === Sample usage
|
||||
#
|
||||
# munin::plugin { "vmware_vms":
|
||||
# config => "vmware",
|
||||
# }
|
||||
#
|
||||
define munin::plugin($config = "") {
|
||||
|
||||
file { "/usr/share/munin/plugins/${name}":
|
||||
ensure => present,
|
||||
source => "puppet:///munin/plugins/${name}",
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 0755,
|
||||
require => Package["munin-node"],
|
||||
}
|
||||
|
||||
if ($config) {
|
||||
file { "/etc/munin/plugin-conf.d/${config}":
|
||||
ensure => present,
|
||||
source => [ "puppet:///files/munin/plugin-conf/${config}.${fqdn}",
|
||||
"puppet:///files/munin/plugin-conf/${config}",
|
||||
"puppet:///munin/plugin-conf/${config}", ],
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 0644,
|
||||
notify => Service["munin-node"],
|
||||
require => File["/usr/share/munin/plugins/${name}"],
|
||||
}
|
||||
}
|
||||
|
||||
exec { "munin-enable-${name}":
|
||||
command => "ln -s /usr/share/munin/plugins/${name} /etc/munin/plugins/${name}",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
user => root,
|
||||
onlyif => [ "! test -h /etc/munin/plugins/${name}",
|
||||
"/usr/share/munin/plugins/${name} autoconf", ],
|
||||
notify => Service["munin-node"],
|
||||
require => File["/usr/share/munin/plugins/${name}"],
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Install and configure munin server.
|
||||
#
|
||||
# === Requires
|
||||
#
|
||||
# * Storedconfigs
|
||||
#
|
||||
class munin::server {
|
||||
|
||||
package { "munin":
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
file { "/etc/munin/nodes.d":
|
||||
ensure => directory,
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 0755,
|
||||
require => Package["munin"],
|
||||
}
|
||||
|
||||
file { "/etc/munin/munin.conf.in":
|
||||
ensure => present,
|
||||
source => "puppet:///munin/munin.conf.in",
|
||||
owner => root,
|
||||
group => root,
|
||||
mode => 0644,
|
||||
require => Package["munin"],
|
||||
notify => Exec["generate-munin-conf"],
|
||||
}
|
||||
|
||||
exec { "generate-munin-conf":
|
||||
command => "cat /etc/munin/munin.conf.in /etc/munin/nodes.d/*.conf > /etc/munin/munin.conf",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
user => root,
|
||||
refreshonly => true,
|
||||
require => File["/etc/munin/munin.conf.in"],
|
||||
}
|
||||
|
||||
File <<| tag == "munin" |>>
|
||||
|
||||
}
|
44
munin/templates/munin-node.conf.erb
Normal file
44
munin/templates/munin-node.conf.erb
Normal file
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Example config-file for munin-node
|
||||
#
|
||||
|
||||
log_level 4
|
||||
log_file /var/log/munin/munin-node.log
|
||||
pid_file /var/run/munin/munin-node.pid
|
||||
|
||||
background 1
|
||||
setseid 1
|
||||
|
||||
user root
|
||||
group root
|
||||
setsid yes
|
||||
|
||||
# Regexps for files to ignore
|
||||
|
||||
ignore_file ~$
|
||||
ignore_file \.bak$
|
||||
ignore_file %$
|
||||
ignore_file \.dpkg-(tmp|new|old|dist)$
|
||||
ignore_file \.rpm(save|new)$
|
||||
ignore_file \.pod$
|
||||
|
||||
# Set this if the client doesn't report the correct hostname when
|
||||
# telnetting to localhost, port 4949
|
||||
#
|
||||
#host_name ppc3.fedora.redhat.com
|
||||
host_name <%= fqdn %>
|
||||
|
||||
# A list of addresses that are allowed to connect. This must be a
|
||||
# regular expression, due to brain damage in Net::Server, which
|
||||
# doesn't understand CIDR-style network notation. You may repeat
|
||||
# the allow line as many times as you'd like
|
||||
|
||||
allow <%= munin_allow %>
|
||||
|
||||
# Which address to bind to;
|
||||
host <%= ipaddress %>
|
||||
# host 127.0.0.1
|
||||
|
||||
# And which port
|
||||
port 4949
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue