summaryrefslogtreecommitdiff
path: root/manifests/service/mysql.pp
blob: 9d99d09f616d467f9ac4baf27d421465e058f5ff (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
define nagios::service::mysql(
    $ensure = present,
    $check_hostname = 'localhost',
    $check_socket = 'absent',
    $check_username = 'nagios',
    $check_password = '',
    $check_mode = 'tcp'
){

    case $check_mode {
        # Check MySQL using TCP
        'tcp': {
            nagios::service { 'mysql_tcp':
                ensure => $ensure,
                check_command => "check_mysql_tcp!${check_hostname}!${check_username}!${check_password}",
            }
        }
        # Check MySQL using local socket
        default: {
            nagios::service { 'mysql_socket':
                ensure => $ensure,
                check_command => $check_socket ? {
                    'absent' => "check_mysql!${check_username}!${check_password}!${check_database}",
                    default => "check_mysql_socket!${check_socket}!${check_username}!${check_password}",
                },
            }
        }
    }
}