2to3/manual: check_livestatus_latency.py
This commit is contained in:
parent
a49297eda7
commit
97d6a3669e
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
#####################################################################
|
||||
# (c) 2016 by Sven Velt, Germany #
|
||||
# (c) 2016- by Sven Velt, Germany #
|
||||
# sven-mymonplugins@velt.biz #
|
||||
# #
|
||||
# This file is part of "velt.biz - My Monitoring Plugins" #
|
||||
|
@ -29,19 +29,18 @@ import socket
|
|||
import sys
|
||||
|
||||
try:
|
||||
from monitoringplugin import MonitoringPlugin
|
||||
from MyMonPlugin import MonitoringPlugin
|
||||
except ImportError:
|
||||
print '=========================='
|
||||
print 'AIKS! Python import error!'
|
||||
print '==========================\n'
|
||||
print 'Could not find "monitoringplugin.py"!\n'
|
||||
print 'Did you download "%s"' % os.path.basename(sys.argv[0])
|
||||
print 'without "monitoringplugin.py"?\n'
|
||||
print 'Please go back to'
|
||||
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
|
||||
print 'or even better:'
|
||||
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
|
||||
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
|
||||
print('==========================')
|
||||
print('AIKS! Python import error!')
|
||||
print('==========================\n')
|
||||
print('Could not find class "MonitoringPlugin"!\n')
|
||||
print('Did you download "%s"' % os.path.basename(sys.argv[0]))
|
||||
print('without "MyMonPlugin/"?\n')
|
||||
print('Please go back to')
|
||||
print('https://gogs.velt.biz/velt.biz/MyMonPlugins and:')
|
||||
print('- get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases')
|
||||
print('- or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n')
|
||||
sys.exit(127)
|
||||
|
||||
|
||||
|
@ -83,7 +82,7 @@ if not os.access(plugin.options.socket, os.W_OK):
|
|||
plugin.back2nagios(3, 'Could not read from socket "%s"' % plugin.options.socket)
|
||||
# FIXME: End
|
||||
|
||||
cmd_svc='''GET services
|
||||
cmd_svc=b'''GET services
|
||||
OutputFormat: csv
|
||||
Stats: min latency
|
||||
Stats: max latency
|
||||
|
@ -93,7 +92,7 @@ Stats: max execution_time
|
|||
Stats: avg execution_time
|
||||
'''
|
||||
|
||||
cmd_hst='''GET hosts
|
||||
cmd_hst=b'''GET hosts
|
||||
OutputFormat: csv
|
||||
Stats: min latency
|
||||
Stats: max latency
|
||||
|
@ -116,7 +115,7 @@ try:
|
|||
s.settimeout(10)
|
||||
data = s.recv(32768)
|
||||
if data:
|
||||
answer += data
|
||||
answer += data.decode('utf-8')
|
||||
else:
|
||||
break
|
||||
except socket.timeout:
|
||||
|
@ -142,7 +141,7 @@ try:
|
|||
s.settimeout(10)
|
||||
data = s.recv(32768)
|
||||
if data:
|
||||
answer += data
|
||||
answer += data.decode('utf-8')
|
||||
else:
|
||||
break
|
||||
except socket.timeout:
|
||||
|
|
Loading…
Reference in a new issue