nsqadmin

package
v0.3.7-HA.1.9.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2019 License: MIT Imports: 38 Imported by: 0

README

nsqadmin

nsqadmin is a Web UI to view aggregated cluster stats in realtime and perform various administrative tasks.

Read the docs

Working Locally

  1. $ npm install
  2. $ ./gulp clean watch or $ ./gulp clean build
  3. $ go-bindata --debug --pkg=nsqadmin --prefix=static/build static/build/...
  4. $ go build && ./nsqadmin
  5. make changes (repeat step 5 if you make changes to any Go code)
  6. $ go-bindata --pkg=nsqadmin --prefix=static/build static/build/...
  7. commit other changes and bindata.go

Documentation

Index

Constants

View Source
const (
	MAX_INCR_ID_BIT = 50
)

Variables

This section is empty.

Functions

func Asset added in v0.3.6

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDigest

func AssetDigest(name string) ([sha256.Size]byte, error)

AssetDigest returns the digest of the file with the given name. It returns an error if the asset could not be found or the digest could not be loaded.

func AssetDir added in v0.3.6

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"}, AssetDir("data/img") would return []string{"a.png", "b.png"}, AssetDir("foo.txt") and AssetDir("notexist") would return an error, and AssetDir("") will return []string{"data"}.

func AssetInfo added in v0.3.6

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames added in v0.3.6

func AssetNames() []string

AssetNames returns the names of the assets.

func AssetString

func AssetString(name string) (string, error)

AssetString returns the asset contents as a string (instead of a []byte).

func Digests

func Digests() (map[string][sha256.Size]byte, error)

Digests returns a map of all known files and their checksums.

func GetPartitionFromMsgID

func GetPartitionFromMsgID(id int64) int

func LogoutUser

func LogoutUser(ctx *Context, w http.ResponseWriter, req *http.Request) error

func MustAsset added in v0.3.6

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func MustAssetString

func MustAssetString(name string) string

MustAssetString is like AssetString but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewHTTPServer added in v0.2.25

func NewHTTPServer(ctx *Context) *httpServer

func NewSingleHostReverseProxy added in v0.2.16

func NewSingleHostReverseProxy(target *url.URL, timeout time.Duration) *httputil.ReverseProxy

this is similar to httputil.NewSingleHostReverseProxy except it passes along basic auth

func RestoreAsset added in v0.3.6

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory.

func RestoreAssets added in v0.3.6

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively.

Types

type AccessControl

type AccessControl interface {
	IsAdmin(username string) bool
	Start()
	Stop()
}

func NewYamlAccessControl

func NewYamlAccessControl(ctx *Context, filePath string) (AccessControl, error)

type AdminAction added in v0.2.17

type AdminAction struct {
	Action    string `json:"action"`
	Topic     string `json:"topic"`
	Order     bool   `json:"order"`
	Channel   string `json:"channel,omitempty"`
	Node      string `json:"node,omitempty"`
	Timestamp int64  `json:"timestamp"`
	User      string `json:"user,omitempty"`
	RemoteIP  string `json:"remote_ip"`
	UserAgent string `json:"user_agent"`
	URL       string `json:"url"` // The URL of the HTTP request that triggered this action
	Via       string `json:"via"` // the Hostname of the nsqadmin performing this action
}

func (*AdminAction) String

func (a *AdminAction) String() string

type CasResponse

type CasResponse struct {
	Code int
	Msg  string
	Data *CasResponseValue
}

type CasResponseValue

type CasResponseValue struct {
	Value *CasUserModel
}

type CasUserModel

type CasUserModel struct {
	Id       int64
	UserName string
	Gender   bool
	RealName string
	Aliasna  string
	Mobile   string
	Email    string
	Login    bool
	// contains filtered or unexported fields
}

func NewCasUserModel

func NewCasUserModel(ctx *Context, w http.ResponseWriter, req *http.Request) (*CasUserModel, error)

func (*CasUserModel) DoAuth

func (u *CasUserModel) DoAuth(w http.ResponseWriter, req *http.Request) error

func (*CasUserModel) GetUserName

func (u *CasUserModel) GetUserName() string

func (*CasUserModel) GetUserRole

func (u *CasUserModel) GetUserRole() string

func (*CasUserModel) IsAdmin

func (u *CasUserModel) IsAdmin() bool

func (*CasUserModel) IsLogin

func (u *CasUserModel) IsLogin() bool

func (*CasUserModel) SetContext

func (u *CasUserModel) SetContext(ctx *Context) error

func (*CasUserModel) String

func (u *CasUserModel) String() string

