I need to change the configuration of the Zabbix server that is in this directory C:\zabbix\conf\zabbix_agentd.win.conf
I need to replace the word: hostname=
with hostname=192.168.1.1
I did this, but the part under hostname
did not understand where to put the name to look for and where to put the word that will replace. I'm using Python 3.6
import socket
import re
hostname = socket.gethostname()
with open('C:\zabbix\conf\zabbix_agentd.win.conf') as f:
for l in f:
s = l.split('*')
editar = re.sub(r"\b%s\b" % s[0] , s[1], editor)