Skip to content

want both src. and source, dst. and destination metrics - #1

Open
britcey wants to merge 1 commit into
brandond:masterfrom
britcey:bugfix/dest_name
Open

want both src. and source, dst. and destination metrics#1
britcey wants to merge 1 commit into
brandond:masterfrom
britcey:bugfix/dest_name

Conversation

@britcey

@britcey britcey commented Apr 8, 2020

Copy link
Copy Markdown

I can't find it documented, but it looks like 'src.' and 'dst.' are just for internal sources and destinations.

Manually specified ones show up as 'source' and 'destination' in the stats - updating this exporter to gather those as well. Slightly hacky in that I'm sticking with just checking the first 4 characters, so 'sour' and 'dest'.

@czanik

czanik commented Jul 20, 2020

Copy link
Copy Markdown

I just tested it from your github repo and it worked as expected, I have both sources and destinations listed. I got some interesting error messages, but the resulting binary works just fine:

localhost:~/go/src/github.com/britcey/syslog_ng_exporter # make build
>> building binaries
 >   syslog_ng_exporter
can't load package: package github.com/brandond/syslog_ng_exporter: cannot find package "github.com/brandond/syslog_ng_exporter" in any of:
	/usr/lib64/go/1.11/src/github.com/brandond/syslog_ng_exporter (from $GOROOT)
	/root/go/src/github.com/brandond/syslog_ng_exporter (from $GOPATH)
!! command failed: build -o /root/go/src/github.com/britcey/syslog_ng_exporter/syslog_ng_exporter -ldflags -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.Version=0.1.1-1-ga487fc6-dirty -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.Revision=a487fc6973e3a8717712ced15510341216d7cec9 -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.Branch=master -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.BuildUser=root@localhost.localdomain -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.BuildDate=20200720-13:54:35  -extldflags '-static' -a -tags netgo github.com/brandond/syslog_ng_exporter: exit status 1
make: *** [Makefile:45: build] Error 1
localhost:~/go/src/github.com/britcey/syslog_ng_exporter # ls -l /root/go/bin/
total 39828
-rwxr-xr-x 1 root root 12233685 Jul 20 15:53 govendor
-rwxr-xr-x 1 root root 14331225 Jul 20 15:53 promu
-rwxr-xr-x 1 root root 14214609 Jul 20 15:52 syslog_ng_exporter
localhost:~/go/src/github.com/britcey/syslog_ng_exporter # cd /root/go/bin/
localhost:~/go/bin # ./syslog_ng_exporter --socket.path="/run/syslog-ng.ctl"
INFO[0000] Starting syslog_ng_exporter (version=, branch=, revision=)  source="syslog_ng_exporter.go:233"
INFO[0000] Build context (go=go1.11.13, user=, date=)    source="syslog_ng_exporter.go:234"
INFO[0000] Starting server: :9577                        source="syslog_ng_exporter.go:235"

@czanik

czanik commented Jul 20, 2020

Copy link
Copy Markdown

OK. I get a similar error message when I try to build from original sources combined with a patch from this pull request:

localhost:~/go/src/github.com/brandond/syslog_ng_exporter # make build
>> building binaries
 >   syslog_ng_exporter
vendor/github.com/prometheus/client_golang/prometheus/desc.go:22:2: cannot find package "github.com/cespare/xxhash/v2" in any of:
	/root/go/src/github.com/brandond/syslog_ng_exporter/vendor/github.com/cespare/xxhash/v2 (vendor tree)
	/usr/lib64/go/1.11/src/github.com/cespare/xxhash/v2 (from $GOROOT)
	/root/go/src/github.com/cespare/xxhash/v2 (from $GOPATH)
!! command failed: build -o /root/go/src/github.com/brandond/syslog_ng_exporter/syslog_ng_exporter -ldflags -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.Version=0.1.1-1-gd3a21c5-dirty -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.Revision=d3a21c511ed0a5b3e41314596297a66fde298c25 -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.Branch=master -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.BuildUser=root@localhost.localdomain -X github.com/brandond/syslog_ng_exporter/vendor/github.com/prometheus/common/version.BuildDate=20200720-14:36:26  -extldflags '-static' -a -tags netgo github.com/brandond/syslog_ng_exporter: exit status 1
make: *** [Makefile:45: build] Error 1

But the resulting binary works fine, and as "github.com/cespare/xxhash/v2" is referenced in a file not touched by this PR, I suspect that it's a separate problem.

@elelayan

Copy link
Copy Markdown

works fine, except I needed to upgrade syslog_ng_exporter_test.go:

	metricCountLevel1 = 20
	metricCountLevel2 = 27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants