Puppet Class: profile::graphite::production
- Defined in:
- modules/profile/manifests/graphite/production.pp
Overview
SPDX-License-Identifier: Apache-2.0
Class: profile::graphite::production
Set up graphite instance for production. Also includes icinga checks for anomalies for MediaWiki, EL & Swift metrics Instance requires people to authenticate via LDAP before they can see metrics.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'modules/profile/manifests/graphite/production.pp', line 8
class profile::graphite::production (
Array[Stdlib::Fqdn] $graphite_hosts = lookup('profile::graphite::hosts'),
Stdlib::Fqdn $primary_host = lookup('graphite_primary_host'),
) {
$storage_dir = '/srv/carbon'
class { '::httpd':
modules => ['headers', 'rewrite', 'proxy', 'proxy_http', 'uwsgi', 'authnz_ldap'],
}
include profile::idp::client::httpd
class { 'profile::graphite::base':
storage_dir => $storage_dir,
uwsgi_max_request_duration_seconds => 60,
uwsgi_max_request_rss_megabytes => 1024,
provide_vhost => false,
c_relay_settings => {
forward_clusters => {
'default' => [
'graphite1005.eqiad.wmnet:1903',
'graphite2004.codfw.wmnet:1903',
],
'big_users' => [
'graphite1005.eqiad.wmnet:1903',
'graphite2004.codfw.wmnet:1903',
]
},
cluster_routes => [
['^cassandra\.', 'big_users'],
],
'queue_depth' => 500000,
'batch_size' => 8000,
},
}
file { '/var/lib/carbon':
ensure => directory,
}
file { '/var/lib/carbon/whisper':
ensure => link,
target => "${storage_dir}/whisper",
owner => '_graphite',
group => '_graphite',
require => Class['profile::graphite::base']
}
# Cleanup stale labs instances data - T143405
graphite::whisper_cleanup { 'graphite-labs-instances':
directory => "${storage_dir}/whisper/instances",
}
# Cleanup eventstreams rdkafka stale data - T160644
graphite::whisper_cleanup { 'graphite-eventstreams':
directory => "${storage_dir}/whisper/eventstreams/rdkafka",
keep_days => 5,
}
# Cleanup zuul data
graphite::whisper_cleanup { 'graphite-zuul':
directory => "${storage_dir}/whisper/zuul",
}
# Zuul also generates metrics related to Gerrit
graphite::whisper_cleanup { 'graphite-zuul-gerrit':
directory => "${storage_dir}/whisper/gerrit",
}
# Cassandra metrics - T179057
graphite::whisper_cleanup { 'graphite-cassandra':
directory => "${storage_dir}/whisper/cassandra",
keep_days => 182,
}
# General cleanup of metric files not updated. ~3y
graphite::whisper_cleanup { 'graphite-stale-metrics':
directory => "${storage_dir}/whisper",
keep_days => 1024,
}
include rsync::server
rsync::server::module { 'carbon':
path => $storage_dir,
uid => '_graphite',
gid => '_graphite',
hosts_allow => $graphite_hosts,
auto_firewall => true,
}
firewall::service { 'carbon_c_relay-local_relay_udp':
proto => 'udp',
port => 1903,
srange => $graphite_hosts,
}
firewall::service { 'carbon_c_relay-local_relay_tcp':
proto => 'tcp',
port => 1903,
srange => $graphite_hosts,
}
firewall::service { 'carbon_c_relay-frontend_relay_udp':
proto => 'udp',
port => 2003,
src_sets => ['DOMAIN_NETWORKS'],
}
firewall::service { 'carbon_c_relay-frontend_relay_tcp':
proto => 'tcp',
port => 2003,
src_sets => ['DOMAIN_NETWORKS'],
}
firewall::service { 'carbon_pickled':
proto => 'tcp',
port => 2004,
src_sets => ['DOMAIN_NETWORKS'],
}
profile::auto_restarts::service { 'apache2': }
profile::auto_restarts::service { 'envoyproxy': }
backup::set { 'srv-carbon-whisper-coal': }
# Backup 'daily' metrics, only every week
backup::set { 'srv-carbon-whisper-daily':
jobdefaults => 'Weekly-Mon-productionEqiad',
}
backup::set { 'var-lib-graphite-web-graphite-db': }
# alert only on the primary server
if $::fqdn == $primary_host {
include profile::graphite::alerts
include profile::elasticsearch::alerts
}
}
|