Skip to content

Commit

Permalink
Merge d1ea219 into 6e76786
Browse files Browse the repository at this point in the history
  • Loading branch information
carroarmato0 committed Jan 2, 2017
2 parents 6e76786 + d1ea219 commit ce6a7a0
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions manifests/plugin/write_network.pp
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# A define to make a generic network output for collectd
class collectd::plugin::write_network (
$ensure = 'present',
$servers = { 'localhost' => { 'serverport' => '25826' } },
$server = 'localhost',
$port = '25826',
) {

include ::collectd

validate_hash($servers)
validate_string($server)
validate_re($port, '^\d{1,5}$')

$servernames = keys($servers)
if empty($servernames) {
fail('servers cannot be empty')
if empty($server) {
fail('server cannot be empty')
}

$servername = $servernames[0]
$serverport = $servers[$servername]['serverport']

class { '::collectd::plugin::network':
server => $servername,
serverport => $serverport,
::collectd::plugin::network::server {$server :
ensure => $ensure,
port => $port,
}

}

0 comments on commit ce6a7a0

Please sign in to comment.