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

help needed to build the code #4958

Closed
ramprasadgk opened this issue Nov 5, 2018 · 8 comments
Closed

help needed to build the code #4958

ramprasadgk opened this issue Nov 5, 2018 · 8 comments
Labels
discussion Topics for discussion

Comments

@ramprasadgk
Copy link

Relevant telegraf.conf:

System info:

[Include Telegraf version, operating system name, and other relevant details]

Steps to reproduce:

  1. ...
  2. ...

Expected behavior:

Actual behavior:

Additional info:

[Include gist of relevant config, logs, etc.]

happen to download latest telegraf code, installed go, now how do i build the code and test it? i need to make customized changes to some of the plugins and use it

thanks for the help
cheers

@prydin
Copy link
Contributor

prydin commented Nov 5, 2018

Hi! Below is the "building from source section" from the readme file. Let me know if you have any specific questions. You need to have the dep tool installed. What platform are you on?

Telegraf requires golang version 1.9 or newer, the Makefile requires GNU make.

  1. Install Go >=1.9 (1.10 recommended)
  2. Install dep ==v0.5.0
  3. Download Telegraf source:
    go get -d github.com/influxdata/telegraf
    
  4. Run make from the source directory
    cd "$HOME/go/src/github.com/influxdata/telegraf"
    make
    

@ramprasadgk
Copy link
Author

thanks for the reply, i am on rhel7

@ramprasadgk
Copy link
Author

hi,

unable to find right install for my linux version can you help

Linux 3.8.13-118.24.2.el6uek.x86_64 #2 SMP Wed Sep 12 16:58:43 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux

@ramprasadgk
Copy link
Author

*unable to find right dep install

@prydin
Copy link
Contributor

prydin commented Nov 5, 2018

Here's what it looks like setting it up on a clean Linux machine with only go and git installed:

Create a Go environment

pontus@pontus-telegraf-01:~$ mkdir -p ~/go/src/github.com/influxdata
pontus@pontus-telegraf-01:~$ mkdir ~/go/bin
pontus@pontus-telegraf-01:~$ export GOPATH=~/go/src/github.com/influxdata
pontus@pontus-telegraf-01:~$ cd ~/go/src/github.com/influxdata

Get latest source from git

pontus@pontus-telegraf-01:~/go/src/github.com/influxdata$ git clone https://github.com/influxdata/telegraf.git
Cloning into 'telegraf'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 31080 (delta 2), reused 2 (delta 2), pack-reused 31076
Receiving objects: 100% (31080/31080), 20.27 MiB | 18.89 MiB/s, done.
Resolving deltas: 100% (17054/17054), done.

Install dep

pontus@pontus-telegraf-01:~/go/src/github.com/influxdata/telegraf$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5110  100  5110    0     0  21291      0 --:--:-- --:--:-- --:--:-- 21291
ARCH = amd64
OS = linux
Will install into /home/pontus/go/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.5.0
Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64..
Setting executable permissions.
Moving executable to /home/pontus/go/bin/dep

Build the code

pontus@pontus-telegraf-01:~/go/src/github.com/influxdata/telegraf$ make
dep ensure -vendor-only
go build -ldflags " -X main.commit=19a338b9 -X main.branch=master" ./cmd/telegraf

Run it!

pontus@pontus-telegraf-01:~/go/src/github.com/influxdata/telegraf$ ./telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
2018-11-05T15:09:23Z I! Starting Telegraf 
2018-11-05T15:09:23Z I! Loaded inputs: inputs.cpu inputs.disk inputs.kernel inputs.mem inputs.processes inputs.swap inputs.system inputs.net inputs.vsphere inputs.vsphere inputs.vsphere inputs.vsphere inputs.internal
2018-11-05T15:09:23Z I! Loaded aggregators: 
2018-11-05T15:09:23Z I! Loaded processors: 
2018-11-05T15:09:23Z I! Loaded outputs: wavefront
2018-11-05T15:09:23Z I! Tags enabled: host=pontus-telegraf-0

@ramprasadgk
Copy link
Author

looks like office VPN has blocked access to git,will try it on another machine and revert, thanks for all the help.

is there any way i can install without directly connecting form github, i can copy code to the host but cannot directly connect to github

@prydin
Copy link
Contributor

prydin commented Nov 5, 2018

You could always run the procedure I just described on a machine outside the network, zip up the entire go directory and move it to the machine that can't access github.

@glinton
Copy link
Contributor

glinton commented Nov 5, 2018

thanks @prydin. closing as a full explanation has been provided and it is now only a network issue.

@glinton glinton closed this as completed Nov 5, 2018
@glinton glinton added the discussion Topics for discussion label Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Topics for discussion
Projects
None yet
Development

No branches or pull requests

3 participants