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

Running nginx-vts-exporter and got error: #32

Closed
smallfish01 opened this issue Sep 5, 2017 · 11 comments
Closed

Running nginx-vts-exporter and got error: #32

smallfish01 opened this issue Sep 5, 2017 · 11 comments

Comments

@smallfish01
Copy link

./nginx-vts-exporter &

[1] 14394
[root@office-monitoring nginx-vts-exporter-0.6.linux-amd64]# 2017/09/05 08:58:48 Starting nginx_vts_exporter (version=0.6, branch=HEAD, revision=e48bd6899d8864b11b9f71f852b049ec3ad2ae26)
2017/09/05 08:58:48 Build context (go=go1.8.3, user=root@3b0fc1d0acb6, date=20170808-07:09:08)
2017/09/05 08:58:48 Starting Server at : :9913
2017/09/05 08:58:48 Metrics endpoint: /metrics
2017/09/05 08:58:48 Metrics namespace: nginx
2017/09/05 08:58:48 Scraping information from : http://localhost/status
2017/09/05 08:58:51 json.Unmarshal failed invalid character '<' looking for beginning of value
2017/09/05 08:59:06 json.Unmarshal failed invalid character '<' looking for beginning of value
2017/09/05 08:59:21 json.Unmarshal failed invalid character '<' looking for beginning of value
2017/09/05 08:59:36 json.Unmarshal failed invalid character '<' looking for beginning of value
2017/09/05 08:59:51 json.Unmarshal failed invalid character '<' looking for beginning of value
2017/09/05 09:00:06 json.Unmarshal failed invalid character '<' looking for beginning of value
2017/09/05 09:00:21 json.Unmarshal failed invalid character '<' looking for beginning of value
2017/09/05 09:00:36 json.Unmarshal failed invalid character '<' looking for beginning of value

Do you konw how to resolving the issue as above?

Thank you!

@sysulq
Copy link
Owner

sysulq commented Sep 5, 2017

You should make sure http://localhost/status is the url where vts-module exposes its metrics.

I think this is the point you should take into account.

@smallfish01
Copy link
Author

Yes, I can access http://localhost/status from my browser.

@sysulq
Copy link
Owner

sysulq commented Sep 5, 2017

And this url should return json format metrics instead of html content.

@smallfish01
Copy link
Author

Hi hnlq715,
Thanks for your help, I tried change nginx.conf and change the code "vhost_traffic_status_display_format html;" to "vhost_traffic_status_display_format json;" and now it's ok:
./nginx-vts-exporter &
[1] 4941

2017/09/08 08:31:56 Starting nginx_vts_exporter (version=0.6, branch=HEAD, revision=e48bd6899d8864b11b9f71f852b049ec3ad2ae26)

2017/09/08 08:31:56 Build context (go=go1.8.3, user=root@3b0fc1d0acb6, date=20170808-07:09:08)
2017/09/08 08:31:56 Starting Server at : :9913
2017/09/08 08:31:56 Metrics endpoint: /metrics
2017/09/08 08:31:56 Metrics namespace: nginx
2017/09/08 08:31:56 Scraping information from : http://localhost/status

But I have another questions, "nginx-vts-exporter" process will terminated automatically about in a day, do you konw how can I setup log and to find the root cause?

@sysulq
Copy link
Owner

sysulq commented Sep 8, 2017

Nice to hear that 😃
The log of nginx-vts-exporter would direcetly print into stdout, and you can use nohup ./nginx-vts-exporter & to capture log into nohup.out file.

@smallfish01
Copy link
Author

I created log file for nginx-vts-exporter, but when the process terminated, no any other information:

tailf /var/log/nginx-vts-exporter.log

2017/09/11 14:58:39 Starting nginx_vts_exporter (version=0.6, branch=HEAD, revision=e48bd6899d8864b11b9f71f852b049ec3ad2ae26)
2017/09/11 14:58:39 Build context (go=go1.8.3, user=root@3b0fc1d0acb6, date=20170808-07:09:08)
2017/09/11 14:58:39 Starting Server at : :9913
2017/09/11 14:58:39 Metrics endpoint: /metrics
2017/09/11 14:58:39 Metrics namespace: nginx
2017/09/11 14:58:39 Scraping information from : http://localhost/status

I don't know why the process terminted automatically, please advise.

@sysulq
Copy link
Owner

sysulq commented Sep 15, 2017

Maybe the process exits when your ssh terminal quits? Please try nohup ./nginx-vts-exporter & to launch this program

@smallfish01
Copy link
Author

Yes, you are right, I used "nohup" and the process is running ok now.
Thanks you very much!

@sysulq
Copy link
Owner

sysulq commented Sep 18, 2017

Nice :-)

@sysulq sysulq closed this as completed Sep 18, 2017
@dragonfly-net
Copy link

Scraping information from : http://localhost/status
How to replace it to more correct path like http://localhost/status/format/json ? I made
export NGINX_STATUS=http://localhost/status/format/json but unsuccessfully.

@alpacas9
Copy link

Scraping information from : http://localhost/status
How to replace it to more correct path like http://localhost/status/format/json ? I made
export NGINX_STATUS=http://localhost/status/format/json but unsuccessfully.

try http://localhost/status?json

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

4 participants