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 from oslo_serialization import jsonutils
16 logger = logging.getLogger(__name__)
17 ip_address = socket.gethostbyname(socket.gethostname())
19 for line in fileinput.input(inplace=1):
20 ip = " Server \"" + str(ip_address) +"\" \"25826\""
21 line = re.sub(r'.*Server.*25826.*', r''+str(ip), line.rstrip())
24 for line in fileinput.input(inplace=1):
25 ip = " URL \"http://"+str(ip_address)+":9103/collectd-post\""
26 line = re.sub(r'.*URL.*collectd-post.*', r''+str(ip), line.rstrip())