i-ky / effluence

Zabbix loadable module for real-time export of history to InfluxDB
MIT License
32 stars 9 forks source link

Update README.md #8

Closed danielkucera closed 5 years ago

danielkucera commented 5 years ago

instruction how to set envvar on Ubuntu

i-ky commented 5 years ago

Thank you for the suggestion! I'm not very experienced in Linux administration and I'm used to running Zabbix manually, not via systemd...

So I had to do a bit of research and there seems to be one more option to set environment variable for a service, namely

$ sudo systemctl edit zabbix-server

and typing there something like

[Service]
Environment='EFFLU_CONFIG=/path/to/effluence.conf'

What's your opinion on that?

danielkucera commented 5 years ago

Hi @i-ky , it depends on how the zabbix is installed. Mine is from zabbix apt repo:

cat /etc/apt/sources.list.d/zabbix.list
deb http://repo.zabbix.com/zabbix/4.0/ubuntu bionic main
deb-src http://repo.zabbix.com/zabbix/4.0/ubuntu bionic main

and it doesn't use systemd config file but an init.d script which loads env vars from /etc/default/zabbix-server. I cannot say how zabbix is distributed on another systems...

danielkucera commented 5 years ago

But now I tried your solution and surprisingly it also works.

danielkucera commented 5 years ago

Ah, I was probably wrong... my system seems to be using systemd service config in fact:

# cat /lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_server.conf"
EnvironmentFile=-/etc/default/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=infinity

[Install]
WantedBy=multi-user.target
i-ky commented 5 years ago

Thank you, @danielkucera, for the information! I need a bit more time to dig in, I want to check how things are on CentOS. There is even a chance that I will be able to completely automate these steps with make install.

i-ky commented 5 years ago

So sorry for a delay...

@danielkucera, please have a look at 2b7f36546cd8dbda98f19e084132e006c10c0d69. Is it OK now? @Rikbiz, I will be glad to hear from you too.

danielkucera commented 5 years ago

@i-ky it looks good to me

i-ky commented 5 years ago

Thank you, @danielkucera! Really appreciate your help.

I'm closing this PR then. Looking forward to more contributions and feedback from you!