Change: minor changes in analyze & rabbitmq module
Change-Id: Ib3e373bfea86ad35e3e2f384b0cdc8762cc25f5a
This commit is contained in:
parent
ee44efcd49
commit
4139ef04cf
@ -4,7 +4,7 @@
|
||||
%global pypi_name timmy
|
||||
|
||||
Name: python-%{pypi_name}
|
||||
Version: 1.26.4
|
||||
Version: 1.26.5
|
||||
Release: 1%{?dist}~mos0
|
||||
Summary: Log collector tool for OpenStack Fuel
|
||||
|
||||
@ -107,6 +107,10 @@ popd
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Dec 27 2016 Dmitry Sutyagin <dsutyagin@mirantis.com> - 1.26.5
|
||||
- Change: minor changes in analyze & rabbitmq module
|
||||
- Add: stderr for mapping scripts
|
||||
|
||||
* Thu Dec 22 2016 Dmitry Sutyagin <dsutyagin@mirantis.com> - 1.26.4
|
||||
- Add: max_pairs argument; other minor changes
|
||||
|
||||
|
@ -59,8 +59,17 @@ def analyze(node_manager):
|
||||
if os.path.exists(param['stderr_path']):
|
||||
with open(param['stderr_path'], 'r') as f:
|
||||
stderr = f.read()
|
||||
exitcode = stderr.splitlines()[0]
|
||||
exitcode = exitcode.rstrip().split()[1]
|
||||
try:
|
||||
exitcode = stderr.splitlines()[0]
|
||||
exitcode = int(exitcode.rstrip().split()[1])
|
||||
except IndexError:
|
||||
logger.warning('Could not extract exitcode'
|
||||
' from file "%s"' %
|
||||
param['stderr_path'])
|
||||
except ValueError:
|
||||
logger.warning('Could not convert exitcode'
|
||||
' in file "%s" to int' %
|
||||
param['stderr_path'])
|
||||
else:
|
||||
stderr = None
|
||||
exitcode = 0
|
||||
@ -106,11 +115,11 @@ def analyze_print_results(node_manager):
|
||||
(os.path.exists(r['stderr_file']))):
|
||||
print('%s%s: %s' % (12*' ', 'stderr_file', r['stderr_file']))
|
||||
if r['exitcode'] != 0:
|
||||
print('%s%s: %s' % (12*' ', 'exit code', r['exitcode']))
|
||||
print('%s%s: %s' % (12*' ', 'exitcode', r['exitcode']))
|
||||
if len(r['details']) > 1:
|
||||
print(' details:')
|
||||
print('%sdetails:' % (12*' '))
|
||||
for d in r['details']:
|
||||
print(' - %s' % d)
|
||||
else:
|
||||
print(' details: %s' % r['details'][0])
|
||||
print('%s- %s' % (16*' ', d))
|
||||
elif r['details']:
|
||||
print('%sdetails: %s' % (12*' ', r['details'][0]))
|
||||
sys.stdout.write(color_end)
|
||||
|
@ -35,6 +35,9 @@ def parse_list_queues(stdout, script, node, stderr=None, exitcode=None):
|
||||
error = 1000
|
||||
health = GREEN
|
||||
details = []
|
||||
if exitcode:
|
||||
health = UNKNOWN
|
||||
return health, details
|
||||
data = [l.rstrip() for l in stdout.splitlines()]
|
||||
for line in data[1:]:
|
||||
elements = line.rstrip().split()
|
||||
@ -118,14 +121,17 @@ def squash_dicts(input_data):
|
||||
|
||||
|
||||
def parse_status(stdout, script, node, stderr=None, exitcode=None):
|
||||
status = prepare_status(stdout)
|
||||
if not status or exitcode:
|
||||
health = RED
|
||||
details = ['Failed on getting data from status']
|
||||
return health, details
|
||||
|
||||
health = GREEN
|
||||
details = []
|
||||
status = prepare_status(stdout)
|
||||
if not status:
|
||||
health = UNKNOWN
|
||||
details = ['Status unavailable']
|
||||
if exitcode:
|
||||
if exitcode == 69:
|
||||
health = RED
|
||||
details = ['RabbitMQ is not running']
|
||||
return health, details
|
||||
|
||||
# disk free check
|
||||
try:
|
||||
|
@ -16,7 +16,7 @@
|
||||
# under the License.
|
||||
|
||||
project_name = 'timmy'
|
||||
version = '1.26.4'
|
||||
version = '1.26.5'
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
Loading…
x
Reference in New Issue
Block a user