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 #1950

Merged
merged 1 commit into from Apr 11, 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 the metric 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

monitoring, telegraf

Proposed changes

How to test

VyOS configuration:

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

telegraf config:

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

check metrics, expected host r14.foo.local

vyos@r14# curl localhost:9273/metrics | grep chrony_frequency
# TYPE chrony_frequency untyped
chrony_frequency{host="r14.foo.local",leap_status="normal",reference_id="B9F4C39F",stratum="3"} -16.052

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 hostname from FQDN and then from 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 exectly host we get metric for
InfluxDB2
@vyosbot vyosbot requested a review from a team April 11, 2023 09:12
@c-po c-po merged commit 14582ac into vyos:current Apr 11, 2023
6 of 7 checks passed
@sever-sever sever-sever deleted the T5152 branch May 10, 2023 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants