原文链接: https://nsq.io/components/nsqadmin.html
nsqadmin
is a Web UI to view aggregated cluster stats in realtime and perform various administrative tasks.
nsqadmin
是一个Web UI,可以实时查看聚合的集群统计数据并执行各种管理任务。
Command Line Options
命令行选项
graphite : 一个web 应用的名称,Graphite用来进行收集服务器所有的即时状态,用户请求信息
-allow-config-from-cidr string
A CIDR from which to allow HTTP requests to the /config endpoint (default "127.0.0.1/8")
# 允许HTTP请求到/配置端点的CIDR(默认值为“127.0.0.1/8”)
-config string
path to config file
# 配置文件路径
-graphite-url string
graphite HTTP address
# graphite HTTP 地址
-http-address string
<addr>:<port> to listen on for HTTP clients (default "0.0.0.0:4171")
# 要监听HTTP客户机<地址>:<端口>(默认为“0.0.0.0:4171”)
-http-client-connect-timeout duration
timeout for HTTP connect (default 2s)
# HTTP连接超时(默认2秒)
-http-client-request-timeout duration
timeout for HTTP request (default 5s)
# HTTP请求超时(默认5秒)
-http-client-tls-cert string
path to certificate file for the HTTP client
# HTTP客户机的证书文件路径
-http-client-tls-insecure-skip-verify
configure the HTTP client to skip verification of TLS certificates
# 配置HTTP客户端以跳过对TLS证书的验证
-http-client-tls-key string
path to key file for the HTTP client
# HTTP客户机密钥文件的路径
-http-client-tls-root-ca-file string
path to CA file for the HTTP client
# HTTP客户机的CA文件路径
-log-prefix string
log message prefix (default "[nsqadmin] ")
# 日志消息前缀(默认为“[nsqadmin]”)
-lookupd-http-address value
lookupd HTTP address (may be given multiple times)
# lookupd HTTP 地址(可能给出多次)
-notification-http-endpoint string
HTTP endpoint (fully qualified) to which POST notifications of admin actions will be sent
# HTTP端点(完全限定),将向其发送管理操作的POST通知
-nsqd-http-address value
nsqd HTTP address (may be given multiple times)
# nsqd HTTP 地址(可能给出多次)
-proxy-graphite
proxy HTTP requests to graphite
# 代理HTTP请求到graphite
-statsd-counter-format string
The counter stats key formatting applied by the implementation of statsd. If no formatting is desired, set this to an empty string. (default "stats.counters.%s.count")
# 计数器stats键格式由statsd实现应用。如果不需要格式化,将其设置为空字符串。(默认“stats.counters. % s.count”)
-statsd-gauge-format string
The gauge stats key formatting applied by the implementation of statsd. If no formatting is desired, set this to an empty string. (default "stats.gauges.%s")
# 由statsd实现应用的gauge stats键格式化。如果不需要格式化,将其设置为空字符串。(默认“stats.gauges. % s”)
-statsd-interval duration
time interval nsqd is configured to push to statsd (must match nsqd) (default 1m0s)
# 将时间间隔nsqd配置为push到statsd(必须匹配nsqd)(默认1分0秒)
-statsd-prefix string
prefix used for keys sent to statsd (%s for host replacement, must match nsqd) (default "nsq.%s")
# 用于发送到statsd的密钥的前缀(%s用于主机替换,必须匹配nsqd)(默认为“nsq.%s”)
-version
print version string
# 打印版本字符串
statsd / Graphite Integration
When using nsqd --statsd-address=...
you can specify a nsqadmin --graphite-url=http://graphite.yourdomain.com
to enable graphite charts in nsqadmin
. If using a statsd clone (like statsdaemon) that does not prefix keys, also specify --use-statsd-prefix=false
.
当使用
nsqd --statsd-address=...
您可以指定一个nsqadmin --graphite-url=http://graphite.yourdomain.com
来启用nsqadmin
中的graphite 图表。如果使用没有前缀键的statsd克隆(如statsdaemon),也要指定--use-statsd-prefix=false
。
Admin Notifications
Admin 通知
If the --notification-http-endpoint
flag is set, nsqadmin
will send a POST request to the specified (fully qualified) endpoint each time an admin action (such as pausing a channel) is performed.
如果设置了
--notification-http-endpoint
标志,那么每次执行管理操作(例如暂停通道)时,nsqadmin
将向指定的(完全限定的)端点发送POST请求。
The body of the request contains information about the action (some fields will be omitted when appropriate), like so:
请求的主体包含有关操作的信息(在适当的时候会省略一些字段),如下:
{
"action": "unpause_channel",
"channel": "mouth",
"topic": "beer",
"timestamp": 1357683731,
"user": "df",
"user_agent": "Mozilla/5.0 (Macintosh; Iphone 8)",
"remote_ip": "1.2.3.4:5678",
"url": "http://nsqadmin.local/api/topics/api_requests/nsq_to_file",
"via": "localhost"
}
The user
field will be filled if a HTTP Basic Authentication Username is present in the request made to nsqadmin
, say if it were running with htpasswd authentication or behind oauth2_proxy
.
如果在向
nsqadmin
发出的请求中出现HTTP基本身份验证用户名,则user
字段将被填充,比如它是在htpasswd身份验证下运行的,或者在[' oauth2_proxy ']后面运行(https://github.com/bitly/oauth2_proxy#oauth2_proxy)。htpasswd: 建立和更新存储用户名、密码的文本文件, 用于对HTTP用户的basic认证。
Hint: You can create an NSQ stream of admin action notifications with the topic name admin_actions
by setting --notification-http-endpoint
to point to the nsqd
HTTP Publish API. For example if running nsqd
on the same node you could use --notification-http-endpoint="http://127.0.0.1:4151/put?topic=admin_actions"
提示: 您可以创建一个主题名为
admin_actions
的NSQ管理操作通知流,方法是设置--notification-http-endpoint
指向nsqd
HTTP Publish API。例如,如果在同一个节点上运行nsqd
,可以使用--notification-http-endpoint="http://127.0.0.1:4151/put?topic=admin_actions"
There are community contributed utilities nsqadmin2slack
and nsqadmin2hipchat
to relay messages to HipChat and Slack respectively.
有社区提供的实用程序
nsqadmin2slack
和nsqadmin2hipchat
分别向HipChat和Slack传递消息。
Actions that are captured are:
所捕获的操作包括如下 具体介绍请查看 nsqd
create_channel
create_topic
delete_channel
delete_topic
empty_channel
empty_topic
pause_channel
pause_topic
tombstone_topic_producer
unpause_channel
unpause_topic
Metrics
测试
The following metrics are exposed through nsqadmin
on Topic, Channel and Client Connections.
以下指标通过
nsqadmin
公开主题、通道和客户端连接。
Message Queues:
消息队列
Depth
: Current sum of messages in memory + on disk (i.e. the “backlog” of messages pending delivery).
“深度”:内存+磁盘上消息的当前总数(即待发消息的“积压”)。
In-Flight
: Current count of messages delivered but not yet finished (FIN
), requeued (REQ
) or timed out.
“飞行中”:当前发送但尚未完成的消息数(' FIN ')、重新请求的消息数(' REQ ')或超时的消息数。
Deferred
: Current count of messages that were requeued and explicitly deferred which are not yet available for delivery.
“延迟”:当前已请求并显式延迟的消息数量,这些消息目前还不能交付。
Statistics:
统计
Requeued
: Total times a message has been added back to the queue due to time outs or explicit requeues.
由于超时或显式请求,消息被添加回队列的总次数。
Timed Out
: Total times a message has been requeued after not receiving a response from the client before the configured timeout.
在配置超时之前没有收到来自客户机的响应后,请求消息的总时间。
Messages
: Total count of new messages recieved since node startup.
自节点启动以来接收的新消息总数。
Rate
: The per-second rate of new messages over the previous two statsd intervals (available only when graphite integration is enabled).
前两个statsd间隔的每秒新消息速率(仅在启用graphite 集成时可用)。
Connections
: Current number of connected clients.
当前已连接的客户端数量。
Client Connections:
客户端链接
Client Host
: Client ID (hostname) and on-hover the connection remote-address.
客户端ID(主机名)和on-hover连接远程地址。
Protocol
: NSQ protocol version and client user-agent.
NSQ协议版本和客户端用户代理。
Attributes
: TLS and AUTH connection state.
TLS和AUTH连接状态。
NSQd Host
: Address of the nsqd node this client is connected to.
此客户端连接到的nsqd节点的地址。
In-flight
: Current count of messages awaiting response that have been delivered to this client.
等待已发送到此客户机的响应的消息的当前计数。
Ready Count
: Max number of messages that can be in-flight on this connection. This is controlled by a client’smax_in_flight
setting.
在此连接上可以运行的最大消息数。这由客户机的
max_in_flight
设置控制。
Finished
: Total count of messages that this client has finished (FIN
).
此客户端已完成的消息总数(' FIN ')。
Requeued
: Total count of messages that this client has requeued (REQ
).
此客户端已请求的消息总数(' REQ ')。
Messages
: Total count of messages delivered to this client.
发送到此客户机的消息总数。