当前位置:网站首页>Prometheus operation and maintenance tool promtool (III) debug function
Prometheus operation and maintenance tool promtool (III) debug function
2022-07-27 02:35:00 【InfoQ】
obtain profiling debug Information
promtool debug pprof <server>
[[email protected] ~]# ./promtool debug pprof 'http://127.0.0.1:9090'
collecting: http://127.0.0.1:9090/debug/pprof/threadcreate
collecting: http://127.0.0.1:9090/debug/pprof/profile?seconds=30
collecting: http://127.0.0.1:9090/debug/pprof/block
collecting: http://127.0.0.1:9090/debug/pprof/goroutine
collecting: http://127.0.0.1:9090/debug/pprof/heap
collecting: http://127.0.0.1:9090/debug/pprof/mutex
collecting: http://127.0.0.1:9090/debug/pprof/trace?seconds=30
Compiling debug information complete, all files written in "debug.tar.gz".
[[email protected] ~]# tar -zxf debug.tar.gz
[[email protected] ~]# ll -h
-rw-rw-rw- 1 root root 177 1 month 1 1970 block.pb
-rw-rw-rw- 1 root root 5.9K 1 month 1 1970 cpu.pb
-rw-rw-rw- 1 root root 7.4K 1 month 1 1970 goroutine.pb
-rw-rw-rw- 1 root root 223K 1 month 1 1970 heap.pb
-rw-rw-rw- 1 root root 177 1 month 1 1970 mutex.pb
-rw-rw-rw- 1 root root 493 1 month 1 1970 threadcreate.pb
-rw-rw-rw- 1 root root 73K 1 month 1 1970 trace.pb
obtain metric debug Information
promtool debug metrics <server>
[[email protected] ~]# ./promtool debug metrics 'http://127.0.0.1:9090'
collecting: http://127.0.0.1:9090/metrics
Compiling debug information complete, all files written in "debug.tar.gz".
[[email protected] ~]# tar -zxf debug.tar.gz
tar: metrics.txt: Untrusted old timestamp 1970-01-01 08:00:00
[[email protected] ~]# tail metrics.txt
# TYPE prometheus_web_federation_warnings_total counter
prometheus_web_federation_warnings_total 0
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 519347
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0
curl 127.0.0.1:9090/metrics > metrics.txt
Get all debug Information
promtool debug all <server>
[[email protected] ~]# ./promtool debug all 'http://127.0.0.1:9090'
collecting: http://127.0.0.1:9090/debug/pprof/profile?seconds=30
collecting: http://127.0.0.1:9090/debug/pprof/block
collecting: http://127.0.0.1:9090/debug/pprof/goroutine
collecting: http://127.0.0.1:9090/debug/pprof/heap
collecting: http://127.0.0.1:9090/debug/pprof/mutex
collecting: http://127.0.0.1:9090/debug/pprof/threadcreate
collecting: http://127.0.0.1:9090/debug/pprof/trace?seconds=30
collecting: http://127.0.0.1:9090/metrics
Compiling debug information complete, all files written in "debug.tar.gz".
[[email protected] ~]# tar -zxf debug.tar.gz
tar: cpu.pb: Untrusted old timestamp 1970-01-01 08:00:00
tar: block.pb: Untrusted old timestamp 1970-01-01 08:00:00
tar: goroutine.pb: Untrusted old timestamp 1970-01-01 08:00:00
tar: heap.pb: Untrusted old timestamp 1970-01-01 08:00:00
tar: mutex.pb: Untrusted old timestamp 1970-01-01 08:00:00
tar: threadcreate.pb: Untrusted old timestamp 1970-01-01 08:00:00
tar: trace.pb: Untrusted old timestamp 1970-01-01 08:00:00
tar: metrics.txt: Untrusted old timestamp 1970-01-01 08:00:00
[[email protected] ~]# ls
block.pb debug.tar.gz heap.pb mutex.pb trace.pb
cpu.pb goroutine.pb metrics.txt threadcreate.pb
Test rule file
promtool test rules <test-rule-file>...
[[email protected] ~]# ./promtool test rules promtsdb.rules.yaml
Unit Testing: promtsdb.rules.yaml
FAILED:
yaml: unmarshal errors:
line 1: field groups not found in type main.unitTestFile
summary
边栏推荐
猜你喜欢
随机推荐
毕业进入HW,从测试工程师到项目经理,现如今在鹅厂年收入百万,我的给大家的一些建议...
Golang implements TCP chat room
【洋哥带你玩转线性表(一)——顺序表】
Today, let's talk about escape characters [cute new version]
C language - assignment operator, compound assignment operator, self increasing and self decreasing operator, comma operator, conditional operator, goto statement, comment
Hcip day 5 OSPF extended configuration experiment
Constant knowledge explanation of C language
HCIP oSPF综合实验
Full company mGRE and star topology mGRE
Northeast Securities stock online account, is it safe to open an account on your mobile phone
Hcip bidirectional republication and routing strategy
Multipoint bidirectional republication and routing strategy topology experiment
Array methods and loops in JS
Sort the three integers from large to small (introduce various methods in detail)
JVM interview questions (necessary for interview)
Encyclopedia of websites commonly used by people who know current affairs
Go language slow start - package
Little sister's notes: how do I learn simple source code to expand my horizons
[enchanting interpretation, 15 minutes let you thoroughly learn how to use the stack!!!]
The pointer is really profound!!!
![[Fibonacci sequence and spiral are based on C language]](/img/11/0dd7ee9a788c519fa3ae5a3f2b0bca.jpg)








