File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments