Puppet Class: monitoring::monitoring::sensu::mysql

Defined in:
manifests/monitoring/sensu/mysql.pp

Overview

Class: monitoring::monitoring::mysql

Parameters:

  • plugins_location (Any) (defaults to: '/opt/sensu/embedded/bin/')
  • mysql_username (Any) (defaults to: false)
  • mysql_password (Any) (defaults to: false)


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
# File 'manifests/monitoring/sensu/mysql.pp', line 4

class monitoring::monitoring::sensu::mysql (
  $plugins_location = '/opt/sensu/embedded/bin/',
  $mysql_username   = false,
  $mysql_password   = false,) {

  # TODO; dynamically create mysql credentials if mysql is present

  sensu::check { 'mysql-process': command => "${plugins_location}check-process.rb --pattern mysqld --warn-under 1", }

  if ($mysql_username) {
    package { 'sensu-plugins-mysql':
      ensure   => 'present',
      provider => sensu_gem,
    }

    $check_args = "-h localhost -u ${mysql_username} -p ${mysql_password} -s /run/mysqld/mysqld.sock"

    sensu::check { 'mysql-alive': command => "${plugins_location}check-mysql-alive.rb ${check_args}", }

    sensu::check { 'mysql-connections': command => "${plugins_location}check-mysql-connections.rb ${check_args}", }

    sensu::check { 'mysql-innodb-lock': command => "${plugins_location}check-mysql-innodb-lock.rb ${check_args}", }

    sensu::check { 'mysql-threads': command => "${plugins_location}check-mysql-threads.rb ${check_args}", }

  }
}