Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from kcampos/mysql-int
Add class for mysql integration
- Loading branch information
Showing
4 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Class: datadog::integrations::mysql | ||
# | ||
# This class will install the necessary configuration for the mysql integration | ||
# | ||
# Parameters: | ||
# $host: | ||
# The host mysql is running on | ||
# $password | ||
# The mysql password for the datadog user | ||
# $user | ||
# The mysql user for the datadog user | ||
# $tags | ||
# Optional array of tags | ||
# $replication | ||
# replication option | ||
# $galera_cluster | ||
# galera cluster option | ||
# | ||
# Sample Usage: | ||
# | ||
# class { 'datadog::integrations::mysql' : | ||
# host => 'localhost', | ||
# password => 'some_pass', | ||
# user => 'datadog' | ||
# } | ||
# | ||
# | ||
class datadog::integrations::mysql( | ||
$host, | ||
$password, | ||
$user = 'datadog', | ||
$tags = [], | ||
$replication = '0', | ||
$galera_cluster = '0' | ||
) inherits datadog::params { | ||
|
||
package { $mysql_int_package : | ||
ensure => installed, | ||
} | ||
|
||
file { "${conf_dir}/mysql.yaml": | ||
ensure => file, | ||
owner => $dd_user, | ||
group => $dd_group, | ||
mode => 0644, | ||
content => template('datadog/mysql.yaml.erb'), | ||
require => Package[$mysql_int_package], | ||
notify => Service[$service_name] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
init_config: | ||
|
||
instances: | ||
- server: <%= @host %> | ||
user: <%= @user %> | ||
pass: <%= @password %> | ||
<% if !@tags.empty? -%> | ||
tags: | ||
<% @tags.each do |tag| -%> | ||
- <%= tag %> | ||
<% end -%> | ||
<% end -%> | ||
options: | ||
replication: <%= @replication %> | ||
galera_cluster: <%= @galera_cluster %> |