Jcrespo has submitted this change and it was merged.

Change subject: Add prometheus's mysql-exporter to all jessie's production 
codfw dbs
......................................................................


Add prometheus's mysql-exporter to all jessie's production codfw dbs

Also, export mysql_role, mysql_group & mysql_shard:

* mysql_group: general usage of the server, for example:
  - 'core': production mediawiki servers
  - 'dbstore': servers for backup and analytics
  - 'labs': production and labs replicas of production
  - 'misc': other services
* mysql_shard: for 'core' and 'misc' services, vertical slices:
  - 's1': English Wikipedia (see dblists on mediawiki-config)
  - 'm1': puppet, bacula, etc.
  - most services are not segmented and will return the empty
    string ('')
* mysql_role:
  - 'master': for the masters of each datacenter (one per shard
    and datacenter). Only the one on the active datacenter is
    read-write of all the ones on the same shard.
  - 'slave': for read-only slaves
  - 'standalone': single servers that are not part of replication,
    such as read-only 'es1' hosts, wikitech, or tendril

(mysql_dc is just a copy of the local $::site for the node).

To cleanup code, a new class has been added (mariadb::groups)
to concentrate prometheus and salt groups, applying it to all
hosts, not only core ones.

Bug: T126757
Bug: T104459
Change-Id: I19f12a893f9da334984dc3cc40d247fbefe58e45
---
M manifests/role/mariadb.pp
M manifests/site.pp
2 files changed, 120 insertions(+), 21 deletions(-)

Approvals:
  Jcrespo: Looks good to me, approved
  Filippo Giunchedi: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/manifests/role/mariadb.pp b/manifests/role/mariadb.pp
index a3491bf..2ba7a70 100644
--- a/manifests/role/mariadb.pp
+++ b/manifests/role/mariadb.pp
@@ -9,7 +9,7 @@
     include ::mariadb
 }
 
-# root, repl, nagios, tendril
+# root, repl, nagios, tendril, prometheus
 class role::mariadb::grants(
     $shard = false,
     ) {
@@ -98,6 +98,59 @@
     include mariadb::monitor_process
 }
 
+# mysql groups for monitoring and salt
+# * mysql_group (required): general usage of the server, for example:
+#   - 'core': production mediawiki servers
+#   - 'dbstore': servers for backup and analytics
+#   - 'labs': production and labs replicas of production
+#   - 'misc': other services
+# * mysql_shard (optional): for 'core', 'misc' and 'pc' services, vertical
+#   slices:
+#   - 's1': English Wikipedia (see dblists on mediawiki-config)
+#   - 'm1': puppet, bacula, etc.
+#   - most services are not segmented and will return the empty string ('')
+# * mysql_role (required). One of three:
+# - 'master': for the masters of each datacenter (one per shard and
+#   datacenter). Only the one on the active datacenter is read-write of
+#   all the ones on the same shard.
+# - 'slave': for read-only slave
+# - 'standalone': single servers that are not part of replication,
+#   such as read-only 'es1' hosts; wikitech, or tendril
+
+#FIXME: apply to all servers, not only those on codfw
+#FIXME: move node_exporter to standard and remove it from here when ready
+class role::mariadb::groups(
+    $mysql_group,
+    $mysql_role,
+    $mysql_shard = '',
+    ) {
+
+    salt::grain { 'mysql_group':
+        ensure  => present,
+        replace => true,
+        value   => $mysql_group,
+    }
+
+    salt::grain { 'mysql_role':
+        ensure  => present,
+        replace => true,
+        value   => $mysql_role,
+    }
+
+    if $mysql_shard != '' {
+        salt::grain { 'mysql_shard':
+            ensure  => present,
+            replace => true,
+            value   => $mysql_shard,
+        }
+    }
+
+    if os_version('debian >= jessie') and $::site == 'codfw' {
+        include role::prometheus::node_exporter
+        include role::prometheus::mysqld_exporter
+    }
+}
+
 # miscellaneous services clusters
 class role::mariadb::misc(
     $shard  = 'm1',
@@ -113,10 +166,20 @@
         false => 1,
     }
 
+    $mysql_role = $master ? {
+        true  => 'master',
+        false => 'slave',
+    }
+
     include standard
     include role::mariadb::monitor
     include passwords::misc::scripts
     include role::mariadb::ferm
