Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8812,6 +8812,7 @@ The collectd::plugin::network::server class.

The following parameters are available in the `collectd::plugin::network::server` defined type:

* [`hostname`](#-collectd--plugin--network--server--hostname)
* [`ensure`](#-collectd--plugin--network--server--ensure)
* [`username`](#-collectd--plugin--network--server--username)
* [`password`](#-collectd--plugin--network--server--password)
Expand All @@ -8821,6 +8822,14 @@ The following parameters are available in the `collectd::plugin::network::server
* [`forward`](#-collectd--plugin--network--server--forward)
* [`resolveinterval`](#-collectd--plugin--network--server--resolveinterval)

##### <a name="-collectd--plugin--network--server--hostname"></a>`hostname`

Data type: `String[1]`

The hostname of the server to connect to

Default value: `$name`

##### <a name="-collectd--plugin--network--server--ensure"></a>`ensure`

Data type: `Enum['present', 'absent']`
Expand Down
2 changes: 2 additions & 0 deletions manifests/plugin/network/server.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#
# @param hostname The hostname of the server to connect to
define collectd::plugin::network::server (
Enum['present', 'absent'] $ensure = 'present',
String[1] $hostname = $name,
Optional[String] $username = undef,
Optional[String] $password = undef,
Optional[Stdlib::Port] $port = undef,
Expand Down
3 changes: 2 additions & 1 deletion spec/defines/collectd_plugin_network_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
let(:title) { 'node1' }
let :params do
{
hostname: 'node1.example.com',
port: 1234,
interface: 'eth0',
securitylevel: 'Encrypt',
Expand All @@ -26,7 +27,7 @@
is_expected.to contain_file("#{options[:plugin_conf_dir]}/network-server-node1.conf").with(
ensure: 'present',
path: "#{options[:plugin_conf_dir]}/network-server-node1.conf",
content: "<Plugin network>\n <Server \"node1\" \"1234\">\n SecurityLevel \"Encrypt\"\n Username \"foo\"\n Password \"bar\"\n Interface \"eth0\"\n\n </Server>\n</Plugin>\n"
content: "<Plugin network>\n <Server \"node1.example.com\" \"1234\">\n SecurityLevel \"Encrypt\"\n Username \"foo\"\n Password \"bar\"\n Interface \"eth0\"\n\n </Server>\n</Plugin>\n"
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion templates/plugin/network/server.conf.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Plugin network>
<% if scope.lookupvar('collectd::collectd_version_real') and (scope.function_versioncmp([scope.lookupvar('collectd::collectd_version_real'), '4.7']) >= 0) -%>
<Server "<%= @name %>" "<%= @port %>">
<Server "<%= @hostname %>" "<%= @port %>">
<% if @securitylevel -%>
SecurityLevel "<%= @securitylevel %>"
<% end -%>
Expand Down
Loading