Add host binding option
This commit is contained in:
parent
4ac1ba1f24
commit
b1e9b1e0b5
@ -34,6 +34,7 @@ pool_cache = {
|
|||||||
DEFAULT_PORT = 9116
|
DEFAULT_PORT = 9116
|
||||||
DEFAULT_INTERVAL = 10
|
DEFAULT_INTERVAL = 10
|
||||||
DEFAULT_PREFIX = "pve"
|
DEFAULT_PREFIX = "pve"
|
||||||
|
DEFAULT_HOST = "0.0.0.0"
|
||||||
|
|
||||||
gauge_settings = [
|
gauge_settings = [
|
||||||
('kvm_cpu', 'CPU time for VM', ['id', 'mode']),
|
('kvm_cpu', 'CPU time for VM', ['id', 'mode']),
|
||||||
@ -353,6 +354,7 @@ class PVECollector(object):
|
|||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='PVE metrics exporter for Prometheus')
|
parser = argparse.ArgumentParser(description='PVE metrics exporter for Prometheus')
|
||||||
parser.add_argument('--port', type=int, default=DEFAULT_PORT, help='Port for the exporter to listen on')
|
parser.add_argument('--port', type=int, default=DEFAULT_PORT, help='Port for the exporter to listen on')
|
||||||
|
parser.add_argument('--host', type=str, default=DEFAULT_HOST, help='Host address to bind the exporter to')
|
||||||
parser.add_argument('--interval', type=int, default=DEFAULT_INTERVAL, help='THIS OPTION DOES NOTHING')
|
parser.add_argument('--interval', type=int, default=DEFAULT_INTERVAL, help='THIS OPTION DOES NOTHING')
|
||||||
parser.add_argument('--collect-running-vms', type=str, default='true', help='Enable or disable collecting running VMs metric (true/false)')
|
parser.add_argument('--collect-running-vms', type=str, default='true', help='Enable or disable collecting running VMs metric (true/false)')
|
||||||
parser.add_argument('--collect-storage', type=str, default='true', help='Enable or disable collecting storage info (true/false)')
|
parser.add_argument('--collect-storage', type=str, default='true', help='Enable or disable collecting storage info (true/false)')
|
||||||
@ -388,7 +390,7 @@ def main():
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
REGISTRY.register(PVECollector())
|
REGISTRY.register(PVECollector())
|
||||||
start_http_server(cli_args.port)
|
start_http_server(cli_args.port, addr=cli_args.host)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(100)
|
time.sleep(100)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user