Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zabbix Server/Proxy/Agent init.sls doesn't honor any pillar values at all. #126

Open
xenadmin opened this issue Oct 9, 2019 · 1 comment

Comments

@xenadmin
Copy link
Contributor

xenadmin commented Oct 9, 2019

While testing my proposed changes for #125 in possibly encountered a critical bug.

Steps to reproduce
Create a pillar for Zabbx Proxy /srv/pillar/zabbix/proxy.sls and write a value for pidfile, logfile, or dbname:

zabbix-proxy:
  pidfile: /tmp/zabbix_proxy.pid

Watch the resultant Pillar values on the minion salt 'zabprox.*' pillar.items they change accordingly:

    zabbix-proxy:
        ----------
        pidfile:
            /tmp/zabbix_proxy.pid

Make a state apply test salt 'zabprox.*' state.apply test=true and watch that the states do not change at all!

  Name: /var/lib/zabbix - Function: file.directory - Result: Clean Started: - 07:28:57.013935 Duration: 0.541 ms

Expected behavior
/srv/formulas/zabbix-formula/zabbix/proxy/init.sls has to read in the pillar not only from /srv/formulas/zabbix-formula/zabbix/map.jinja but also from /srv/pillar/zabbix/proxy.sls and change the file.directory states accordingly.

Partly resoltution
I believe this bug was introduced by @hatifnatt in commit 2907cda and @aboe76 in commit cdf5b80 for example.

I build an example solution that works very well for me and solves also #125 but I don't believe it's the right solution as it seems much too complicated:
/srv/formulas/zabbix-formula/zabbix/proxy/init.sls

{% set logfile = salt['pillar.get']('zabbix-proxy:logfile', zabbix.proxy.logfile) %}
{% set pidfile = salt['pillar.get']('zabbix-proxy:pidfile', zabbix.proxy.pidfile) %}
{% set sqlitedir = salt['pillar.get']('zabbix-proxy:dbname', zabbix.proxy.dname) %}

https://gist.github.com/xenadmin/2c951695d215ab9e59f31184642f6c6c/revisions#diff-39859e34161f0cb6f5f50974282a2593

It can't be the solution, to have a line in the header for each and every folder I have to read in from the pillar, including a fallback to the map.jinja, can it?

I would like to ask for your help so we can solve this together!

@hatifnatt
Copy link
Collaborator

hatifnatt commented Oct 9, 2019

If I remember correctly (and according to the example in pillar.example) to override values from map.jinja in state (not in generated config file) you need to set values under zabbix:lookup:proxy i.e.

zabbix:
  lookup:
    proxy:
      pidfile: /tmp/zabbix_proxy.pid

Actually this formula is really clunky and it's require total rewrite mostly from scratch. I point some problems in #79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants