Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/solr/solrmulticore | ||
|---|---|---|
| 1 | 1 |
#!/usr/bin/python |
| 2 |
#
|
|
| 2 |
# |
|
| 3 | 3 |
# Copyright (C) Rodolphe Franceschi |
| 4 |
#
|
|
| 4 |
# |
|
| 5 | 5 |
# This program is free software; you can redistribute it and/or |
| 6 | 6 |
# modify it under the terms of the GNU General Public License |
| 7 | 7 |
# as published by the Free Software Foundation; either version 2 |
| 8 | 8 |
# of the License, or (at your option) any later version. |
| 9 |
#
|
|
| 9 |
# |
|
| 10 | 10 |
# This program is distributed in the hope that it will be useful, |
| 11 | 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | 13 |
# GNU General Public License for more details. |
| 14 |
#
|
|
| 14 |
# |
|
| 15 | 15 |
# You should have received a copy of the GNU General Public License |
| 16 | 16 |
# along with this program; if not, write to the Free Software |
| 17 | 17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 |
#
|
|
| 19 |
#
|
|
| 18 |
# |
|
| 19 |
# |
|
| 20 | 20 |
# This plugin monitors a SOLR server configured for multicore by automatically |
| 21 | 21 |
# getting core names from SOLR default page. |
| 22 |
#
|
|
| 22 |
# |
|
| 23 | 23 |
# Tested on SOLR 1.4.0 |
| 24 |
#
|
|
| 24 |
# |
|
| 25 | 25 |
# Parameters: |
| 26 | 26 |
# config (required) |
| 27 | 27 |
# autoconf (optional - used by munin-config) |
| 28 | 28 |
# |
| 29 | 29 |
# For the full list of options, refer to PLUGINOPTIONSLIST variable |
| 30 |
#
|
|
| 30 |
# |
|
| 31 | 31 |
# Example of symlink creation on Debian Lenny |
| 32 | 32 |
# ln -s /usr/share/munin/plugins/solrmulticore_ /etc/munin/plugins/solrmulticore_avgRequestsPerSecond |
| 33 |
#
|
|
| 33 |
# |
|
| 34 | 34 |
# Magic markers (Used by munin-config and some installation scripts. |
| 35 | 35 |
# Optional): |
| 36 | 36 |
#%# family=auto |
| 37 | 37 |
#%# capabilities=autoconf |
| 38 | 38 |
|
| 39 |
import sys, os
|
|
| 39 |
import sys, os |
|
| 40 | 40 |
import urllib2 |
| 41 | 41 |
import HTMLParser, urllib |
| 42 | 42 |
|
| ... | ... | |
| 101 | 101 |
|
| 102 | 102 |
params = { }
|
| 103 | 103 |
params['valueName'] = parts[1] |
| 104 |
|
|
| 104 |
|
|
| 105 | 105 |
# Automatic / Manual Mode for core names |
| 106 | 106 |
if (len(SOLR_CORES) == 0): |
| 107 | 107 |
params['cores'] = getSolrCoreNameList() |
| ... | ... | |
| 173 | 173 |
params = parseArgs() |
| 174 | 174 |
for core in params['cores']: |
| 175 | 175 |
#print core, params['valueName'] |
| 176 |
queues = fetchUrl(core, PLUGINOPTIONSLIST[params['valueName']]['xmlpath'])
|
|
| 176 |
queues = fetchUrl(core, PLUGINOPTIONSLIST[params['valueName']]['xmlpath']) |
|
| 177 | 177 |
searcher = getEntry(queues, PLUGINOPTIONSLIST[params['valueName']]['xmlparententryname']) |
| 178 | 178 |
value = getValue(searcher, params['valueName']).strip() |
| 179 | 179 |
print "%s.value %s" % (core, value) |
Formats disponibles : Unified diff