housekeeping and cleanups...
This commit is contained in:
parent
dc0c54bc5b
commit
88b0c3dd7a
5 changed files with 23 additions and 33 deletions
|
|
@ -45,12 +45,12 @@ class HostService:
|
|||
ret += "warning: " + str(self.warning)
|
||||
if self.critical:
|
||||
ret += "critical: " + str(self.critical)
|
||||
return ret;
|
||||
return ret
|
||||
|
||||
|
||||
def parseHostList(hosts, services, log):
|
||||
"""
|
||||
parse the HostList and replace any command as nessesary
|
||||
parse the HostList and replace any command as necessary
|
||||
"""
|
||||
#precompiled regexPattern which finds replacements in service strings
|
||||
pattern = re.compile("@(\w+)")
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ class Command:
|
|||
return self.command
|
||||
|
||||
def call(self):
|
||||
'''
|
||||
self.commandStart = dt.now()
|
||||
"called at: "
|
||||
process = sp.Popen(stdout=PIPE, *popenargs, **kwargs)
|
||||
self.output, self.error = process.communicate()
|
||||
self.retcode = process.poll()
|
||||
'''
|
||||
|
||||
# self.commandStart = dt.now()
|
||||
# "called at: "
|
||||
# process = sp.Popen(stdout=PIPE, *popenargs, **kwargs)
|
||||
# self.output, self.error = process.communicate()
|
||||
# self.retcode = process.poll()
|
||||
|
||||
try:
|
||||
self.commandStart = dt.now()
|
||||
self.log.i("calling command " + str(self.command) + " at " + str(self.commandStart))
|
||||
|
|
@ -36,7 +36,6 @@ class Command:
|
|||
self.error = CalledProcessError.output
|
||||
self.retcode = CalledProcessError.returncode
|
||||
|
||||
|
||||
def getOutput(self):
|
||||
return self.output
|
||||
|
||||
|
|
@ -48,4 +47,3 @@ class Command:
|
|||
|
||||
def getReturnCode(self):
|
||||
return self.retcode
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@ execute.
|
|||
|
||||
from command import Command
|
||||
|
||||
|
||||
def generateId():
|
||||
i = 0
|
||||
while True:
|
||||
yield i
|
||||
i += 1
|
||||
|
||||
|
||||
class JobInfo:
|
||||
def __init__(self, hostgroupname, members, hosts, hostServices, threshold, parent=None):
|
||||
self.members = members
|
||||
|
|
@ -51,13 +53,3 @@ class JobInfo:
|
|||
self.log.d(cmd.getAllOutput())
|
||||
except Exception:
|
||||
self.log.d(Exception)
|
||||
|
||||
|
||||
#must find real service command stored in hosts...
|
||||
#but because of error, mentioned in NOTES,ruff, there is no ping i.e.
|
||||
|
||||
#cmd = Command(service.command)
|
||||
#self.log.d("executing command: " + str(command))
|
||||
#cmd.call()
|
||||
#return cmd
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue