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

Custom Listen Port #417

Closed
davidlesicnik opened this issue May 23, 2019 · 4 comments
Closed

Custom Listen Port #417

davidlesicnik opened this issue May 23, 2019 · 4 comments

Comments

@davidlesicnik
Copy link

davidlesicnik commented May 23, 2019

Host operating system: output of uname -a

Linux monitor 3.10.0-957.12.1.el7.x86_64 #1 SMP Mon Apr 29 14:59:59 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

snmp_exporter version: output of snmp_exporter -version

snmp_exporter, version 0.15.0 (branch: HEAD, revision: 92a3da4)
build user: root@8c3a7c03d455
build date: 20190212-13:40:02
go version: go1.11.5

What did you do that produced an error?

Added --web.listen-address=":9990" to run snmp_exporter on port 9990 (I already have something running on 9116)

What did you expect to see?

I expected to see the snmp_exporter web page to work when going to [ip]:9990

What did you see instead?

systemd service crashes with journalctl spitting out
level=fatal msg="listen tcp: address tcp/9990": unknown port" source="main.go:227"

@SuperQ
Copy link
Member

SuperQ commented May 23, 2019

I'm not able to reproduce this. Can you share your whole unit file?

$ ./snmp_exporter --web.listen-address=":9990"
INFO[0000] Starting snmp exporter (version=0.15.0, branch=HEAD, revision=92a3da4467f8bc6759cf197e7442b8c43e890b13)  source="main.go:139"
INFO[0000] Build context (go=go1.11.5, user=root@8c3a7c03d455, date=20190212-13:40:02)  source="main.go:140"
INFO[0000] Listening on :9990                            source="main.go:226"

@davidlesicnik
Copy link
Author

davidlesicnik commented May 23, 2019

snmp_exporter.service:

[Unit]
Description=SNMP Exporter
After=network.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/snmp_exporter --config.file=/monitor/snmp_exporter/snmp.yml --web.listen-address=":9990"

[Install]
WantedBy=multi-user.target

Setup is night identical to another one I have (I recreated my whole prometheus setup recently), except for the --web.listen-address.
And if I remove --web.listen-address from the unit file (to keep the default 9116 port) it works fine.

EDIT:
So if I run the ExecStart command regularly through the shell it runs just fine on port 9990. However if I run it through systemd as a service it spits out adreess tcp/9990": unknown port.

Also tested by marking the service to run as root, just in case that was the issue, but it still spits out unknown port.

@wtibbitts
Copy link

wtibbitts commented May 30, 2019

I had this same issue on the node_exporter, but all I needed to do was drop the quotation marks, i.e.
/usr/local/bin/snmp_exporter --config.file=/monitor/snmp_exporter/snmp.yml --web.listen-address=:9990

@SuperQ
Copy link
Member

SuperQ commented May 31, 2019

Weird, seems like a systemd parsing issue. Thanks for reporting a fix.

@SuperQ SuperQ closed this as completed May 31, 2019
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

No branches or pull requests

3 participants