forked from voxpupuli/puppet-collectd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request voxpupuli#913 from prabiegx/collectd_dpdk_telemetry
Add dpdk_telemetry plugin
- Loading branch information
Showing
4 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Class to manage dpdk_telemetry plugin for collectd. | ||
# | ||
# The dpdk_telemetry plugin collects DPDK ethernet device metrics via | ||
# dpdk_telemetry library. | ||
# | ||
# Plugin retrieves metrics from a DPDK packet forwarding application | ||
# by sending the JSON formatted message via a UNIX domain socket. | ||
# DPDK telemetry component will respond with a JSON formatted reply | ||
# delivering the requested metrics. Plugin parses the JSON data | ||
# and publishes the metric values to collectd for further use. | ||
# | ||
# @param ensure Ensure param for collectd::plugin type. | ||
# @param client_socket_path UNIX domain client socket to receive messages from DPDK telemetry library. | ||
# @param dpdk_socket_path UNIX domain DPDK telemetry socket to be connected to send messages. | ||
# | ||
class collectd::plugin::dpdk_telemetry ( | ||
Enum['present', 'absent'] $ensure = 'present', | ||
Stdlib::Absolutepath $client_socket_path = '/var/run/.client', | ||
Stdlib::Absolutepath $dpdk_socket_path = '/var/run/dpdk/rte/telemetry', | ||
) { | ||
|
||
include collectd | ||
|
||
collectd::plugin { 'dpdk_telemetry': | ||
ensure => $ensure, | ||
content => epp('collectd/plugin/dpdk_telemetry.conf.epp'), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
require 'spec_helper' | ||
|
||
describe 'collectd::plugin::dpdk_telemetry', type: :class do | ||
on_supported_os(baseline_os_hash).each do |os, facts| | ||
context "on #{os} " do | ||
let :facts do | ||
facts | ||
end | ||
|
||
options = os_specific_options(facts) | ||
|
||
context ':ensure => present, default params' do | ||
content = <<EOS | ||
# Generated by Puppet | ||
<LoadPlugin dpdk_telemetry> | ||
Globals false | ||
</LoadPlugin> | ||
<Plugin dpdk_telemetry> | ||
ClientSocketPath "/var/run/.client" | ||
DpdkSocketPath "/var/run/dpdk/rte/telemetry" | ||
</Plugin> | ||
EOS | ||
|
||
it "Will create #{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf" do | ||
is_expected.to compile.with_all_deps | ||
is_expected.to contain_file('dpdk_telemetry.load').with( | ||
ensure: 'present', | ||
path: "#{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf", | ||
content: content | ||
) | ||
end | ||
end | ||
|
||
context ':ensure => absent' do | ||
let :params do | ||
{ ensure: 'absent' } | ||
end | ||
|
||
it "Will not create #{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf" do | ||
is_expected.to compile.with_all_deps | ||
is_expected.to contain_file('dpdk_telemetry.load').with( | ||
ensure: 'absent', | ||
path: "#{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf" | ||
) | ||
end | ||
end | ||
|
||
context ':ensure => present and :client_socket_path => /test/path/.client' do | ||
let :params do | ||
{ client_socket_path: '/test/path/.client' } | ||
end | ||
|
||
it "Will create #{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf" do | ||
is_expected.to compile.with_all_deps | ||
is_expected.to contain_file('dpdk_telemetry.load').with( | ||
ensure: 'present', | ||
path: "#{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf", | ||
content: %r{ClientSocketPath "/test/path/.client"}m | ||
) | ||
end | ||
end | ||
|
||
context ':ensure => present and :dpdk_socket_path => /test/path/telemetry' do | ||
let :params do | ||
{ dpdk_socket_path: '/test/path/telemetry' } | ||
end | ||
|
||
it "Will create #{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf" do | ||
is_expected.to compile.with_all_deps | ||
is_expected.to contain_file('dpdk_telemetry.load').with( | ||
ensure: 'present', | ||
path: "#{options[:plugin_conf_dir]}/10-dpdk_telemetry.conf", | ||
content: %r{DpdkSocketPath "/test/path/telemetry"}m | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Plugin dpdk_telemetry> | ||
<% if $collectd::plugin::dpdk_telemetry::client_socket_path { -%> | ||
ClientSocketPath "<%= $collectd::plugin::dpdk_telemetry::client_socket_path %>" | ||
<% } -%> | ||
<% if $collectd::plugin::dpdk_telemetry::dpdk_socket_path { -%> | ||
DpdkSocketPath "<%= $collectd::plugin::dpdk_telemetry::dpdk_socket_path %>" | ||
<% } -%> | ||
</Plugin> |