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 proxy sqlitedir - Need help #115

Merged
merged 7 commits into from
Sep 30, 2019

Conversation

xenadmin
Copy link
Contributor

As many people use SQLite for Zabbix proxy, I think it's obvious that the definition of a SQLite in the pillar database has to create the directory. I handled that in a separate state until now, but I find it odd that the official formula has to fail inevitable, because the Zabbix proxy daemon will never launch, because the directory is missing.
But this pull request has a big drawback I think. I someone would like to use a real MySQL or MariaDB, this shouldn't be executed.
I need some kind of IF statement, that will check if dbname contains a word or a path. I wasn't able to fix that yet. If we solve that, this will be a very helpful addition, as the formula will fail otherwise for all SQLite users.

@xenadmin
Copy link
Contributor Author

Ok so I tested that by defining something not the default for dbname, but my code will still create the folder:
Name: /var/lib/zabbix - Function: file.directory - Result: Clean
But during the same run, will alter the zabbix_proxy.conf:

          ID: /etc/zabbix/zabbix_proxy.conf
    Function: file.managed
      Result: None
     Comment: The file /etc/zabbix/zabbix_proxy.conf is set to be changed
     Started: 21:48:28.513802
    Duration: 305.976 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -180,7 +180,7 @@
                   # Mandatory: yes
                   # Default:
                   # DBName=
                  -DBName=/var/lib/zabbix/zabbix.sqlite.db
                  +DBName=/var/lib/dummy

Copy link
Collaborator

@hatifnatt hatifnatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xenadmin yeah it looks like /var/lib/zabbix is not created during zabbix-proxy package installation. I added a simple check for dbname param, if it starts with a / it's most probably a file path, and not a MySQL DB name.

Note I have not tested suggested changes, but I hope everything is correct :)

zabbix/proxy/init.sls Show resolved Hide resolved
zabbix/proxy/init.sls Outdated Show resolved Hide resolved
zabbix/proxy/init.sls Outdated Show resolved Hide resolved
@xenadmin
Copy link
Contributor Author

Thank you so much for your help! I love it that this formula gets some love. By now I’m so good with salt, that I manage 33 Zabbix Proxies with it, using 51 states. (If I remember correctly)

Currently I’m on vacation, sorry. Can’t review anything right now. Maybe we can talk in about 10 days?

startswith('/')

Co-Authored-By: Roman <[email protected]>
@xenadmin
Copy link
Contributor Author

I reviewed your changes @hatifnatt looks good.

@aboe76 aboe76 merged commit ed31d76 into saltstack-formulas:master Sep 30, 2019
@xenadmin xenadmin deleted the zabbix-proxy-sqlitedir branch October 1, 2019 09:33
aboe76 added a commit that referenced this pull request Oct 1, 2019
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

Successfully merging this pull request may close these issues.

3 participants