summaryrefslogtreecommitdiff
path: root/manifests/server/munin/default.pp
blob: 130f3dcf4c17bdb9cee023f60d910d81bcaf3ee0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# manifests/server/munin/default.pp

class mysql::server::munin::default inherits mysql::server::munin::base {
    case $munin_mysql_password {
        '': { fail("please specify \$munin_mysql_password to enable mysql munin plugin")}
    }

    mysql_user{'munin@localhost':
        password_hash => mysql_password("$munin_mysql_password"),
        require => Package['mysql'],
    }

    mysql_grant{'munin@localhost':
        privileges => 'select_priv',
        require => [ Mysql_user['munin@localhost'], Package['mysql'] ],
    }

    munin::plugin {
      [ mysql_bytes, mysql_queries, mysql_slowqueries, mysql_threads ]:
        config => "env.mysqlopts --user=munin --password=${munin_mysql_password} -h localhost",
        require => [ Mysql_grant['munin@localhost'], Mysql_user['munin@localhost'], Package['mysql'] ];

      [ mysql_connections, mysql_qcache, mysql_cache_mem, mysql_size_all ]:
        script_path_in => "/usr/local/share/munin-plugins",
        config => "env.mysqlopts --user=munin --password=${munin_mysql_password} -h localhost",
        require => [ Mysql_grant['munin@localhost'], Mysql_user['munin@localhost'], Package['mysql'] ];
    }

    Munin::Plugin::Deploy {
      config => "env.mysqlopts --user=munin --password=$munin_mysql_password -h localhost",
      require =>
      [ Mysql_grant['munin@localhost'],
        Mysql_user['munin@localhost'],
        Package['mysql'] ]
    }
    munin::plugin::deploy{
      'mysql_connections':
        source => 'mysql/munin/mysql_connections';
      'mysql_qcache':
        source => 'mysql/munin/mysql_qcache';
      'mysql_qcache_mem':
        source => 'mysql/munin/mysql_qcache_mem';
    }
}