Prometheusでnginxを監視するのに、Nginx VTS exporter(以下VTS)を導入しようとしています。
VTSから取得するnginxのステータスはJSON形式である必要があるのですが、nginxのステータス出力をJSON形式にする方法が見当たらないのです。。
Nginx VTS exporter
https://github.com/hnlq715/nginx-vts-exporter
上記サイトの Environment variables の項にありますように、 VTSから http://localhost/status/format/json
にアクセスしてJSON値を取ってくるようなのですが、nginx側のステータスを返す ngx_http_stub_status_module
というnginxモジュールではJSON形式にならないようで、エラーとなってしまいます。。
Module ngx_http_stub_status_module
https://nginx.org/en/docs/http/ngx_http_stub_status_module.html
・nginxの設定
nginx
1server { 2 listen 80; 3 server_name localhost; 4 location /status { 5 stub_status on; 6 access_log off; 7 } 8}
・http://localhost/status/format/json の返却(JSONじゃない..)
Active connections: 2 server accepts handled requests 2 2 4 Reading: 0 Writing: 1 Waiting: 1
・VTSのエラーログ
2017/02/24 08:01:14 json.Unmarshal failed invalid character 'A' looking for beginning of value
エラーログを見る限り、VTS側の取得自体は機能しているようなので、やはりnginxのステータスをJSON形式で吐けば解決かと思っています。
お心当たりのある方、何卒ご教授願います。
m(_ _)m
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/25 00:03
2017/02/25 14:59