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

T5152: Get default hostname for telegraf from FQDN or hostname #1954

Merged
merged 1 commit into from
Apr 13, 2023

Conversation

sever-sever
Copy link
Member

Change Summary

Fix for Telegraf agent hostname isn't qualified.
Try to get the hostname from FQDN and then from the hostname Used for metrics
You may have more than one machine with different domain names
r1 domain-name foo.local, hostname myhost
r2 domain-name bar.local, hostname myhost

It helps to detect from which exactly host we get metrics for InfluxDB2.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

telegraf

Proposed changes

How to test

VyOS configuration:

set service monitoring telegraf prometheus-client
set system domain-name 'foo.local'
set system host-name 'r1'

telegraf config:

vyos@r1# cat /run/telegraf/vyos-telegraf.conf | grep host
  hostname = "r1.foo.local"
  omit_hostname = false
[edit]
vyos@r1# 

check metrics, expected host r1.foo.local

vyos@r1# curl localhost:9273/metrics | grep ntp

internal_gather_gather_time_ns{host="r1.foo.local",input="ntpq",version="1.23.1"} 3.48097686e+08
internal_gather_metrics_gathered{host="r1.foo.local",input="ntpq",version="1.23.1"} 72
ntpq_delay{host="r1.foo.local",refid="104.156.229.103",remote="ec2-34-206-168-",state_prefix="+",stratum="3",type="u"} 126.985
ntpq_delay{host="r1.foo.local",refid="128.199.243.248",remote="ec2-122-248-201",state_prefix="+",stratum="3",type="u"} 199.314
ntpq_delay{host="r1.foo.local",refid="131.188.3.221",remote="ec2-18-193-41-1",state_prefix="*",stratum="2",type="u"} 41.884

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Fix for Telegraf agent hostname isn't qualified
Try to get the hostname from FQDN and then from the hostname
Used for metrics
You may have more than one machine with different domain names
r1 domain-name foo.local, hostname myhost
r2 domain-name bar.local, hostname myhost

It helps to detect from which exactly host we get metrics for
InfluxDB2
@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro and c-po and removed request for a team April 12, 2023 08:46
@c-po c-po merged commit 94a6fb7 into vyos:equuleus Apr 13, 2023
@sever-sever sever-sever deleted the T5152-eq branch May 10, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants