How to see the metics

45 views
Skip to first unread message

Krishna Khatana

unread,
Jul 2, 2021, 4:39:47 AM7/2/21
to mtail-users
Hi all,

Thank you so the help in advance, below is my program
counter http_requests_total by request_method,status

#log_format common '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_response_time ';

/^/ +
/(?P<remote_addr>[0-9A-Za-z\.-:]+) / +
/- / +
/(?P<remote_user>[0-9A-Za-z-]+) / +
/(?P<time_local>\[\d{2}\/\w{3}\/\d{4}:\d{2}:\d{2}:\d{2} [-|\+]\d{4}\]) / +
/"(?P<request_method>[A-Z]+) (?P<request_uri>\S+) (?P<http_version>HTTP\/[0-9\.]+)" / +
/(?P<status>\d{3}) / +
/(?P<bytes_sent>\d+) / +
/"(?P<http_referer>\S+)" / +
/"(?P<http_user_agent>[[:print:]]+)" / +
/"(?P<x_forwarded_for>[0-9A-Za-z\.-]+)" / +

/$/ {
        http_requests_total[tolower($request_method)][$status]++
}

post this i am able to start mtail without any error but the problume is i am not able to see the  http_requests_total on http://localhost:9100/metrics
and when i configured it with prometheus same i could not see the counter variable.
mtail startup command using service :
[Unit]
Description=mtail
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
Restart=on-failure
WorkingDirectory=/usr/local/bin/
ExecStart=/usr/local/bin/mtail/mtail \
    --address  127.0.0.1  --port 9101 \
    --emit_prog_label=false --alsologtostderr \
    --progs /etc/mtail/ \
    --logs /data/nginx/logs/access.log

User=mtail
Group=mtail

[Install]
WantedBy=multi-user.target

prometheus  configuration :
global:
  scrape_interval: 5s

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['127.0.0.1:9090']
  - job_name: 'mtail'
    scrape_interval: 5s
    static_configs:
      - targets: [' 127.0.0.1:9101']


please help urgentely.
Reply all
Reply to author
Forward
0 new messages