1
0
Fork 0
mirror of https://github.com/ThomasGsp/HyperProxmox.git synced 2025-03-09 15:40:18 +00:00

uid option

init thread func
This commit is contained in:
Tlams 2018-04-29 21:55:05 +01:00
parent 9d8762e1c6
commit 226b5cc4ad
3 changed files with 36 additions and 27 deletions

View file

@ -4,7 +4,7 @@ Langage: Python
Minimum version require: 3.4 Minimum version require: 3.4
Module function: Module function:
The goal of this module is to analyse the differents clusters and node The goal of this module is to analyse clusters and nodes
to allocate news instances. to allocate news instances.
""" """
@ -56,6 +56,10 @@ class Analyse:
self.clusters_conf = self.mongo.get_clusters_conf()["value"] self.clusters_conf = self.mongo.get_clusters_conf()["value"]
def threadcrawl(self):
return
def run(self, instancetype="all"): def run(self, instancetype="all"):
""" Active logger""" """ Active logger"""
self.logger.write({"thread":threading.get_ident(), "result": "INFO", "type": "HYPERPROXMOX", "value": "Start logger - Analyst Module"}) self.logger.write({"thread":threading.get_ident(), "result": "INFO", "type": "HYPERPROXMOX", "value": "Start logger - Analyst Module"})
@ -180,6 +184,7 @@ class Analyse:
instance["macaddr"] = maclist instance["macaddr"] = maclist
""" Following instance ID """ """ Following instance ID """
if self.generalconf["analyst"]["walker_uid"]:
getidfromdesc = re.search("id=\"([A-Z\.\d\_]+)\"", currentdesc) getidfromdesc = re.search("id=\"([A-Z\.\d\_]+)\"", currentdesc)
# Set unique id if not found # Set unique id if not found
if getidfromdesc is None: if getidfromdesc is None:

View file

@ -8,7 +8,6 @@ key_pub: private/keys/Ragnarok.pub.key
admin_mail: tlams@localhost admin_mail: tlams@localhost
[web] [web]
user: www-data user: www-data
@ -45,6 +44,9 @@ walker: 300
; Lock file -- prevent concurrent crawling ; Lock file -- prevent concurrent crawling
walker_lock: /tmp/hyperproxmoxwalker.lock walker_lock: /tmp/hyperproxmoxwalker.lock
; Set an unique ID (change comment part)
uid = False
[logger] [logger]
; logs level 1: "INFO", 2: "WARNING", 3: "ERROR", 4: "CRITICAL", 5: "DEBUG" ; logs level 1: "INFO", 2: "WARNING", 3: "ERROR", 4: "CRITICAL", 5: "DEBUG"
logs_level = 5 logs_level = 5

View file

@ -37,7 +37,9 @@ if __name__ == "__main__":
"logs_dir": localconf['logger']['logs_dir'], "bulk_write": localconf['logger']['bulk_write'], "logs_dir": localconf['logger']['logs_dir'], "bulk_write": localconf['logger']['bulk_write'],
"bulk_size": localconf['logger']['bulk_size']}, "bulk_size": localconf['logger']['bulk_size']},
"analyst": {"walker": localconf['walker']['walker'], "walker_lock": localconf['walker']['walker_lock']}, "analyst": {"walker": localconf['walker']['walker'], "walker_lock": localconf['walker']['walker_lock'],
"walker_uid": localconf['walker']['uid']
},
"mongodb": {"ip": localconf['databases']['mongodb_ip'], 'port': localconf['databases']['mongodb_port']}, "mongodb": {"ip": localconf['databases']['mongodb_ip'], 'port': localconf['databases']['mongodb_port']},