Skip to content

Commit 1e2a1cd

Browse files
authored
Merge pull request DataDog#247 from haylix/master
Added cacti integration
2 parents 97f2666 + 64ffa47 commit 1e2a1cd

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

manifests/integrations/cacti.pp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Class: datadog_agent::integrations::cacti
2+
#
3+
# This class will install the necessary configuration for the cacti integration
4+
#
5+
# Parameters:
6+
# $host:
7+
# The host cacti MySQL db is running on
8+
# $user
9+
# The cacti MySQL password
10+
# $password
11+
# The cacti MySQL sb port.
12+
# $path
13+
# The path to the cacti rrd directory e.g. /var/lib/cacti/rra/
14+
#
15+
class datadog_agent::integrations::cacti(
16+
$mysql_host = 'localhost',
17+
$mysql_user = 'cacti',
18+
$mysql_password = undef,
19+
$rrd_path = '/var/lib/cacti/rra/',
20+
) inherits datadog_agent::params {
21+
include datadog_agent
22+
23+
file { "${datadog_agent::params::conf_dir}/cacti.yaml":
24+
ensure => file,
25+
owner => $datadog_agent::params::dd_user,
26+
group => $datadog_agent::params::dd_group,
27+
mode => '0600',
28+
content => template('datadog_agent/agent-conf.d/cacti.yaml.erb'),
29+
require => Package[$datadog_agent::params::package_name],
30+
notify => Service[$datadog_agent::params::service_name]
31+
}
32+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
describe 'datadog_agent::integrations::cacti' do
4+
let(:facts) {{
5+
operatingsystem: 'Ubuntu',
6+
}}
7+
let(:conf_dir) { '/etc/dd-agent/conf.d' }
8+
let(:dd_user) { 'dd-agent' }
9+
let(:dd_group) { 'root' }
10+
let(:dd_package) { 'datadog-agent' }
11+
let(:dd_service) { 'datadog-agent' }
12+
let(:conf_file) { "#{conf_dir}/cacti.yaml" }
13+
14+
context 'with default parameters' do
15+
it { should compile }
16+
end
17+
18+
context 'with parameters set' do
19+
let(:params) {{
20+
mysql_host: 'localhost',
21+
mysql_user: 'foo',
22+
mysql_password: 'bar',
23+
rrd_path: 'path',
24+
}}
25+
it { should contain_file(conf_file).with_content(/mysql_host: localhost/) }
26+
it { should contain_file(conf_file).with_content(/mysql_user: foo/) }
27+
it { should contain_file(conf_file).with_content(/mysql_password: bar/) }
28+
it { should contain_file(conf_file).with_content(/rrd_path: path/) }
29+
end
30+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# MANAGED BY PUPPET
3+
#
4+
5+
init_config:
6+
7+
instances:
8+
- mysql_host: <%= @mysql_host %>
9+
mysql_user: <%= @mysql_user %>
10+
mysql_password: <%= @mysql_password %>
11+
rrd_path: <%= @rrd_path %>
12+

0 commit comments

Comments
 (0)