Skip to content

Commit

Permalink
Update module-collectd to 010a7b9f5a6939e001fe515224cb1be6d9cfdf88
Browse files Browse the repository at this point in the history
010a7b9f5a6939e001fe515224cb1be6d9cfdf88 Merge pull request #372 from ghoneycutt/add_mongodb_plugin
4e98bf4f4d6d969aa2722385aee28937516179cb Merge pull request #370 from daenney/ping-to-class
01efe141f29955532c3aa01a39356ea2e0ef5b01 Add tests for the MongoDB plugin
6b709c82d46e1927862c359d8a45134b4ba30868 Add MongoDB plugin
0251e98956fd958df6bbe471efff24408852a453 plugin/ping: Transition from defined type to class
bd63397c582edfc6c002839e8657833735ec8257 Merge pull request #368 from hdoedens/regex_compatibility
097e2a9662441e3753d92bdf10fd2e176adccf21 Removed group naming from regex for ruby 1.8.7 compatibility. Escaped dots in literal strings in regex.
cdd0e94bdd4a1d5123846820c88c443bce12cf78 Merge pull request #364 from noris-network/fix-processes
395036ae332c56800481459fef9f1691a484de9f collectd may fail to start in wheezy if processes-plugin is used without any process
953b71bac189355b0a690ba2160ccfe8295f61fc Merge pull request #365 from blacktoko/patch-1
6ee3a3df6cde65da3d506a2bd0fb6e81d3f41fc5 #355 Removed Master/Slave if statement
2ea35b6dd8a261d30726690ddf9c5e23eaf0f587 Merge pull request #361 from t-8ch/empty_filecount
deb4a4b9483abe55bbd0a58e55e13bd5baa6a7e0 [filecount] do not an emit empty <Plugin> block
a7dc5bfe5d78668808c70b271f709c1be29d2111 Merge pull request #360 from t-8ch/solaris_variables
f0c92e0381585522d0635b63a31c9eb5192cbc8a solaris: use more idiomatic file locations
53e88c67d48638bc1dbfbe1e9792b19e8566b6a1 solaris: rename service to full csw name

Change-Id: Ib2996200593a43e06a9439ae758bf76dda2c8157
  • Loading branch information
xbezdick committed Nov 25, 2015
1 parent ce97dd1 commit 3e28722
Show file tree
Hide file tree
Showing 21 changed files with 516 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ mod 'memcached',
:git => 'https://github.com/saz/puppet-memcached.git'

mod 'module-collectd',
:commit => '9d07e5b15d3b6f67dd2899ef08dc7d2c20cff0a4',
:commit => '010a7b9f5a6939e001fe515224cb1be6d9cfdf88',
:git => 'https://github.com/pdxcat/puppet-module-collectd.git'

