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

One more try at fixing zabbix_agent_persistentbuffer #1278

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roles/zabbix_agent/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
zabbix_agent_listenport: "{{ zabbix_agent_listenport is defined | ternary(zabbix_agent_listenport, zabbix_agent2_listenport) | default(10050) }}"
zabbix_agent_logfilesize: "{{ zabbix_agent_logfilesize is defined | ternary(zabbix_agent_logfilesize, zabbix_agent2_logfilesize) | default(100) }}"
zabbix_agent_logtype: "{{ zabbix_agent_logtype is defined | ternary(zabbix_agent_logtype, zabbix_agent2_logtype) | default('file') }}"
zabbix_agent_persistentbuffer: "{{ zabbix_agent_persistentbuffer is defined | ternary(zabbix_agent_persistentbuffer, zabbix_agent_persistentbuffer) | default(0) }}"
zabbix_agent_enablepersistentbuffer: "{{ zabbix_agent_enablepersistentbuffer is defined | ternary(zabbix_agent_enablepersistentbuffer, zabbix_agent_enablepersistentbuffer) | default(0) }}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the most "ansible-ism" way to do this would be to put

zabbix_agent_enablepersistentbuffer: false in defaults/main.yml and then do "{{ zabbix_agent_enablepersistentbuffer | ternary('1', '0') }}

Copy link
Collaborator Author

@pyrodie18 pyrodie18 Jun 8, 2024

Choose a reason for hiding this comment

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

Ya I get what you're saying. Right now the stupid thing keeps failing on GitHub and I can't figure out why because when I run the same exact molecule on my box it runs fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, ya, I like it, although going make the change across the board for this since there are a number of other variables that are very similar.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems the zabbix-agent fails to start, could be helpful to see the output. Maybe temporarily put the "start service" in a block, something like

- block:
    - service:
        name: zabbix-agent
  rescue:
    - slurp:
        path: /var/log/zabbix/zabbix_agent.log
      register: _res
    - debug:
          var: _res.content | b64decode
    - fail:

Just to see what zabbix-agent service is complaining on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you. I was trying to figure out a way to get that.

zabbix_agent_persistentbufferperiod: "{{ zabbix_agent_persistentbufferperiod is defined | ternary(zabbix_agent_persistentbufferperiod, zabbix_agent2_persistentbufferperiod) | default('1h') }}"
zabbix_agent_refreshactivechecks: "{{ zabbix_agent_refreshactivechecks is defined | ternary(zabbix_agent_refreshactivechecks, zabbix_agent2_refreshactivechecks) | default(120) }}"
zabbix_agent_statusport: "{{ zabbix_agent_statusport is defined | ternary(zabbix_agent_statusport, zabbix_agent2_statusport) | default(9999) }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/zabbix_agent/templates/agent.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ DenyKey={{ item }}
{% else %}
# DenyKey=
{% endif %}
{{ (zabbix_agent_enablepersistentbuffer is defined and zabbix_agent_enablepersistentbuffer is not none) | ternary('', '# ') }}EnablePersistentBuffer={{ zabbix_agent_enablepersistentbuffer | default('') }}
{% if not zabbix_agent2 %}
{{ (zabbix_agent_enableremotecommands is defined and zabbix_agent_enableremotecommands is not none) | ternary('', '# ') }}EnableRemoteCommands={{ zabbix_agent_enableremotecommands | default('') }}
{{ (zabbix_agent_enablepersistentbuffer is defined and zabbix_agent_enablepersistentbuffer is not none) | ternary('', '# ') }}EnablePersistentBuffer={{ zabbix_agent_enablepersistentbuffer | default('') }}
{% endif %}
{{ (zabbix_agent_enableremotecommands is defined and zabbix_agent_enableremotecommands is not none) | ternary('', '# ') }}EnableRemoteCommands={{ zabbix_agent_enableremotecommands | default('') }}
{% if zabbix_agent2 %}
{{ (zabbix_agent_forceactivechecksonstart is defined and zabbix_agent_forceactivechecksonstart is not none) | ternary('', '# ') }}ForceActiveChecksOnStart={{ zabbix_agent_forceactivechecksonstart | default('') }}
{% endif %}
Expand Down
Loading