forked from paleg/bareos_zabbix_integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
executable file
·24 lines (20 loc) · 815 Bytes
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from socket import gethostname
from ConfigParser import ConfigParser
from StringIO import StringIO
server_type = "bacula"
conf = {
'type' : server_type,
'log_dir': "/var/log/{0}/".format(server_type),
'zabbix_agent_conf': "/etc/zabbix/zabbix_agentd.conf",
'bconsole_conf_file': "/etc/{0}/bconsole.conf".format(server_type),
'bconsole_wait': 5,
'email_from': "{0} <{1}@localhost>".format(server_type, server_type.title()),
'email_server': "127.0.0.1"
}
zcfg = ConfigParser()
with open(conf['zabbix_agent_conf']) as stream:
fakefile = StringIO("[global]\n" + stream.read())
zcfg.readfp(fakefile)
zserver = zcfg.get('global', 'server').split(',')[0]
conf['hostname'] = gethostname()
conf['zabbix_server'] = zserver