Filippo Giunchedi has submitted this change and it was merged.
Change subject: prometheus: add beta-specific instance
......................................................................
prometheus: add beta-specific instance
Allow testing more specific exporters in Beta (e.g. varnish)
Bug: T144502
Change-Id: I5420e75458eff7a62881260d9e6d190724eee859
---
A modules/role/files/prometheus/alerts_beta.conf
A modules/role/files/prometheus/rules_beta.conf
A modules/role/manifests/prometheus/beta.pp
3 files changed, 106 insertions(+), 0 deletions(-)
Approvals:
Filippo Giunchedi: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/role/files/prometheus/alerts_beta.conf
b/modules/role/files/prometheus/alerts_beta.conf
new file mode 100644
index 0000000..b540ed3
--- /dev/null
+++ b/modules/role/files/prometheus/alerts_beta.conf
@@ -0,0 +1,21 @@
+ALERT InstanceLoadHigh
+ IF node_load1 / ON(instance) count(node_cpu{mode="idle"}) BY (instance) > 1
+ FOR 5m
+ LABELS {
+ severity="warn"
+ }
+ ANNOTATIONS {
+ DESCRIPTION="{{$labels.instance}} of job {{$labels.job}} load average
exceeds its number of cores",
+ SUMMARY="{{$labels.instance}} high CPU load {{$value}}"
+ }
+
+ALERT InstanceDiskFullCrit
+ IF node_filesystem_avail{fstype!~"(rpc_pipefs|rootfs)"} /
node_filesystem_size < 0.05
+ FOR 10m
+ LABELS {
+ severity="crit"
+ }
+ ANNOTATIONS {
+ DESCRIPTION="The instance {{$labels.instance}} filesystem
{{$labels.mountpoint}} at {{$value}}",
+ SUMMARY="{{$labels.instance}} FS {{$labels.mountpoint}} at {{$value}}
avail"
+ }
diff --git a/modules/role/files/prometheus/rules_beta.conf
b/modules/role/files/prometheus/rules_beta.conf
new file mode 100644
index 0000000..aee9557
--- /dev/null
+++ b/modules/role/files/prometheus/rules_beta.conf
@@ -0,0 +1 @@
+# https://prometheus.io/docs/practices/rules/
diff --git a/modules/role/manifests/prometheus/beta.pp
b/modules/role/manifests/prometheus/beta.pp
new file mode 100644
index 0000000..2d6b8e4
--- /dev/null
+++ b/modules/role/manifests/prometheus/beta.pp
@@ -0,0 +1,84 @@
+# == Class: role::prometheus::beta
+#
+# This class provides a Prometheus server used to monitor Beta
+# (deployment-prep) labs project.
+
+class role::prometheus::beta {
+ $targets_path = '/srv/prometheus/beta/targets'
+ $rules_path = '/srv/prometheus/beta/rules'
+
+ # one job per varnish cache 'role'
+ $varnish_jobs = [
+ {
+ 'job_name' => 'varnish-text',
+ 'file_sd_configs' => [
+ { 'names' => [ "${targets_path}/varnish-text_*.yaml"] },
+ ]
+ },
+ {
+ 'job_name' => 'varnish-upload',
+ 'file_sd_configs' => [
+ { 'names' => [ "${targets_path}/varnish-upload_*.yaml"] },
+ ]
+ },
+ ]
+
+ $mysql_jobs = [
+ {
+ 'job_name' => 'mysql-core',
+ 'file_sd_configs' => [
+ { 'names' => [ "${targets_path}/mysql-core_*.yaml"] },
+ ]
+ },
+ ]
+
+ $web_jobs = [
+ {
+ 'job_name' => 'apache',
+ 'file_sd_configs' => [
+ { 'names' => [ "${targets_path}/apache_*.yaml"] },
+ ]
+ },
+ {
+ 'job_name' => 'hhvm',
+ 'file_sd_configs' => [
+ { 'names' => [ "${targets_path}/hhvm_*.yaml"] },
+ ]
+ },
+ {
+ 'job_name' => 'memcache',
+ 'file_sd_configs' => [
+ { 'names' => [ "${targets_path}/memcache_*.yaml"] },
+ ]
+ },
+ ]
+
+ prometheus::server { 'beta':
+ listen_address => '127.0.0.1:9903',
+ scrape_configs_extra => concat($varnish_jobs, $mysql_jobs, $web_jobs),
+ }
+
+ prometheus::web { 'beta':
+ proxy_pass => 'http://127.0.0.1:9903/beta',
+ }
+
+ file { "${rules_path}/rules_beta.conf":
+ source => 'puppet:///modules/role/prometheus/rules_beta.conf',
+ }
+
+ file { "${rules_path}/alerts_beta.conf":
+ source => 'puppet:///modules/role/prometheus/alerts_beta.conf',
+ }
+
+ $targets_file = "${targets_path}/node_project.yml"
+
+ include ::prometheus::scripts
+
+ cron { 'prometheus_labs_project_targets':
+ ensure => present,
+ command => "/usr/local/bin/prometheus-labs-targets >
${targets_file}.$$ && mv ${targets_file}.$$ ${targets_file}",
+ minute => '*/10',
+ hour => '*',
+ user => 'prometheus',
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/313816
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5420e75458eff7a62881260d9e6d190724eee859
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits