mirror of
https://github.com/thegeeklab/prometheus-pve-sd.git
synced 2024-11-24 18:30:40 +00:00
fix: fix API client creation loop
This commit is contained in:
parent
1df0c9ed39
commit
831fad522f
@ -28,13 +28,20 @@ class PrometheusSD:
|
|||||||
|
|
||||||
signal.signal(signal.SIGINT, self._terminate)
|
signal.signal(signal.SIGINT, self._terminate)
|
||||||
signal.signal(signal.SIGTERM, self._terminate)
|
signal.signal(signal.SIGTERM, self._terminate)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
self.discovery = Discovery()
|
self.discovery = Discovery()
|
||||||
except APIError as e:
|
except APIError as e:
|
||||||
|
if not self.config.config["service"]:
|
||||||
|
self.log.sysexit_with_message(
|
||||||
|
"Proxmoxer API error: {0}".format(str(e).strip())
|
||||||
|
)
|
||||||
|
|
||||||
self.logger.error("Proxmoxer API error: {0}".format(str(e).strip()))
|
self.logger.error("Proxmoxer API error: {0}".format(str(e).strip()))
|
||||||
sleep(5)
|
sleep(60)
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
self._fetch()
|
self._fetch()
|
||||||
@ -57,6 +64,7 @@ class PrometheusSD:
|
|||||||
"--loop-delay",
|
"--loop-delay",
|
||||||
dest="loop_delay",
|
dest="loop_delay",
|
||||||
action="store",
|
action="store",
|
||||||
|
type=int,
|
||||||
help="delay between discovery runs"
|
help="delay between discovery runs"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
Loading…
Reference in New Issue
Block a user