mod 'module-data',
Expand Down
58 changes: 58 additions & 0 deletions module-collectd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ documentation for each plugin for configurable attributes.
* `lvm` (see [collectd::plugin::lvm](#class-collectdpluginlvm) below)
* `memcached`(see [collectd::plugin::memcached](#class-collectdpluginmemcached) below )
* `memory`(see [collectd::plugin::memory](#class-collectdpluginmemory) below )
* `mongodb`(see [collectd::plugin::mongodb](#class-collectdpluginmongodb) below )
* `mysql` (see [collectd::plugin::mysql](#class-collectdpluginmysql) below)
* `netlink` (see [collectd::plugin::netlink](#class-collectdpluginnetlink) below)
* `network` (see [collectd::plugin::network](#class-collectdpluginnetwork) below)
Expand Down Expand Up @@ -785,6 +786,63 @@ collectd::plugin::mysql::database { 'betadase':
}
```

####Class: `collectd::plugin::mongodb`

```puppet
class { 'collectd::plugin::mongodb':
db_user => 'admin',
db_pass => 'adminpass',
}
```

##### Parameters:

ensure
------
Optional. String that must be 'present' or 'absent'.

- *Default*: 'present'

interval
--------
Optional. Number of seconds that collectd pauses between data collection.

- *Default*: undef

db_host
-------
Optional. String that holds the IP of the MongoDB server.

- *Default*: '127.0.0.1'

db_user
-------
Required. String that specifies the user name of an account that can log into MongoDB


db_pass
-------
Required. String that specifies the password of an account that can log into MongoDB

configured_dbs
--------------
Optional. Array of Strings that lists the databases that should be monitored in addition to the "admin" database.

db_port
-------
Required if the configured_dbs parameter is set. Unused otherwise. Integer that specifies with port MongoDB listens on.

```puppet
class { 'collectd::plugin::mongodb':
db_host => '127.0.0.1',
db_user => 'foo',
db_pass => 'bar',
db_port => '27017',
configured_dbs => ['database', 'names'],
collectd_dir => '/collectd/module/path',
}
```

####Class: `collectd::plugin::netlink`

```puppet
Expand Down
2 changes: 1 addition & 1 deletion module-collectd/lib/facter/collectd_real_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
setcode do
if Facter::Util::Resolution.which('collectd')
collectd_help = Facter::Util::Resolution.exec('collectd -h')
%r{^collectd (?<version>[\w.]+), http://collectd.org/}.match(collectd_help)[:version]
%r{^collectd ([\w\.]+), http://collectd\.org/}.match(collectd_help)[1]
end
end
end
8 changes: 4 additions & 4 deletions module-collectd/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
'Solaris': {
$package = 'CSWcollectd'
$provider = 'pkgutil'
$collectd_dir = '/etc/opt/csw'
$plugin_conf_dir = "${collectd_dir}/conf.d"
$service_name = 'collectd'
$config_file = "${collectd_dir}/collectd.conf"
$collectd_dir = '/etc/opt/csw/collectd.d'
$plugin_conf_dir = $collectd_dir
$service_name = 'cswcollectd'
$config_file = '/etc/opt/csw/collectd.conf'
$root_group = 'root'
$java_dir = undef
$python_dir = '/opt/csw/share/collectd/python'
Expand Down
43 changes: 43 additions & 0 deletions module-collectd/manifests/plugin/mongodb.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Class: collectd::plugin::mongodb
#
class collectd::plugin::mongodb (
$ensure = 'present',
$interval = undef,
$db_host = '127.0.0.1',
$db_user = undef,
$db_pass = undef,
$db_port = undef,
$configured_dbs = undef,
$collectd_dir = '/usr/lib/collectd',
) {

validate_re($ensure,'^(present)|(absent)$',
"collectd::plugin::mongodb::ensure is <${ensure}> and must be either 'present' or 'absent'.")

if $interval != undef {
validate_numeric($interval)
}

if $configured_dbs != undef {
validate_array($configured_dbs)
if ( $db_port == undef ) { fail('db_port is undefined, but must be set if configured_dbs is set.') }
validate_string($db_port)
}

if ( $db_host != undef ) and ( is_ip_address($db_host) == false ) {
fail("collectd::plugin::mongodb::db_host is <${db_host}> and must be a valid IP address.")
}

if $db_user == undef {
fail('collectd::plugin::mongodb::db_user is <undef> and must be a mongodb username')
}
elsif $db_pass == undef {
fail("collectd::plugin::mongodb::db_pass is <undef>, please specify the password for db user: ${db_user}")
}

collectd::plugin { 'mongodb':
ensure => $ensure,
content => template('collectd/plugin/mongodb.conf.erb'),
interval => $interval,
}
}
4 changes: 0 additions & 4 deletions module-collectd/manifests/plugin/mysql/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
validate_bool($slavenotifications)
}

if ($masterstats == true and $slavestats == true) {
fail('master and slave statistics are mutually exclusive.')
}

file { "${name}.conf":
ensure => $ensure,
path => "${conf_dir}/mysql-${name}.conf",
Expand Down
18 changes: 6 additions & 12 deletions module-collectd/manifests/plugin/ping.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# See http://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_ping
define collectd::plugin::ping (
class collectd::plugin::ping (
$hosts,
$ensure = present,
$manage_package = $true,
$manage_package = true,
$interval = undef,
$timeout = undef,
$ttl = undef,
Expand All @@ -22,15 +22,9 @@
}
}

$conf_dir = $collectd::params::plugin_conf_dir

file {
"${name}.load":
path => "${conf_dir}/ping-${name}.conf",
owner => 'root',
group => $collectd::params::root_group,
mode => '0644',
content => template('collectd/ping.conf.erb'),
notify => Service['collectd'],
collectd::plugin { 'ping':
ensure => $ensure,
interval => $interval,
content => template('collectd/plugin/ping.conf.erb'),
}
}
13 changes: 9 additions & 4 deletions module-collectd/manifests/plugin/processes.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,33 @@
interval => $interval,
}

if ( $processes or $process_matches ) {
$process_config_ensure = present
} else {
$process_config_ensure = absent
}

concat{"${collectd::params::plugin_conf_dir}/processes-config.conf":
ensure => $ensure,
ensure => $process_config_ensure,
mode => '0640',
owner => 'root',
group => $collectd::params::root_group,
notify => Service['collectd'],
ensure_newline => true,
}
concat::fragment{'collectd_plugin_processes_conf_header':
ensure => $ensure,
ensure => $process_config_ensure,
order => '00',
content => '<Plugin processes>',
target => "${collectd::params::plugin_conf_dir}/processes-config.conf",
}
concat::fragment{'collectd_plugin_processes_conf_footer':
ensure => $ensure,
ensure => $process_config_ensure,
order => '99',
content => '</Plugin>',
target => "${collectd::params::plugin_conf_dir}/processes-config.conf",
}


if $processes {
collectd::plugin::processes::process { $processes : }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,11 @@
should compile.and_raise_error(/String/)
end
end

context ':directories is empty' do
it 'Will not create an empty <Plugin "filecount"> block' do
should contain_file('filecount.load')
.without_content(/<Plugin "filecount">/)
end
end
end
Loading

0 comments on commit 3e28722

Please sign in to comment.