Filippo Giunchedi has submitted this change and it was merged.

Change subject: monitoring: fail on graphite metrics using single quotes
......................................................................


monitoring: fail on graphite metrics using single quotes

as it turns out icinga will strip single quotes from the query, thus
resulting in 500s from graphite. Prevent this behaviour by failing, not
the best behaviour however blindly substituting single quotes with
double quotes doesn't seem ideal either.

Bug: T118398
Change-Id: If3c248d2c7bbdcd1e47d1c0cd508eae685f4d7b1
---
M modules/monitoring/manifests/graphite_anomaly.pp
M modules/monitoring/manifests/graphite_threshold.pp
2 files changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Filippo Giunchedi: Verified; Looks good to me, approved
  Giuseppe Lavagetto: Looks good to me, but someone else must approve



diff --git a/modules/monitoring/manifests/graphite_anomaly.pp 
b/modules/monitoring/manifests/graphite_anomaly.pp
index 04a0eeb9..3b753ec 100644
--- a/modules/monitoring/manifests/graphite_anomaly.pp
+++ b/modules/monitoring/manifests/graphite_anomaly.pp
@@ -76,6 +76,11 @@
     else {
         $modifier = ''
     }
+
+    if $metric =~ /'/ {
+        fail("single quotes will be stripped from graphite metric ${metric}, 
consider using double quotes")
+    }
+
     # checkcommands.cfg's check_graphite_anomaly command has
     # many positional arguments that
     # are passed to the check_graphite script:
diff --git a/modules/monitoring/manifests/graphite_threshold.pp 
b/modules/monitoring/manifests/graphite_threshold.pp
index 85738b5..6ea2bfa 100644
--- a/modules/monitoring/manifests/graphite_threshold.pp
+++ b/modules/monitoring/manifests/graphite_threshold.pp
@@ -91,6 +91,11 @@
         true    => 'check_graphite_series_threshold',
         default => 'check_graphite_threshold'
     }
+
+    if $metric =~ /'/ {
+        fail("single quotes will be stripped from graphite metric ${metric}, 
consider using double quotes")
+    }
+
     monitoring::service { $title:
         ensure                => $ensure,
         description           => $description,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If3c248d2c7bbdcd1e47d1c0cd508eae685f4d7b1
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to