Use netlink plugin instead of interface
This patch replaces the 'interface' collectd plugin by the 'netlink' one. The 'netlink' plugin can get the same information than 'interface' but it can also give other details like the number of dropped packets. This new metrics will be used to generate alarms based on the number of packets dropped by an interface. Change-Id: I4e74e1e6c981a924946306192c296baef0404f95
This commit is contained in:
parent
bdad207a66
commit
d0e994f520
|
@ -8,7 +8,7 @@ fixtures:
|
|||
ref: "1.2.4"
|
||||
collectd:
|
||||
repo: "git://github.com/puppet-community/puppet-collectd"
|
||||
ref: "v4.1.2"
|
||||
ref: "v4.3.0"
|
||||
apache:
|
||||
repo: "git://github.com/puppetlabs/puppetlabs-apache"
|
||||
ref: "1.4.0"
|
||||
|
|
|
@ -114,8 +114,24 @@ function process_message ()
|
|||
msg['Fields']['name'] = 'cpu' .. sep .. sample['type_instance']
|
||||
msg['Fields']['cpu_number'] = sample['plugin_instance']
|
||||
msg['Fields']['tag_fields'] = { 'cpu_number' }
|
||||
elseif metric_source == 'interface' then
|
||||
msg['Fields']['name'] = sample['type'] .. sep .. sample['dsnames'][i]
|
||||
elseif metric_source == 'netlink' then
|
||||
local netlink_metric = sample['type']
|
||||
|
||||
if netlink_metric == 'if_rx_errors' then
|
||||
netlink_metric = 'if_errors_rx'
|
||||
elseif netlink_metric == 'if_tx_errors' then
|
||||
netlink_metric = 'if_errors_tx'
|
||||
end
|
||||
|
||||
-- Netlink plugin can send one or two values. Use dsnames only when needed.
|
||||
if sample['dsnames'][i] ~= 'value' then
|
||||
netlink_metric = netlink_metric .. sep .. sample['dsnames'][i]
|
||||
end
|
||||
-- and type of errors is set in type_instance
|
||||
if sample['type_instance'] ~= '' then
|
||||
netlink_metric = netlink_metric .. sep .. sample['type_instance']
|
||||
end
|
||||
msg['Fields']['name'] = netlink_metric
|
||||
msg['Fields']['interface'] = sample['plugin_instance']
|
||||
msg['Fields']['tag_fields'] = { 'interface' }
|
||||
elseif metric_source == 'processes' then
|
||||
|
|
|
@ -34,6 +34,17 @@ class lma_collector::collectd::base (
|
|||
before => Class['::collectd'],
|
||||
}
|
||||
|
||||
# Netlink library is required by the netlink collectd plugin
|
||||
if $::osfamily == 'RedHat' {
|
||||
$netlink_pkg_name = 'libmnl'
|
||||
} else {
|
||||
$netlink_pkg_name = 'libmnl0'
|
||||
}
|
||||
package { $netlink_pkg_name:
|
||||
ensure => present,
|
||||
before => Class['::collectd'],
|
||||
}
|
||||
|
||||
$port = $lma_collector::params::collectd_port
|
||||
class { '::collectd':
|
||||
purge => $purge,
|
||||
|
@ -86,8 +97,8 @@ class lma_collector::collectd::base (
|
|||
disks => [ "/^${ block_devices }$/" ],
|
||||
}
|
||||
|
||||
class { 'collectd::plugin::interface':
|
||||
interfaces => reject(grep(split($::interfaces, ','), '^[a-z0-9]+$'), '^lo$')
|
||||
class { 'collectd::plugin::netlink':
|
||||
verboseinterfaces => reject(grep(split($::interfaces, ','), '^[a-z0-9]+$'), '^lo$'),
|
||||
}
|
||||
|
||||
class { 'collectd::plugin::load':
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"description": "Puppet module for configuring the LMA collector service",
|
||||
"dependencies": [
|
||||
{"name": "mirantis/heka", "version_requirement": "1.x"},
|
||||
{"name": "puppet/collectd", "version_requirement": ">= 4.1.2"},
|
||||
{"name": "puppet/collectd", "version_requirement": ">= 4.3.0"},
|
||||
{"name": "puppetlabs/apache", "version_requirement": ">= 1.4.0"},
|
||||
{"name": "puppetlabs/inifile", "version_requirement": ">= 1.4.2"},
|
||||
{"name": "puppetlabs/stdlib", "version_requirement": "4.x"}
|
||||
|
|
|
@ -23,7 +23,7 @@ describe 'lma_collector::collectd::base' do
|
|||
it { is_expected.to contain_class('collectd') }
|
||||
end
|
||||
|
||||
describe 'with defaults' do
|
||||
describe 'with interfaces' do
|
||||
let(:facts) do
|
||||
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian', :concat_basedir => '/foo',
|
||||
|
@ -31,6 +31,6 @@ describe 'lma_collector::collectd::base' do
|
|||
end
|
||||
|
||||
it { is_expected.to contain_class('collectd').with_purge(false) }
|
||||
it { is_expected.to contain_class('collectd::plugin::interface').with_interfaces(['en0', 'bond0']) }
|
||||
it { is_expected.to contain_class('collectd::plugin::netlink').with_verboseinterfaces(['en0', 'bond0']) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,10 +77,37 @@ Network
|
|||
Metrics have an ``interface`` field that contains the interface name the
|
||||
metric applies to. For example, 'eth0', 'eth1', and others.
|
||||
|
||||
* ``if_collisions``, the number of collisions per second per interface.
|
||||
* ``if_dropped_rx``, the number of dropped packets per second when receiving
|
||||
from the interface.
|
||||
* ``if_dropped_tx``, the number of dropped packets per second when transmitting
|
||||
from the interface.
|
||||
* ``if_errors_rx``, the number of errors per second detected when receiving
|
||||
from the interface.
|
||||
* ``if_errors_rx_crc``, the number of received frames with wrong CRC (cyclic
|
||||
redundancy check) per second.
|
||||
* ``if_errors_rx_fifo``, the number of received frames dropped per second due to
|
||||
FIFO buffer overflows.
|
||||
* ``if_errors_rx_frame``, the number of received frames with invalid frame
|
||||
checksum (FCS).
|
||||
* ``if_errors_rx_length``, the number of received frames with a length that
|
||||
doesn't comply with the Ethernet specification.
|
||||
* ``if_errors_rx_missed``, the number of missed packets when receiving from the
|
||||
interface.
|
||||
* ``if_errors_rx_over``, the number of received frames per second that were
|
||||
dropped due to an hardware port receive buffer overflow.
|
||||
* ``if_errors_tx``, the number of errors per second detected when transmitting
|
||||
from the interface.
|
||||
* ``if_errors_tx_aborted``, the number of aborted frames per second when
|
||||
transmitting from the interface
|
||||
* ``if_errors_tx_carrier``, the number of times per second the interface has
|
||||
lost its link connection to the switch.
|
||||
* ``if_errors_tx_fifo``, the number of transmitted frames per second dropped
|
||||
due to FIFO buffer overflows.
|
||||
* ``if_errors_tx_heartbeat``, the number of heartbeat errors per second.
|
||||
* ``if_errors_tx_window``, the number of late collisions per second when
|
||||
transmitting from the interface.
|
||||
* ``if_multicast``, the number of multicast packets per second per interface.
|
||||
* ``if_octets_rx``, the number of octets (bytes) received per second by the
|
||||
interface.
|
||||
* ``if_octets_tx``, the number of octets (bytes) transmitted per second by the
|
||||
|
|
Loading…
Reference in New Issue