Ad Widget

Collapse

Zabbix Agent2 loadable plugin performance issue on Windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • david.assigbi
    Junior Member
    • Nov 2022
    • 2

    #1

    Zabbix Agent2 loadable plugin performance issue on Windows

    Hello here,
    For my work purposes, I have to build a plugin for zabbix Agent2 that has to on Windows systems. For simplicity purposes I chose to go with a loadable plugin but more on that later.

    I followed the guide at @ https://www.zabbix.com/documentation...adable_plugins to build the example `myip` plugin on my Windows laptop and after linking it through an additionnal config file in the `C:\Program Files\Zabbix Agent 2\zabbix_agent2.d\plugins.d` directory, it works.
    It works meaning that I can query the new item both with:
    Code:
    > zabbix_get -s localhost -k myip
    > zabbix_agent -c zabbi_agent2.conf -t myip.
    The only issue is the zabbix_agent2 process CPU usage sky rocks when I linked my loadable plugin, and restarted the agent.
    I am talking about a usage of about 17-20% on my 8cores/1.99Ghz i7 laptop. That is just insane.
    If I unlink the agent2 and the loadable plugin, the agent cpu usage comes back to normal (less than 1%).

    After looking at the agent log file (zabbi_agent2.log), it is full of lines like
    Code:
    2022/11/10 09:22:16.817154 failed to read response for plugin Myip, failed to read type header, The handle is invalid.
    When I run `zabbix_agent -v -c zabbi_agent2.conf -t myip` with the `-v (verbose)` option, I see the same error in the output multiple times before the actual value of the metric.


    I suspect the high CPU usage is caused by this error happening and being logged too frequently.

    After having read the source code of the plugin-support at https://git.zabbix.com/projects/AP/r.../connection.go (line 42), I recognized the line of code creating the error.

    I just don't know how to fix the issue at all and it is kind of useless right.

    As there are builtin plugins for the agent2 too, it tried to recompile the agent2 on windows but was getting an even worse error while i have not even added my plugin yet.
    I acutually wrote a post on that as well here (@ https://www.zabbix.com/forum/zabbix-...n-from-sources)

    I build the same plugin for the agent2 on linux both as a loadable and builtin plugin and it is working flawlessly so i think it really is a windows issue.

    Resources:
    Go: dl.google.com/go/go1.19.3.windows-amd64.msi
    Zabbix Agent2: https://cdn.zabbix.com/zabbix/binari...64-openssl.msi
Working...