type ChannelActionRequest

type ChannelActionRequest struct {
	Action    string `json:"action"`
	Timestamp string `json:"timestamp"`
	Node      string `json:"node"`
	Partition int    `json:"partition"`
	MsgId     string `json:"msgid"`
}

type ChannelByDelayedQueue

type ChannelByDelayedQueue struct {
	RankList
}

func (ChannelByDelayedQueue) Less

func (c ChannelByDelayedQueue) Less(i, j int) bool

type ChannelByRequeue

type ChannelByRequeue struct {
	RankList
}

func (ChannelByRequeue) Less

func (c ChannelByRequeue) Less(i, j int) bool

type ChannelByTimeout

type ChannelByTimeout struct {
	RankList
}

func (ChannelByTimeout) Less

func (c ChannelByTimeout) Less(i, j int) bool

type Context added in v0.2.25

type Context struct {
	// contains filtered or unexported fields
}

type DCLookupdAddrs

type DCLookupdAddrs struct {
	DC           string   `json:"dc"`
	LookupdAddrs []string `json:"lookupAddrs"`
}

type IUserAuth

type IUserAuth interface {
	IsLogin() bool
	GetUserRole() string
	GetUserName() string
	IsAdmin() bool
	DoAuth(w http.ResponseWriter, req *http.Request) error
	SetContext(ctx *Context) error
	String() string
}

func GetUserModel

func GetUserModel(ctx *Context, req *http.Request) (IUserAuth, error)

type IndexFieldsQuery

type IndexFieldsQuery map[string]string

type NSQAdmin added in v0.2.25

type NSQAdmin struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New added in v0.3.6

func New(opts *Options) *NSQAdmin

func (*NSQAdmin) DC2LookupAddresses

func (n *NSQAdmin) DC2LookupAddresses() map[string][]string

func (*NSQAdmin) Exit added in v0.2.25

func (n *NSQAdmin) Exit()

func (*NSQAdmin) IsAuthEnabled

func (n *NSQAdmin) IsAuthEnabled() bool

func (*NSQAdmin) Main added in v0.2.25

func (n *NSQAdmin) Main()

func (*NSQAdmin) RealHTTPAddr added in v0.3.3

func (n *NSQAdmin) RealHTTPAddr() *net.TCPAddr

type Options added in v0.3.6

type Options struct {
	HTTPAddress string `flag:"http-address"`

	GraphiteURL   string `flag:"graphite-url"`
	ProxyGraphite bool   `flag:"proxy-graphite"`

	UseStatsdPrefixes   bool   `flag:"use-statsd-prefixes"`
	StatsdPrefix        string `flag:"statsd-prefix"`
	StatsdCounterFormat string `flag:"statsd-counter-format"`
	StatsdGaugeFormat   string `flag:"statsd-gauge-format"`

	StatsdInterval time.Duration `flag:"statsd-interval"`

	NSQLookupdHTTPAddresses []string `flag:"lookupd-http-address" cfg:"nsqlookupd_http_addresses"`
	NSQDHTTPAddresses       []string `flag:"nsqd-http-address" cfg:"nsqd_http_addresses"`

	DCNSQLookupdHTTPAddresses []string `flag:"dc-lookupd-http-address" cfg:"dc_lookupd_http_addresses"`

	NSQLookupdHTTPAddressesDC []clusterinfo.LookupdAddressDC

	HTTPClientTLSInsecureSkipVerify bool   `flag:"http-client-tls-insecure-skip-verify"`
	HTTPClientTLSRootCAFile         string `flag:"http-client-tls-root-ca-file"`
	HTTPClientTLSCert               string `flag:"http-client-tls-cert"`
	HTTPClientTLSKey                string `flag:"http-client-tls-key"`

	NotificationHTTPEndpoint string `flag:"notification-http-endpoint"`
	TraceQueryURL            string `flag:"trace-query-url"`
	TraceAppID               string `flag:"trace-app-id"`
	TraceAppName             string `flag:"trace-app-name"`
	TraceLogIndexID          string `flag:"trace-log-index-id"`
	TraceLogIndexName        string `flag:"trace-log-index-name"`
	TraceLogPageCount        int    `flag:"trace-log-page-count"`

	ChannelCreationRetry           int `flag:"channel-create-retry"`
	ChannelCreationBackoffInterval int `flag:"channel-create-backoff-interval"`

	AuthUrl      string `flag:"auth-url" cfg:"auth_url"`
	AuthSecret   string `flag:"auth-secret" cfg:"auth_secret"`
	LogoutUrl    string `flag:"logout-url" cfg:"logout_url"`
	AppName      string `flag:"app-name" cfg:"app_name"`
	RedirectUrl  string `flag:"redirect-url" cfg:"redirect_url"`
	LogDir       string `flag:"log-dir" cfg:"log_dir"`
	Logger       levellogger.Logger
	AccessTokens []string `flag:"access-tokens" cfg:"access_tokens"`

	AccessControlFile string `flag:"access-control-file"`
	EnableZanTestSkip bool   `flag:"enable-zan-test-skip"`
}

