Ottomata has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/61812


Change subject: Setting up webrequest multicast and eventlogging on gadolinium.
......................................................................

Setting up webrequest multicast and eventlogging on gadolinium.

We will soon move the oxygen relays over to gadolinium.

Change-Id: I3965ae662072d8374f5061ca87833b08c165df07
---
M files/upstart/squid-logging-multicast-relay.conf
M manifests/misc/logging.pp
M manifests/role/logging.pp
M manifests/site.pp
A templates/misc/logging-relay.upstart.conf.erb
5 files changed, 120 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/12/61812/1

diff --git a/files/upstart/squid-logging-multicast-relay.conf 
b/files/upstart/squid-logging-multicast-relay.conf
index 6601213..76c453d 100644
--- a/files/upstart/squid-logging-multicast-relay.conf
+++ b/files/upstart/squid-logging-multicast-relay.conf
@@ -1,5 +1,7 @@
 # This file is managed by Puppet!
-#
+# NOTE:  This file has been deprecated in favor of the
+#        renamed 'logging-relay.upstart.conf.erb file.'.
+#        It will be removed once oxygen no longer uses it.
 # squid-logging-multicast-relay
 
 description    "Squid logging unicast to multicast relay"
diff --git a/manifests/misc/logging.pp b/manifests/misc/logging.pp
index 9d266a7..5acf09d 100644
--- a/manifests/misc/logging.pp
+++ b/manifests/misc/logging.pp
@@ -33,12 +33,68 @@
        }
 }
 
-class misc::socat {
-       package { "socat": ensure => latest; }
+
+
+
+class misc::logging::socat {
+       package { 'socat':
+               ensure => 'installed',
+       }
 }
 
+
+# == Define misc::logging::multicast-relay
+# Sets up a UDP unicast to multicast relay process.
+#
+# == Parameters:
+# $listen_port       - The port on which to accept UDP traffic for relay.
+# $destination_ip
+# $destination_port
+# $multicast         - boolean.  Default false.  If true, the received traffic 
will be relayed to multicast group specified by $destination_ip and 
$destination_port.
+define misc::logging::relay(
+       $listen_port,
+       $destination_ip,
+       $destination_port,
+       $multicast = false,
+)
+{
+       require misc::logging::socat
+
+       # Configure and start the upstart job for
+       # luanching the socat multicast relay daemon.
+       # Note: Not using upstart_job define here since
+       # it doesn't support using ERb templates.
+
+       if $multicast {
+               $daemon_name = "${title}-multicast-relay"
+       }
+       else {
+               $daemon_name = "${title}-unicast-relay"
+       }
+
+       # Create symlink
+       file { "/etc/init.d/${daemon_name}":
+               ensure => 'link',
+               target => '/lib/init/upstart-job';
+       }
+
+       file { "/etc/init/${$daemon_name}.conf":
+               content => template('misc/logging-relay.upstart.conf.erb'),
+       }
+
+       service { "${daemon_name}":
+               ensure    => running,
+               require   => Package['socat'],
+               subscribe => File["/etc/init/${daemon_name}.conf"],
+               provider  => 'upstart',
+       }
+}
+
+
+# NOTE:  This class is depcreated.
+# It will be removed once oxygen is no longer using it.
 class misc::squid-logging::multicast-relay {
-       require misc::socat
+       require misc::logging::socat
 
        system_role { "misc::squid-logging::multicast-relay": description => 
"Squid logging unicast to multicast relay" }
 
@@ -51,8 +107,11 @@
        }
 }
 
+
+# NOTE:  This class is deprecated.
+# It will be removed once oxygen is no longer using it.
 class misc::logging::vanadium-relay {
-       require misc::socat
+       require misc::logging::socat
 
        system_role { "misc::logging::vanadium-relay": description => "esams 
bits event logging to vanadium relay" }
 
diff --git a/manifests/role/logging.pp b/manifests/role/logging.pp
index 1dc4200..a717cff 100644
--- a/manifests/role/logging.pp
+++ b/manifests/role/logging.pp
@@ -79,6 +79,40 @@
 }
 
 
+# == Class role::logging::relay::webrequest-multicast
+# Sets up a multicast relay using socat for
+# webrequest log streams (squid, varnish, nginx etc.).
+# Anything sent to this node on port 8419 will be
+# relayed to the 233.58.59.1:8420 multicast group.
+#
+class role::logging::relay::webrequest-multicast {
+       system_role { 'role::logging::relay::webrequest-multicast':
+               description => 'Webrequest log stream unicast to multicast 
relay',
+       }
+
+       misc::logging::relay { 'webrequest':
+               listen_port      => '8419',
+               destination_ip   => '233.58.59.1',
+               destination_port => '8420',
+               multicast        => true,
+       }
+}
+
+# == Class role::logging::relay::eventlogging
+# Relays EventLogging traffic over to Vandadium.
+#
+class role::logging::relay::eventlogging {
+       system_role { 'misc::logging::relay::eventlogging':
+               description => 'esams bits event logging to vanadium relay',
+       }
+
+       misc::logging::relay { 'eventlogging':
+               listen_port      => '8422',
+               destination_ip   => '10.64.21.123',
+               destination_port => '8422',
+       }
+}
+
 
 # udp2log base role class
 class role::logging::udp2log {
diff --git a/manifests/site.pp b/manifests/site.pp
index 1150e84..36366cb 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -903,7 +903,12 @@
                accounts::dsc,
                accounts::milimetric
 
-       # gadolinium hosts the separate nginx udp2log instance.
+       # relay the incoming webrequest log stream to multicast
+       include role::logging::relay::webrequest-multicast
+       # relay EventLogging traffic over to vanadium
+       include role::logging::relay::eventlogging
+
+       # gadolinium hosts the separate nginx webrequest udp2log instance.
        include role::logging::udp2log::nginx
 
        # Set up the gadolinium udp2log webrequest instance.
diff --git a/templates/misc/logging-relay.upstart.conf.erb 
b/templates/misc/logging-relay.upstart.conf.erb
new file mode 100644
index 0000000..d7a2131
--- /dev/null
+++ b/templates/misc/logging-relay.upstart.conf.erb
@@ -0,0 +1,14 @@
+# This file is managed by Puppet!
+#
+# <%= daemon_name %>
+
+description    "<%= title %> socat relay"
+
+start on filesystem
+stop on runlevel S
+
+respawn
+respawn limit 10 5
+umask 022
+
+exec /usr/bin/socat UDP-RECV:<%= listen_port %>,su=nobody UDP4-DATAGRAM:<%= 
destination_ip %>:<%= destination_port %><%= multicast ? ',ip-multicast-ttl=10' 
: '' %>

-- 
To view, visit https://gerrit.wikimedia.org/r/61812
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3965ae662072d8374f5061ca87833b08c165df07
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ottomata <o...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to