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

Feature: [vmagent] added push data with zabbix connector #6087

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

SinotQ
Copy link

@SinotQ SinotQ commented Apr 10, 2024

Description

Support receiving data from the Zabbix connector. (vmagent)

Added

  • New path /zabbixconnector/api/v1/history
  • New command-line flag:
    • -zabbixconnector.maxLineLen (similar to the -import.maxLineLen flag)
    • -zabbixconnector.addGroups (Enable adding Zabbix host groups to labels (group_name="1"))
    • -zabbixconnector.addEmptyTags (Enable adding Zabbix tags without values to labels (tag_name="1"))

Note

  • Labels:
    • The metric name is added to the __name__ label.
    • Host name to host label.
    • Visible name to hostname label.
  • The returned response complies with the requirements of the Zabbix Connector protocol.
  • Support sending item numeric values only.

Otherwise, I tried to adhere to the functionality of /api/v1/import

Useful links:

Sinotov Vladimir and others added 2 commits April 10, 2024 14:20
@SinotQ SinotQ changed the title feat: [zabbix connector] added push data with zabbix connector from vmagent Feature: [vmagent] added push data with zabbix connector Apr 10, 2024
Copy link
Contributor

@zekker6 zekker6 left a comment

Choose a reason for hiding this comment

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

Hello @SinotQ, thank you for the PR!

Please, see a few comments/questions.
Disclaimer: I'm not very familiar with Zabbix, so there are mostly questions about logic in parser which might be specific to Zabbix.

Also, it would be great if you could update documentation to include an instruction on how to use this integration with Zabbix. This is not mandatory, but will be much appreciated.
See this part of documentation for an example - https://docs.victoriametrics.com/single-server-victoriametrics/#how-to-send-data-from-newrelic-agent

app/vmagent/main.go Outdated Show resolved Hide resolved
app/vmagent/main.go Outdated Show resolved Hide resolved
lib/protoparser/zabbixconnector/parser.go Outdated Show resolved Hide resolved
lib/protoparser/zabbixconnector/parser.go Outdated Show resolved Hide resolved
tag = r.addTag()
tag.Key = append(tag.Key[:0], k...)
if len(v) == 0 {
tag.Value = append(tag.Value[:0], EMPTYVALUE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you share a use-case when empty labels must be kept?

Copy link
Author

Choose a reason for hiding this comment

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

Zabbix allows tags without values. Various filtering rules and conditions in Zabbix also support tags without values. Perhaps someone might use this feature and want to see similar tags as labels in VicotriaMetrics.

I missed something when implementing Zabbix Connector support. Zabbix supports the same tag names with different values for the same element. For example:

service
service: mysql 
service: critical

How could this be implemented in VicotriaMetrics? (service: empty,mysql,critical)

https://www.zabbix.com/documentation/current/en/manual/config/tagging
https://www.zabbix.com/documentation/current/en/manual/config/notifications/action/conditions

Copy link
Contributor

Choose a reason for hiding this comment

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

For such tags I would suggest creating separate labels:

tag_service_mysql: "present"
tag_service_critical: "present"

# or 

# this is similar to how k8s discovery handles such cases
tag_present_service_mysql: "true"
tag_present_service_critical: "true"

lib/protoparser/zabbixconnector/parser.go Show resolved Hide resolved
lib/protoparser/zabbixconnector/parser.go Outdated Show resolved Hide resolved
SinotQ and others added 4 commits May 28, 2024 17:05
Co-authored-by: Zakhar Bessarab <me@zekker-dev.tk>
Co-authored-by: Zakhar Bessarab <me@zekker-dev.tk>
Signed-off-by: Sinotov Vladimir <vladimir@sinot.xyz>
Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 47.77070% with 164 lines in your changes are missing coverage. Please review.

Project coverage is 58.20%. Comparing base (8aaa828) to head (17b1f26).
Report is 755 commits behind head on master.

Files Patch % Lines
...protoparser/zabbixconnector/stream/streamparesr.go 0.00% 96 Missing ⚠️
app/vmagent/zabbixconnector/request_handler.go 0.00% 44 Missing ⚠️
app/vmagent/main.go 0.00% 20 Missing ⚠️
lib/protoparser/zabbixconnector/parser.go 97.40% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6087      +/-   ##
==========================================
- Coverage   60.37%   58.20%   -2.18%     
==========================================
  Files         411      612     +201     
  Lines       76609    83144    +6535     
==========================================
+ Hits        46253    48393    +2140     
- Misses      27794    31530    +3736     
- Partials     2562     3221     +659     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

None yet

3 participants