1 ##############################################################################
2 # Copyright (c) 2018 Huawei Tech and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
14 logger = logging.getLogger(__name__)
15 ip_address = socket.gethostbyname(socket.gethostname())
17 for line in fileinput.input(inplace=1):
18 ip = " Server \"" + str(ip_address) + "\" \"25826\""
19 line = re.sub(r'.*Server.*25826.*', r'' + str(ip), line.rstrip())
22 for line in fileinput.input(inplace=1):
23 ip = " URL \"http://" + str(ip_address) + ":9103/collectd-post\""
24 line = re.sub(r'.*URL.*collectd-post.*', r'' + str(ip), line.rstrip())