+    class { 'role::mariadb::groups':
+        mysql_group => 'misc',
+        mysql_shard => $shard,
+        mysql_role  => $mysql_role,
+    }
 
     class { 'mariadb::packages_wmf':
         mariadb10 => true,
@@ -162,9 +225,21 @@
     class { 'mariadb::packages_wmf':
         mariadb10 => $mariadb10,
     }
+
+    $mysql_role = $master ? {
+        true  => 'master',
+        false => 'slave',
+    }
+
     include role::mariadb::monitor
     include passwords::misc::scripts
     include role::mariadb::ferm
+
+    class { 'role::mariadb::groups':
+        mysql_group => 'misc',
+        mysql_shard => $shard,
+        mysql_role  => $mysql_role,
+    }
 
     $read_only = $master ? {
         true  => 0,
@@ -230,10 +305,21 @@
         description => 'Eventlogging Database',
     }
 
+    $mysql_role = $master ? {
+        true  => 'master',
+        false => 'slave',
+    }
+
     include standard
     include role::mariadb::monitor::dba
     include passwords::misc::scripts
     include role::mariadb::ferm
+
+    class {'role::mariadb::groups':
+        mysql_group => 'misc',
+        mysql_shard => $shard,
+        mysql_role  => $mysql_role,
+    }
 
     class { 'mariadb::packages_wmf':
         mariadb10 => true,
@@ -305,6 +391,11 @@
     include passwords::misc::scripts
     include role::mariadb::ferm
 
+    class {'role::mariadb::groups':
+        mysql_group => 'tendril',
+        mysql_role  => 'standalone',
+    }
+
     ferm::service { 'memcached_tendril':
         proto  => 'tcp',
         port   => '11211',
@@ -341,6 +432,11 @@
     include passwords::misc::scripts
     include role::mariadb::ferm
 
+    class {'role::mariadb::groups':
+        mysql_group => 'dbstore',
+        mysql_role  => 'slave',
+    }
+
     class { 'mariadb::config':
         prompt   => 'DBSTORE',
         config   => 'mariadb/dbstore.my.cnf.erb',
@@ -373,7 +469,6 @@
 # analytics slaves are already either dbstores or eventlogging slaves
 # so they just need the extra core monitoring
 class role::mariadb::analytics {
-
     mariadb::monitor_replication { ['s1','s2']:
         is_critical   => false,
         contact_group => 'admins', # only show on nagios/irc
@@ -507,17 +602,12 @@
         $mysql_role = 'slave'
     }
 
-    salt::grain { 'mysql_role':
-        ensure  => present,
-        replace => true,
-        value   => $mysql_role,
+    class { 'role::mariadb::groups':
+        mysql_group => 'core',
+        mysql_shard => $shard,
+        mysql_role  => $mysql_role,
     }
 
-    salt::grain { 'mysql_shard':
-        ensure  => present,
-        replace => true,
-        value   => $shard,
-    }
 
     class { 'mariadb::packages_wmf':
         mariadb10 => true,
@@ -577,6 +667,10 @@
     include standard
     include role::mariadb::grants
     include passwords::misc::scripts
+    class { 'role::mariadb::groups':
+        mysql_group => 'labs',
+        mysql_role  => 'slave',
+    }
 
     class { 'mariadb::packages_wmf':
         mariadb10 => true,
@@ -670,6 +764,11 @@
     include role::mariadb::ferm
     include base::firewall
 
+    class { 'role::mariadb::groups':
+        mysql_group => 'labs',
+        mysql_role  => 'slave',
+    }
+
     class { 'mariadb::packages_wmf':
         mariadb10 => true,
     }
@@ -718,6 +817,10 @@
     include role::mariadb::grants::wikitech
     include role::mariadb::monitor
     include passwords::misc::scripts
+    class { 'role::mariadb::groups':
+        mysql_group => 'wikitech',
+        mysql_role  => 'standalone',
+    }
 
     class { 'mariadb::packages_wmf':
         mariadb10 => true,
@@ -826,6 +929,11 @@
     include role::mariadb::monitor
     include role::mariadb::ferm
     include passwords::misc::scripts
+    class { 'role::mariadb::groups':
+        mysql_group => 'parsercache',
+        mysql_shard => $shard,
+        mysql_role  => 'master',
+    }
 
     system::role { 'role::mariadb::parsercache':
         description => "Parser Cache Database ${shard}",
diff --git a/manifests/site.pp b/manifests/site.pp
index 685423d..9fb484e 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -449,20 +449,11 @@
     include base::firewall
 }
 
-node /^db20(34|42|48|55|62|70)\.codfw\.wmnet/ {
+node /^db20(34|42|48|55|62|69|70)\.codfw\.wmnet/ {
     class { 'role::mariadb::core':
         shard         => 's1',
         binlog_format => 'ROW',
     }
-    include base::firewall
-}
-
-node 'db2069.codfw.wmnet' {
-    class { 'role::mariadb::core':
-        shard         => 's1',
-        binlog_format => 'ROW',
-    }
-    role prometheus::mysqld_exporter
     include base::firewall
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I19f12a893f9da334984dc3cc40d247fbefe58e45
Gerrit-PatchSet: 22
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Jcrespo <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Jcrespo <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to