func NewOptions added in v0.3.6

func NewOptions() *Options

type QueryPairs

type QueryPairs struct {
	FieldName  string `json:"fieldName"`
	FieldValue string `json:"fieldValue"`
}

type RankList

type RankList []*rankStats

func (RankList) Len

func (t RankList) Len() int

func (RankList) Swap

func (t RankList) Swap(i, j int)

type TLListT

type TLListT []TraceLogData

func (TLListT) Len

func (l TLListT) Len() int

func (TLListT) Less

func (l TLListT) Less(i, j int) bool

func (TLListT) Swap

func (l TLListT) Swap(i, j int)

type TopicsByChannelDepth

type TopicsByChannelDepth struct {
	RankList
}

func (TopicsByChannelDepth) Less

func (c TopicsByChannelDepth) Less(i, j int) bool

type TopicsByHourlyPubsize

type TopicsByHourlyPubsize struct {
	RankList
}

func (TopicsByHourlyPubsize) Less

func (c TopicsByHourlyPubsize) Less(i, j int) bool

type TraceLog

type TraceLog struct {
	LogDataDtos []TraceLogData `json:"logDataDtos"`
	TotalCount  int            `json:"totalCount"`
}

type TraceLogData

type TraceLogData struct {
	ID       string `json:"id"`
	Time     string `json:"time"`
	Level    string `json:"level"`
	HostIp   string `json:"hostIp"`
	HostName string `json:"hostName"`
	Content  string `json:"content"`
	Extra    string `json:"extra"`
	Extra1   string `json:"extra1"`
	TraceLogItemInfo
	RawMsgData   string            `json:"raw_msg_data"`
	DC           string            `json:"dc"`
	RawMsgDataDC map[string]string `json:"raw_msg_data_dc"`
}

type TraceLogDataForJs

type TraceLogDataForJs struct {
	TraceLogItemInfoForJs
	RawMsgData string `json:"raw_msg_data"`
}

type TraceLogItemInfo

type TraceLogItemInfo struct {
	MsgID     uint64 `json:"msgid"`
	TraceID   uint64 `json:"traceid"`
	Topic     string `json:"topic"`
	Channel   string `json:"channel"`
	Timestamp int64  `json:"timestamp"`
	Action    string `json:"action"`
}

func (TraceLogItemInfo) ToJsJson

type TraceLogItemInfoForJs

type TraceLogItemInfoForJs struct {
	DC        string `json:"dc"`
	MsgID     string `json:"msgid"`
	TraceID   string `json:"traceid"`
	Topic     string `json:"topic"`
	Channel   string `json:"channel"`
	Timestamp string `json:"timestamp"`
	Action    string `json:"action"`
}

type TraceLogQueryInfo

type TraceLogQueryInfo struct {
	Sort         string `json:"sort"`
	AppName      string `json:"appName"`
	LogIndexName string `json:"logIndexName"`
	Level        string `json:"level"`
	Host         string `json:"host"`
	Content      string `json:"content"`
	// 2017-01-01 00:00:00
	StartTime   string `json:"startTime"`
	EndTime     string `json:"endTime"`
	IndexFields string `json:"indexFields"`
	PageNumber  int    `json:"pageNumber"`
	PageSize    int    `json:"pageSize"`
	Type        int    `json:"type"`
}

func NewLogQueryInfo

func NewLogQueryInfo(appName string,
	logIndexName string, span time.Duration, indexFields IndexFieldsQuery, pageCnt int) *TraceLogQueryInfo

type TraceLogResp

type TraceLogResp struct {
	Success bool     `json:"success"`
	Code    int      `json:"code"`
	Msg     string   `json:"msg"`
	Data    TraceLog `json:"data"`
}

type YamlAccessControl

type YamlAccessControl struct {
	// contains filtered or unexported fields
}

func (*YamlAccessControl) IsAdmin

func (ac *YamlAccessControl) IsAdmin(username string) bool

func (*YamlAccessControl) Start

func (ac *YamlAccessControl) Start()

func (*YamlAccessControl) Stop

func (ac *YamlAccessControl) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL