MaxSem has uploaded a new change for review.
https://gerrit.wikimedia.org/r/50043
Change subject: Make check_solr work with Python 2.6
......................................................................
Make check_solr work with Python 2.6
Also, make it use FQDN
Change-Id: Iaedc2d589f5096011f884db96bf0685a45403a6f
---
M files/nagios/check_solr
M manifests/role/solr.pp
M templates/icinga/checkcommands.cfg.erb
3 files changed, 11 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/43/50043/1
diff --git a/files/nagios/check_solr b/files/nagios/check_solr
index 2ec27a7..bcf3f3d 100755
--- a/files/nagios/check_solr
+++ b/files/nagios/check_solr
@@ -46,14 +46,15 @@
warnings.append(message % (value, limits[1]))
-def check_stat(entry, stat, limits, stat_name):
+def check_stat(entry, statName, limits, stat_name):
if limits == None:
return
- node = entry.find(".//stats/stat[@name='%s']" % stat)
- if node != None:
- check_value(node.text, limits, stat_name + ' is %s (gt %s)')
- else:
- unknowns.append('Parameter "%s" not found in response' % stat)
+ stats = entry.find('stats')
+ for node in stats.getiterator('stat'):
+ if node.attrib['name'] == statName:
+ check_value(node.text, limits, stat_name + ' is %s (gt %s)')
+ return
+ unknowns.append('Parameter "%s" not found in response' % stat)
def check_select(entry):
@@ -74,7 +75,7 @@
text = http_get('admin/stats.jsp')
xml = ET.fromstring(text)
- for entry in xml.iter('entry'):
+ for entry in xml.getiterator('entry'):
name = entry.find('name').text.strip()
if name == '/select':
check_select(entry)
diff --git a/manifests/role/solr.pp b/manifests/role/solr.pp
index e4f77e4..dbc3901 100644
--- a/manifests/role/solr.pp
+++ b/manifests/role/solr.pp
@@ -19,7 +19,7 @@
}
monitor_service { "Solr":
description => "Solr",
- check_command => "$check_command!$::hostname!400:600!5",
+ check_command => "$check_command!$::fqdn!400:600!5",
}
}
diff --git a/templates/icinga/checkcommands.cfg.erb
b/templates/icinga/checkcommands.cfg.erb
index 9f77a8e..aed1f3f 100644
--- a/templates/icinga/checkcommands.cfg.erb
+++ b/templates/icinga/checkcommands.cfg.erb
@@ -89,13 +89,13 @@
# Example usage: check_solr!solr1001!500:1000|5
define command{
command_name check_solr
- command_line $USER1$/check_solr -t $ARG3 $ARG1
+ command_line $USER1$/check_solr -a $ARG2 -t $ARG3 $ARG1
}
# Example usage: check_replicated_solr!solr1001!500:1000|5
define command{
command_name check_replicated_solr
- command_line $USER1$/check_solr -r -t $ARG3 $ARG1
+ command_line $USER1$/check_solr -r -a $ARG2 -t $ARG3 $ARG1
}
# 'check_ssl_cert'
--
To view, visit https://gerrit.wikimedia.org/r/50043
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaedc2d589f5096011f884db96bf0685a45403a6f
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: MaxSem <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits