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

Add Support for Zabbix Agent 2 #692

Closed
aredoff opened this issue Jun 3, 2020 · 17 comments · Fixed by #929
Closed

Add Support for Zabbix Agent 2 #692

aredoff opened this issue Jun 3, 2020 · 17 comments · Fixed by #929

Comments

@aredoff
Copy link

aredoff commented Jun 3, 2020

The current version of this module does not support Zabbix Agent 2.
Agent 2 has much more functionality and we would like to switch to it.
Please add new agent support to your wonderful module.

@jameskirsop
Copy link
Contributor

I've got a branch with limited agent2 support here: https://github.com/jameskirsop/puppet-zabbix/tree/agent2

It needs some polishing before a PR can be created. Basically, switching out the zabbix_package_agent parameter from zabbix_agent to zabbix_agent2 will do a couple of things:

  • Change the systemd init script to use the new binary name
  • Use a new template for the agent2 config

To standardise a little bit, I've changed the config and pid file names from zabbbix_agentd (old version specific) to zabbix_agent so that they'll appear correct regardless of the agent version that's being run on the system. This means the module should be easier to support in the future (less if statement blocks to determine version).

I'll need to put some more time in to complete the changes so that it's got more coverage, but if you're on a system that uses systemd this may work for you.

PR's to my branch are welcome while I continue chipping away.

@jameskirsop
Copy link
Contributor

I've put work on this on hold until we get #743 done, so that at least I can test a working master release with my branch on top of it in my puppet environments.

@Heidistein
Copy link
Contributor

@jameskirsop I'd like to test your changes, provide feedback and pullrequests (if needed) but could you please update your repo to the latest from master?

@shane-davidson
Copy link

@Heidistein would it be more beneficial to just switch the manifest to install agent2 rather than increasing complexity to support both?

I have the following code working for redhat/centos
https://github.com/shane-davidson/puppet-zabbix/tree/agent2

I have updated the debian/ubuntu service but have not tested it.
my code will remove the old package (zabbix-agent) and install the new (zabbix-agent2)

only thing missing is plugin settings for the new agent which i can easily add.

@shane-davidson
Copy link

Updating everything to zabbix-agent2 would also depend on a choco package so I have placed a request for the Zabbix guys to update the choco package to support zabbix-agent2 here: zabbix/zabbix-agent-chocolatey#27

@Heidistein
Copy link
Contributor

I certainly would be easyer and cleaner to just support agent2. However I dare not to choose the agent version for people (just yet). Guaranteed there will be a situation where agent2 is a problem, and agent itself is required. For example, hand in my own pocket, we still have ancient machines, used for the battles of Napoleon, for which there is no agent2 available (nor will there ever).

@shane-davidson
Copy link

@Heidistein no worries. I have created a new branch here: https://github.com/shane-davidson/puppet-zabbix/tree/agent_agent2

It keeps all the same variables between agent and agent2 versions and switches between them with the bool $install_agent2 here

considerations:

  • Currently install_agent2 defaults to true. not sure if this is the desired choice? will require testing for different OS
  • New plugin settings for agent2 have not had variables/params added to the agent class
  • agent2 install will not work for windows yet
  • service templates for aix, debian, redhat probably need updating
  • Currently automatically removes old package if $intall_agent2 == true. I assume this is desired?
  • If downgrading support is required I can add the logic to remove the new package if $intall_agent2 == false

I have tested this in a centos/redhat environment. Let me know if there is anything you want me to add/fix up.

@Heidistein
Copy link
Contributor

Share, great work. I will read your code after the weekend, sorry. Life happens.

  1. Install agent 2 by default is probably okay. As agent2 is backward compatible with userparams.
  2. It would be great to have them added. I'll spend some time on this.
  3. I am not quite sure what is 'windows' thing is you speak of... ;-). srsly, perhaps via the params default to old engine there.
  4. I can look into redhat and debian (and ubuntu).
  5. Removing the package is desired, however should be toggleable. I seriously have one usecase where both agents are required.
  6. I think the remove agent2 package is required. People using the module will expect it, not because downgrading is required for me, but just because people are, you know, people :)

Again, next week I will help you. I will make testcases and code for debian, allthough redhat is my street.

@jameskirsop
Copy link
Contributor

jameskirsop commented Jan 18, 2022

@Heidistein, I've just merged the latest changes from master onto my branch for you to test / PR against.

Some things I still need to work on / need guidance for /help with:

  • Best way of cleaning up the startup and config files if someone switches from v1 to v2 or back the other way AND making it optional.
  • Testing on non-CentOS/systemd systems
  • Updating the module documentation

I also suggest we pull out the plugins section from the module's configuration template and allow users to load in their own plugins configuration as required by using the Include config parameter - and perhaps pre-creating a directory in the configuration root to contain these files as a helper.

@vincent-zurczak
Copy link

Hello @jameskirsop.
I have no relation with @Heidistein, but I am glad you completed the support of Agent2 on your fork. Thank you for this work! We have been testing it since last week and so far, there are only two glitches we found on Windows:

  • First, the service name on Windows should be Zabbix Agent 2 and not Zabbix Agent2 (to be compliant with what the *.msi installer configures).
  • Second, the control socket in the agent2 configuration is hard-coded with a Unix path. We have removed it from the template in our tests and it works. This parameter should be templated to only be added on Linux systems.

BTW, we had to create our own Chocolatey package, but that's another topic.
We plan starting some tests soon on Linux systems.

@jameskirsop
Copy link
Contributor

Thanks @vincent-zurczak, I've added a commit to address those two issues for Windows.

@kristiantaylor
Copy link

hey I am interested in this and wondering if we are close to a choco package with zabbix agent 2

@sahaqaa
Copy link

sahaqaa commented Aug 4, 2022

Hello, I am interested in this and wondering if this will be implemented? At least for Unix like OS's :-)

@anders-larsson
Copy link

Hi, I'm also interested in support for zabbix-agent2.

@amalraj2711
Copy link

Any ETA for this update?

@jpfir
Copy link

jpfir commented Feb 2, 2023

Is there any update on this?

@SmartSceptic
Copy link

I'm very interested in switching to this module but only when you add 2nd agent support
Any ETA for this update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment