# HELP http_server_total http server requested frequency count. # TYPE http_server_total counter http_server_total 23.0 # HELP http_server_created http server requested frequency count. # TYPE http_server_created gauge http_server_created 1.6232518107397504e+09 # HELP http_server_execption_total http server requested execption frequency count. # TYPE http_server_execption_total counter http_server_execption_total 0.0 # HELP http_server_execption_created http server requested execption frequency count. # TYPE http_server_execption_created gauge http_server_execption_created 1.6232518107397504e+09 # HELP http_server_execptions_total http server requested execptions frequency count. # TYPE http_server_execptions_total counter http_server_execptions_total 4.0 # HELP http_server_execptions_created http server requested execptions frequency count. # TYPE http_server_execptions_created gauge http_server_execptions_created 1.6232518107397504e+09 # HELP http_server_euro_moneys_total Euros made serving Http Server. # TYPE http_server_euro_moneys_total counter http_server_euro_moneys_total 90706.0 # HELP http_server_euro_moneys_created Euros made serving Http Server. # TYPE http_server_euro_moneys_created gauge http_server_euro_moneys_created 1.6232518107397504e+09
# INPROGRESS / LAST 跟踪正在处理中的请求调用数目以及最后一个调用完成时间. INPROGRESS = Gauge('app_inprogress', 'number of http server in progress') LAST = Gauge('app_last_seconds', 'The last time a app was Served')
# INPROGRESS_Modify 此种方式也可跟踪正在处理中的请求其调用完成时间. INPROGRESSMODIFY = Gauge('app_inprogress_modify', 'number of http server in progress modify') LASTTIME = Gauge('app_last_time_seconds', 'The last time a app was Served')
# TIME 回调函数使用, 例如用来返回当前时间带有`set_functiuon()`简单示例 TIME = Gauge('current_time_seconds','The Current Time')
# HELP app_inprogress number of http server in progress # TYPE app_inprogress gauge app_inprogress 2.0 # 每次访问 (+3-1) # HELP app_last_seconds The last time a app was Served # TYPE app_last_seconds gauge app_last_seconds 1.6233011413151145e+09 # HELP app_inprogress_modify number of http server in progress modify # TYPE app_inprogress_modify gauge app_inprogress_modify 0.0 # HELP app_last_time_seconds The last time a app was Served # TYPE app_last_time_seconds gauge app_last_time_seconds 1.6233011413151145e+09 # HELP current_time_seconds The Current Time # TYPE current_time_seconds gauge current_time_seconds 1.6233011425841126e+09
# LATENCYTIME 使用时间函数来跟踪延时(Histogram) LATENCYTIME = Histogram('app_latency_time_seconds','app 程序访问延迟时间统计',buckets=[0.0001 * (2**x) for x in range(1,10)])
from prometheus_client import Counter c = Counter('my_failures', 'Description of counter') c.inc() # Increment by 1 c.inc(1.6) # Increment by given value
# Example from prometheus_client import Gauge g = Gauge('my_inprogress_requests', 'Description of gauge') g.inc() # Increment by 1 g.dec(10) # Decrement by given value g.set(4.2) # Set to a given value
# 设置 Labels from prometheus_client import Counter c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint']) c.labels('get', '/').inc() c.labels('post', '/submit').inc() # Labels can also be passed as keyword-arguments: from prometheus_client import Counter c = Counter('my_requests_total', 'HTTP Failures', ['method', 'endpoint']) c.labels(method='get', endpoint='/').inc() c.labels(method='post', endpoint='/submit').inc()
# Gauge example: from prometheus_client import Gauge g = Gauge('my_inprogress_requests', 'Description of gauge',['mylabelname']) g.labels(mylabelname='labelname').set(30)
# 校验是否赋值最大耗时map def check_request_time_max_map(self, uri, cost): if uri not in self.request_time_max_map: return True if self.request_time_max_map[uri] < cost: return True return False
# 重置最大耗时map def reset_request_time_max_map(self): for key in self.request_time_max_map: self.request_time_max_map[key] = 0.0
class ClassifierHandler(tornado.web.RequestHandler): def post(self): # TODO Something you need # work.... # 统计Summary,包括请求次数和每次耗时 g_monitor.set_prometheus_request_summary(self) self.write("OK")
class PingHandler(tornado.web.RequestHandler): def head(self): print('INFO', datetime.now(), "/ping Head.") g_monitor.set_prometheus_request_summary(self) self.write("OK")
# - 通用占位符定义如下: * <boolean>: a boolean that can take the values true or false * <int>: a regular integer * <duration>: a duration matching the regular expression [0-9]+(ms|[smhdwy]) * <filename>: a valid path in the current working directory * <string>: a regular string * <secret>: a regular string that is a secret, such as a password * <regex>: a regular expression
# - exporter configuration file format Module # The protocol over which the probe will take place (http, tcp, dns, icmp). prober: <prober_string> # How long the probe will wait before giving up. [ timeout: <duration> ] # The specific probe configuration - at most one of these should be specified. [ http: <http_probe> ] [ tcp: <tcp_probe> ] [ dns: <dns_probe> ] [ icmp: <icmp_probe> ]
# - 结果说明 # HELP probe_dns_lookup_time_seconds Returns the time taken for probe dns lookup in seconds # TYPE probe_dns_lookup_time_seconds gauge probe_dns_lookup_time_seconds 2.5798e-05 # HELP probe_duration_seconds Returns how long the probe took to complete in seconds # TYPE probe_duration_seconds gauge probe_duration_seconds 0.006506971 # 整个探测花费时间包括DNS解析时间 # HELP probe_icmp_duration_seconds Duration of icmp request by phase # TYPE probe_icmp_duration_seconds gauge probe_icmp_duration_seconds{phase="resolve"} 2.5798e-05 probe_icmp_duration_seconds{phase="rtt"} 0.00625726 probe_icmp_duration_seconds{phase="setup"} 0.000126281 # HELP probe_icmp_reply_hop_limit Replied packet hop limit (TTL for ipv4) # TYPE probe_icmp_reply_hop_limit gauge probe_icmp_reply_hop_limit 113 # HELP probe_ip_addr_hash Specifies the hash of IP address. It's useful to detect if the IP address changes. # TYPE probe_ip_addr_hash gauge probe_ip_addr_hash 2.372708602e+09 # 监测目标地址Hash # HELP probe_ip_protocol Specifies whether probe ip protocol is IP4 or IP6 # TYPE probe_ip_protocol gauge probe_ip_protocol 4 # 使用IP协议版本 # HELP probe_success Displays whether or not the probe was a success # TYPE probe_success gauge probe_success 1 # 成功返回1,否则返回0
# HELP probe_ip_protocol Specifies whether probe ip protocol is IP4 or IP6 # TYPE probe_ip_protocol gauge probe_ip_protocol 4 # HELP probe_success Displays whether or not the probe was a success # TYPE probe_success gauge probe_success 1 # 匹配成功
# HELP probe_ssl_earliest_cert_expiry Returns earliest SSL cert expiry date # TYPE probe_ssl_earliest_cert_expiry gauge probe_ssl_earliest_cert_expiry 1.627277462e+09 # TLS/SSL证书到期时间 # HELP probe_ssl_last_chain_expiry_timestamp_seconds Returns last SSL chain expiry in unixtime # TYPE probe_ssl_last_chain_expiry_timestamp_seconds gauge probe_ssl_last_chain_expiry_timestamp_seconds 1.627277462e+09 # 返回unixtime中最后一个SSL链到期时间 # HELP probe_ssl_last_chain_info Contains SSL leaf certificate information # TYPE probe_ssl_last_chain_info gauge probe_ssl_last_chain_info{fingerprint_sha256="2ed189349f818f3414132ebea309e36f620d78a0507a2fa523305f275062d73c"} 1 # 证书链信息 # HELP probe_success Displays whether or not the probe was a success # TYPE probe_success gauge probe_success 1 # 成功标志 # HELP probe_tls_version_info Returns the TLS version used, or NaN when unknown # TYPE probe_tls_version_info gauge probe_tls_version_info{version="TLS 1.2"} 1 # 证书版本
# HELP probe_dns_lookup_time_seconds Returns the time taken for probe dns lookup in seconds # TYPE probe_dns_lookup_time_seconds gauge probe_dns_lookup_time_seconds 0.186725698 # HELP probe_failed_due_to_regex Indicates if probe failed due to regex # TYPE probe_failed_due_to_regex gauge probe_failed_due_to_regex 0 # HELP probe_http_content_length Length of http content response # TYPE probe_http_content_length gauge probe_http_content_length -1 # HELP probe_duration_seconds Returns how long the probe took to complete in seconds # TYPE probe_duration_seconds gauge probe_duration_seconds 2.142812294 # HELP probe_http_duration_seconds Duration of http request by phase, summed over all redirects # TYPE probe_http_duration_seconds gauge probe_http_duration_seconds{phase="connect"} 1.209361663 probe_http_duration_seconds{phase="processing"} 0.250921647 probe_http_duration_seconds{phase="resolve"} 0.186725698 probe_http_duration_seconds{phase="tls"} 0 probe_http_duration_seconds{phase="transfer"} 0.495566665 # HELP probe_http_redirects The number of redirects # TYPE probe_http_redirects gauge probe_http_redirects 0 # HELP probe_http_ssl Indicates if SSL was used for the final redirect # TYPE probe_http_ssl gauge probe_http_ssl 0 # HELP probe_http_status_code Response HTTP status code # TYPE probe_http_status_code gauge probe_http_status_code 200 # HELP probe_http_uncompressed_body_length Length of uncompressed response body # TYPE probe_http_uncompressed_body_length gauge probe_http_uncompressed_body_length 22279 # HELP probe_http_version Returns the version of HTTP of the probe response # TYPE probe_http_version gauge probe_http_version 1.1 # HTTP 协议版本 # HELP probe_ip_addr_hash Specifies the hash of IP address. It's useful to detect if the IP address changes. # TYPE probe_ip_addr_hash gauge probe_ip_addr_hash 2.341618423e+09 # HELP probe_ip_protocol Specifies whether probe ip protocol is IP4 or IP6 # TYPE probe_ip_protocol gauge probe_ip_protocol 4 # HELP probe_success Displays whether or not the probe was a success # TYPE probe_success gauge probe_success 1 # 探测结果
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds # TYPE probe_duration_seconds gauge probe_duration_seconds 3.301450584 # HELP probe_http_duration_seconds Duration of http request by phase, summed over all redirects # TYPE probe_http_duration_seconds gauge probe_http_duration_seconds{phase="connect"} 0.35759203100000003 probe_http_duration_seconds{phase="processing"} 0.39931457400000003 probe_http_duration_seconds{phase="resolve"} 2.334050778 probe_http_duration_seconds{phase="tls"} 0.196995271 probe_http_duration_seconds{phase="transfer"} 0.012739035 # HELP probe_http_redirects The number of redirects # TYPE probe_http_redirects gauge probe_http_redirects 1 # HELP probe_http_ssl Indicates if SSL was used for the final redirect # TYPE probe_http_ssl gauge probe_http_ssl 1 # HELP probe_http_status_code Response HTTP status code # TYPE probe_http_status_code gauge probe_http_status_code 200 # HELP probe_http_uncompressed_body_length Length of uncompressed response body # TYPE probe_http_uncompressed_body_length gauge probe_http_uncompressed_body_length 16377 # HELP probe_http_version Returns the version of HTTP of the probe response # TYPE probe_http_version gauge probe_http_version 2 # HELP probe_ssl_earliest_cert_expiry Returns earliest SSL cert expiry in unixtime # TYPE probe_ssl_earliest_cert_expiry gauge probe_ssl_earliest_cert_expiry 1.628424e+09 # HELP probe_ssl_last_chain_expiry_timestamp_seconds Returns last SSL chain expiry in timestamp seconds # TYPE probe_ssl_last_chain_expiry_timestamp_seconds gauge probe_ssl_last_chain_expiry_timestamp_seconds 1.628424e+09 # HELP probe_ssl_last_chain_info Contains SSL leaf certificate information # TYPE probe_ssl_last_chain_info gauge probe_ssl_last_chain_info{fingerprint_sha256="44c9e62838db98e79918c841e4b72529849e2e7e6654e337a32a74ec502edaa7"} 1 # HELP probe_success Displays whether or not the probe was a success # TYPE probe_success gauge probe_success 1 # HELP probe_tls_version_info Contains the TLS version used # TYPE probe_tls_version_info gauge probe_tls_version_info{version="TLS 1.3"} 1
# HELP probe_dns_additional_rrs Returns number of entries in the additional resource record list # TYPE probe_dns_additional_rrs gauge probe_dns_additional_rrs 0 # 返回附加资源记录列表中的条目数 # HELP probe_dns_answer_rrs Returns number of entries in the answer resource record list # TYPE probe_dns_answer_rrs gauge probe_dns_answer_rrs 2 # DNS 回答响应条目 # HELP probe_dns_authority_rrs Returns number of entries in the authority resource record list # TYPE probe_dns_authority_rrs gauge probe_dns_authority_rrs 0 # 返回权限资源记录列表中的条目数 # HELP probe_dns_duration_seconds Duration of DNS request by phase # TYPE probe_dns_duration_seconds gauge probe_dns_duration_seconds{phase="connect"} 7.9269e-05 probe_dns_duration_seconds{phase="request"} 0.072951973 probe_dns_duration_seconds{phase="resolve"} 2.9612e-05 # HELP probe_dns_lookup_time_seconds Returns the time taken for probe dns lookup in seconds # TYPE probe_dns_lookup_time_seconds gauge probe_dns_lookup_time_seconds 2.9612e-05 # 返回探测dns查找所用的时间(以秒为单位) # HELP probe_duration_seconds Returns how long the probe took to complete in seconds # TYPE probe_duration_seconds gauge probe_duration_seconds 0.073247895 # 返回以秒为单位完成探测所用的时间 # HELP probe_success Displays whether or not the probe was a success # TYPE probe_success gauge probe_success 1
# HELP probe_dns_answer_rrs Returns number of entries in the answer resource record list probe_dns_answer_rrs 1 # HELP probe_success Displays whether or not the probe was a success probe_success 1
方式1.请访问本博主的B站【WeiyiGeek】首页关注UP主, 将自动随机获取解锁验证码。
Method 2.Please visit 【My Twitter】. There is an article verification code in the homepage.
方式3.扫一扫下方二维码,关注本站官方公众号
回复:验证码
将获取解锁(有效期7天)本站所有技术文章哟!