Commit 9c3aa7c5 by JR Dalrymple

It makes the files, only part left is the restarting Najios

parent d113e907
...@@ -14,7 +14,9 @@ servicesToCreate = [] ...@@ -14,7 +14,9 @@ servicesToCreate = []
servicesToPop = [] servicesToPop = []
hostServiceList = [] hostServiceList = []
existingServices = [] existingServices = []
outLines = []
service_descriptionMatch = re.compile(r"^\s*service_description.*")
unconfiguredServiceMatch = re.compile(r"(^.*Passive check result was received for service ')(.*?)(' on host ')(.*?)(', but the service could not be found)") unconfiguredServiceMatch = re.compile(r"(^.*Passive check result was received for service ')(.*?)(' on host ')(.*?)(', but the service could not be found)")
# Borrowing some code from my other project (should turn it into a module I suppose) # Borrowing some code from my other project (should turn it into a module I suppose)
...@@ -110,3 +112,21 @@ for servicesNotToCreate in hostServiceList: ...@@ -110,3 +112,21 @@ for servicesNotToCreate in hostServiceList:
servicesToCreate.remove(servicesNotToCreate) servicesToCreate.remove(servicesNotToCreate)
### Here we are finally with the list of services we need to create for the host - list servicesToCreate ### Here we are finally with the list of services we need to create for the host - list servicesToCreate
with open(cfgInFile) as f:
cfgTemplateLines = f.read().splitlines()
f.close
for newService in servicesToCreate:
for line in cfgTemplateLines:
if service_descriptionMatch.match(line):
outLines.append("\tservice_description\t\t\t" + newService + "\n")
else:
outLines.append(line + "\n")
newFilename = cfgOutDir + newService + ".cfg"
f = open(newFilename, 'w')
for line in outLines:
f.write(line)
f.close
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment