feat: add ntopng passive dpi to the router role
ci/woodpecker/pr/puppet-lint Pipeline was successful
ci/woodpecker/pr/ruby-validate Pipeline was successful
ci/woodpecker/pr/yamllint Pipeline was successful
ci/woodpecker/pr/bolt-validate Pipeline was successful
ci/woodpecker/pr/erb-validate Pipeline was successful
ci/woodpecker/pr/epp-validate Pipeline was successful
ci/woodpecker/pr/puppet-validate Pipeline was successful
ci/woodpecker/pr/ruby-check Pipeline was successful

- add profiles::metrics::ntopng (package, config, redis prefs, service)
- add ntop + ntop-noarch artifactapi repos, enabled for the router role only
- capture enp1s0, enp2s0, bond0.10 and bond0.201 on prodnxsr0020
This commit is contained in:
2026-11-16 22:10:00 +11:00
parent 42c4e41508
commit 2a91867330
4 changed files with 95 additions and 0 deletions
@@ -45,3 +45,10 @@ frrouting::ospf_preferred_source_enable: true
frrouting::ospf_preferred_source: "%{hiera('networking_loopback1_ip')}"
frrouting::ospf_connected_exclude:
- 0.0.0.0/0
# ntopng: wan uplink plus lan vlans
profiles::metrics::ntopng::interfaces:
- enp1s0
- enp2s0
- bond0.10
- bond0.201
+18
View File
@@ -124,6 +124,24 @@ profiles::yum::global::repos:
gpgcheck: false
mirrorlist: absent
# ntop repositories
ntop:
ensure: absent
name: ntop
descr: ntop repository
target: /etc/yum.repos.d/ntop.repo
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/%{facts.os.release.major}/%{facts.os.architecture}/
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/RPM-GPG-KEY-deri
mirrorlist: absent
ntop-noarch:
ensure: absent
name: ntop-noarch
descr: ntop-noarch repository
target: /etc/yum.repos.d/ntop-noarch.repo
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/%{facts.os.release.major}/noarch/
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/RPM-GPG-KEY-deri
mirrorlist: absent
# PostgreSQL repositories
postgresql-15:
ensure: absent
@@ -2,6 +2,7 @@
hiera_include:
- frrouting
- exporters::frr_exporter
- profiles::metrics::ntopng
profiles::puppet::migrate::enabled: true
@@ -30,3 +31,10 @@ profiles::consul::client::node_rules:
- resource: service
segment: frr_exporter
disposition: write
# ntopng passive dpi; capture interfaces are per-host
profiles::yum::global::repos:
ntop:
ensure: present
ntop-noarch:
ensure: present
+62
View File
@@ -0,0 +1,62 @@
# passive ntopng community dpi on the given interfaces, local redis, web ui on localhost only
# - influx_url: influxdb-compatible write base url (ntopng appends /write?db=...); unset keeps the local rrd driver
# timeseries are interface-level ndpi protocol + category only; per-host series stay off for cardinality
class profiles::metrics::ntopng (
Array[String[1], 1] $interfaces,
Optional[Stdlib::HTTPUrl] $influx_url = undef,
String[1] $influx_dbname = 'ntopng',
String[1] $http_listen = '127.0.0.1:3000',
) {
include redis
package { 'ntopng':
ensure => installed,
}
$conf = ($interfaces.map |$i| { "-i=${i}" } + [
'-r=127.0.0.1:6379',
"-w=${http_listen}",
'-W=0',
]).join("\n")
file { '/etc/ntopng/ntopng.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => "${conf}\n",
require => Package['ntopng'],
notify => Service['ntopng'],
}
# timeseries settings are runtime prefs held in redis, not config-file options
$ts_prefs = {
'hosts_ts_creation' => 'off',
'host_ndpi_timeseries_creation' => 'none',
'interface_ndpi_timeseries_creation' => 'both',
}
$influx_prefs = $influx_url ? {
undef => {},
default => {
'timeseries_driver' => 'influxdb',
'ts_post_data_url' => $influx_url,
'influx_dbname' => $influx_dbname,
},
}
($ts_prefs + $influx_prefs).each |$key, $value| {
exec { "ntopng_pref_${key}":
provider => shell,
command => "/usr/bin/redis-cli set ntopng.prefs.${key} '${value}'",
unless => "/usr/bin/test \"$(/usr/bin/redis-cli get ntopng.prefs.${key})\" = '${value}'",
require => Class['redis'],
notify => Service['ntopng'],
}
}
service { 'ntopng':
ensure => running,
enable => true,
require => [Package['ntopng'], Class['redis']],
}
}