1
0
Fork 0

Adding upstream version 1.34.4.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-24 07:26:29 +02:00
parent e393c3af3f
commit 4978089aab
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
4963 changed files with 677545 additions and 0 deletions

View file

@ -0,0 +1,253 @@
# RabbitMQ Input Plugin
Reads metrics from RabbitMQ servers via the [Management Plugin][management].
For additional details reference the [RabbitMQ Management HTTP
Stats][management-reference].
[management]: https://www.rabbitmq.com/management.html
[management-reference]: https://raw.githack.com/rabbitmq/rabbitmq-management/rabbitmq_v3_6_9/priv/www/api/index.html
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
In addition to the plugin-specific configuration settings, plugins support
additional global and plugin configuration settings. These settings are used to
modify metrics, tags, and field or create aliases and configure ordering, etc.
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
## Secret-store support
This plugin supports secrets from secret-stores for the `username` and
`password` option.
See the [secret-store documentation][SECRETSTORE] for more details on how
to use them.
[SECRETSTORE]: ../../../docs/CONFIGURATION.md#secret-store-secrets
## Configuration
```toml @sample.conf
# Reads metrics from RabbitMQ servers via the Management Plugin
[[inputs.rabbitmq]]
## Management Plugin url. (default: http://localhost:15672)
# url = "http://localhost:15672"
## Credentials
# username = "guest"
# password = "guest"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Optional request timeouts
##
## ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait
## for a server's response headers after fully writing the request.
# header_timeout = "3s"
##
## client_timeout specifies a time limit for requests made by this client.
## Includes connection time, any redirects, and reading the response body.
# client_timeout = "4s"
## A list of nodes to gather as the rabbitmq_node measurement. If not
## specified, metrics for all nodes are gathered.
# nodes = ["rabbit@node1", "rabbit@node2"]
## A list of exchanges to gather as the rabbitmq_exchange measurement. If not
## specified, metrics for all exchanges are gathered.
# exchanges = ["telegraf"]
## Metrics to include and exclude. Globs accepted.
## Note that an empty array for both will include all metrics
## Currently the following metrics are supported: "exchange", "federation", "node", "overview", "queue"
# metric_include = []
# metric_exclude = []
## Queues to include and exclude. Globs accepted.
## Note that an empty array for both will include all queues
# queue_name_include = []
# queue_name_exclude = []
## Federation upstreams to include and exclude specified as an array of glob
## pattern strings. Federation links can also be limited by the queue and
## exchange filters.
# federation_upstream_include = []
# federation_upstream_exclude = []
```
## Metrics
- rabbitmq_overview
- tags:
- url
- name
- fields:
- channels (int, channels)
- connections (int, connections)
- consumers (int, consumers)
- exchanges (int, exchanges)
- messages (int, messages)
- messages_acked (int, messages)
- messages_delivered (int, messages)
- messages_delivered_get (int, messages)
- messages_published (int, messages)
- messages_ready (int, messages)
- messages_unacked (int, messages)
- queues (int, queues)
- clustering_listeners (int, cluster nodes)
- amqp_listeners (int, amqp nodes up)
- return_unroutable (int, number of unroutable messages)
- return_unroutable_rate (float, number of unroutable messages per second)
- rabbitmq_node
- tags:
- url
- node
- url
- fields:
- disk_free (int, bytes)
- disk_free_limit (int, bytes)
- disk_free_alarm (int, disk alarm)
- fd_total (int, file descriptors)
- fd_used (int, file descriptors)
- mem_limit (int, bytes)
- mem_used (int, bytes)
- mem_alarm (int, memory a)
- proc_total (int, erlang processes)
- proc_used (int, erlang processes)
- run_queue (int, erlang processes)
- sockets_total (int, sockets)
- sockets_used (int, sockets)
- running (int, node up)
- uptime (int, milliseconds)
- mnesia_disk_tx_count (int, number of disk transaction)
- mnesia_ram_tx_count (int, number of ram transaction)
- mnesia_disk_tx_count_rate (float, number of disk transaction per second)
- mnesia_ram_tx_count_rate (float, number of ram transaction per second)
- gc_num (int, number of garbage collection)
- gc_bytes_reclaimed (int, bytes)
- gc_num_rate (float, number of garbage collection per second)
- gc_bytes_reclaimed_rate (float, bytes per second)
- io_read_avg_time (float, number of read operations)
- io_read_avg_time_rate (int, number of read operations per second)
- io_read_bytes (int, bytes)
- io_read_bytes_rate (float, bytes per second)
- io_write_avg_time (int, milliseconds)
- io_write_avg_time_rate (float, milliseconds per second)
- io_write_bytes (int, bytes)
- io_write_bytes_rate (float, bytes per second)
- mem_connection_readers (int, bytes)
- mem_connection_writers (int, bytes)
- mem_connection_channels (int, bytes)
- mem_connection_other (int, bytes)
- mem_queue_procs (int, bytes)
- mem_queue_slave_procs (int, bytes)
- mem_plugins (int, bytes)
- mem_other_proc (int, bytes)
- mem_metrics (int, bytes)
- mem_mgmt_db (int, bytes)
- mem_mnesia (int, bytes)
- mem_other_ets (int, bytes)
- mem_binary (int, bytes)
- mem_msg_index (int, bytes)
- mem_code (int, bytes)
- mem_atom (int, bytes)
- mem_other_system (int, bytes)
- mem_allocated_unused (int, bytes)
- mem_reserved_unallocated (int, bytes)
- mem_total (int, bytes)
- rabbitmq_queue
- tags:
- url
- queue
- vhost
- node
- durable
- auto_delete
- fields:
- consumer_utilisation (float, percent)
- consumers (int, int)
- idle_since (string, time - e.g., "2006-01-02 15:04:05")
- head_message_timestamp (int, unix timestamp - only emitted if available from API)
- memory (int, bytes)
- message_bytes (int, bytes)
- message_bytes_persist (int, bytes)
- message_bytes_ram (int, bytes)
- message_bytes_ready (int, bytes)
- message_bytes_unacked (int, bytes)
- messages (int, count)
- messages_ack (int, count)
- messages_ack_rate (float, messages per second)
- messages_deliver (int, count)
- messages_deliver_rate (float, messages per second)
- messages_deliver_get (int, count)
- messages_deliver_get_rate (float, messages per second)
- messages_publish (int, count)
- messages_publish_rate (float, messages per second)
- messages_ready (int, count)
- messages_redeliver (int, count)
- messages_redeliver_rate (float, messages per second)
- messages_unack (int, count)
- slave_nodes (int, count)
- synchronised_slave_nodes (int, count)
- rabbitmq_exchange
- tags:
- url
- exchange
- type
- vhost
- internal
- durable
- auto_delete
- fields:
- messages_publish_in (int, count)
- messages_publish_in_rate (int, messages per second)
- messages_publish_out (int, count)
- messages_publish_out_rate (int, messages per second)
- rabbitmq_federation
- tags:
- url
- vhost
- type
- upstream
- exchange
- upstream_exchange
- queue
- upstream_queue
- fields:
- acks_uncommitted (int, count)
- consumers (int, count)
- messages_unacknowledged (int, count)
- messages_uncommitted (int, count)
- messages_unconfirmed (int, count)
- messages_confirm (int, count)
- messages_publish (int, count)
- messages_return_unroutable (int, count)
## Sample Queries
Message rates for the entire node can be calculated from total message
counts. For instance, to get the rate of messages published per minute, use this
query:
```sql
SELECT NON_NEGATIVE_DERIVATIVE(LAST("messages_published"), 1m) AS messages_published_rate FROM rabbitmq_overview WHERE time > now() - 10m GROUP BY time(1m)
```
## Example Output
```text
rabbitmq_queue,url=http://amqp.example.org:15672,queue=telegraf,vhost=influxdb,node=rabbit@amqp.example.org,durable=true,auto_delete=false,host=amqp.example.org head_message_timestamp=1493684017,messages_deliver_get=0i,messages_publish=329i,messages_publish_rate=0.2,messages_redeliver_rate=0,message_bytes_ready=0i,message_bytes_unacked=0i,messages_deliver=329i,messages_unack=0i,consumers=1i,idle_since="",messages=0i,messages_deliver_rate=0.2,messages_deliver_get_rate=0.2,messages_redeliver=0i,memory=43032i,message_bytes_ram=0i,messages_ack=329i,messages_ready=0i,messages_ack_rate=0.2,consumer_utilisation=1,message_bytes=0i,message_bytes_persist=0i 1493684035000000000
rabbitmq_overview,url=http://amqp.example.org:15672,host=amqp.example.org channels=2i,consumers=1i,exchanges=17i,messages_acked=329i,messages=0i,messages_ready=0i,messages_unacked=0i,connections=2i,queues=1i,messages_delivered=329i,messages_published=329i,clustering_listeners=2i,amqp_listeners=1i 1493684035000000000
rabbitmq_node,url=http://amqp.example.org:15672,node=rabbit@amqp.example.org,host=amqp.example.org fd_total=1024i,fd_used=32i,mem_limit=8363329126i,sockets_total=829i,disk_free=8175935488i,disk_free_limit=50000000i,mem_used=58771080i,proc_total=1048576i,proc_used=267i,run_queue=0i,sockets_used=2i,running=1i 149368403500000000
rabbitmq_exchange,url=http://amqp.example.org:15672,exchange=telegraf,type=fanout,vhost=influxdb,internal=false,durable=true,auto_delete=false,host=amqp.example.org messages_publish_in=2i,messages_publish_out=1i 149368403500000000
```

View file

@ -0,0 +1,777 @@
//go:generate ../../../tools/readme_config_includer/generator
package rabbitmq
import (
_ "embed"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"strconv"
"sync"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/config"
"github.com/influxdata/telegraf/filter"
"github.com/influxdata/telegraf/plugins/common/tls"
"github.com/influxdata/telegraf/plugins/inputs"
)
//go:embed sample.conf
var sampleConfig string
const (
defaultUsername = "guest"
defaultPassword = "guest"
defaultURL = "http://localhost:15672"
defaultResponseHeaderTimeout = 3
defaultClientTimeout = 4
)
// RabbitMQ defines the configuration necessary for gathering metrics,
// see the sample config for further details
type RabbitMQ struct {
URL string `toml:"url"`
Name string `toml:"name" deprecated:"1.3.0;1.35.0;use 'tags' instead"`
Username config.Secret `toml:"username"`
Password config.Secret `toml:"password"`
tls.ClientConfig
ResponseHeaderTimeout config.Duration `toml:"header_timeout"`
ClientTimeout config.Duration `toml:"client_timeout"`
Nodes []string `toml:"nodes"`
Queues []string `toml:"queues" deprecated:"1.6.0;1.35.0;use 'queue_name_include' instead"`
Exchanges []string `toml:"exchanges"`
MetricInclude []string `toml:"metric_include"`
MetricExclude []string `toml:"metric_exclude"`
QueueInclude []string `toml:"queue_name_include"`
QueueExclude []string `toml:"queue_name_exclude"`
FederationUpstreamInclude []string `toml:"federation_upstream_include"`
FederationUpstreamExclude []string `toml:"federation_upstream_exclude"`
Log telegraf.Logger `toml:"-"`
client *http.Client
excludeEveryQueue bool
metricFilter filter.Filter
queueFilter filter.Filter
upstreamFilter filter.Filter
}
type overviewResponse struct {
MessageStats *messageStats `json:"message_stats"`
ObjectTotals *objectTotals `json:"object_totals"`
QueueTotals *queueTotals `json:"queue_totals"`
Listeners []listeners `json:"listeners"`
}
type listeners struct {
Protocol string `json:"protocol"`
}
type details struct {
Rate float64 `json:"rate"`
}
type messageStats struct {
Ack int64
AckDetails details `json:"ack_details"`
Deliver int64
DeliverDetails details `json:"deliver_details"`
DeliverGet int64 `json:"deliver_get"`
DeliverGetDetails details `json:"deliver_get_details"`
Publish int64
PublishDetails details `json:"publish_details"`
Redeliver int64
RedeliverDetails details `json:"redeliver_details"`
PublishIn int64 `json:"publish_in"`
PublishInDetails details `json:"publish_in_details"`
PublishOut int64 `json:"publish_out"`
PublishOutDetails details `json:"publish_out_details"`
ReturnUnroutable int64 `json:"return_unroutable"`
ReturnUnroutableDetails details `json:"return_unroutable_details"`
}
type objectTotals struct {
Channels int64
Connections int64
Consumers int64
Exchanges int64
Queues int64
}
type queueTotals struct {
Messages int64
MessagesReady int64 `json:"messages_ready"`
MessagesUnacknowledged int64 `json:"messages_unacknowledged"`
MessageBytes int64 `json:"message_bytes"`
MessageBytesReady int64 `json:"message_bytes_ready"`
MessageBytesUnacknowledged int64 `json:"message_bytes_unacknowledged"`
MessageRAM int64 `json:"message_bytes_ram"`
MessagePersistent int64 `json:"message_bytes_persistent"`
}
type queue struct {
queueTotals // just to not repeat the same code
messageStats `json:"message_stats"`
Memory int64
Consumers int64
ConsumerUtilisation float64 `json:"consumer_utilisation"`
Name string
Node string
Vhost string
Durable bool
AutoDelete bool `json:"auto_delete"`
IdleSince string `json:"idle_since"`
SlaveNodes []string `json:"slave_nodes"`
SynchronisedSlaveNodes []string `json:"synchronised_slave_nodes"`
HeadMessageTimestamp *int64 `json:"head_message_timestamp"`
}
type node struct {
Name string
DiskFree int64 `json:"disk_free"`
DiskFreeLimit int64 `json:"disk_free_limit"`
DiskFreeAlarm bool `json:"disk_free_alarm"`
FdTotal int64 `json:"fd_total"`
FdUsed int64 `json:"fd_used"`
MemLimit int64 `json:"mem_limit"`
MemUsed int64 `json:"mem_used"`
MemAlarm bool `json:"mem_alarm"`
ProcTotal int64 `json:"proc_total"`
ProcUsed int64 `json:"proc_used"`
RunQueue int64 `json:"run_queue"`
SocketsTotal int64 `json:"sockets_total"`
SocketsUsed int64 `json:"sockets_used"`
Running bool `json:"running"`
Uptime int64 `json:"uptime"`
MnesiaDiskTxCount int64 `json:"mnesia_disk_tx_count"`
MnesiaDiskTxCountDetails details `json:"mnesia_disk_tx_count_details"`
MnesiaRAMTxCount int64 `json:"mnesia_ram_tx_count"`
MnesiaRAMTxCountDetails details `json:"mnesia_ram_tx_count_details"`
GcNum int64 `json:"gc_num"`
GcNumDetails details `json:"gc_num_details"`
GcBytesReclaimed int64 `json:"gc_bytes_reclaimed"`
GcBytesReclaimedDetails details `json:"gc_bytes_reclaimed_details"`
IoReadAvgTime float64 `json:"io_read_avg_time"`
IoReadAvgTimeDetails details `json:"io_read_avg_time_details"`
IoReadBytes int64 `json:"io_read_bytes"`
IoReadBytesDetails details `json:"io_read_bytes_details"`
IoWriteAvgTime float64 `json:"io_write_avg_time"`
IoWriteAvgTimeDetails details `json:"io_write_avg_time_details"`
IoWriteBytes int64 `json:"io_write_bytes"`
IoWriteBytesDetails details `json:"io_write_bytes_details"`
}
type exchange struct {
Name string
messageStats `json:"message_stats"`
Type string
Internal bool
Vhost string
Durable bool
AutoDelete bool `json:"auto_delete"`
}
type federationLinkChannelMessageStats struct {
Confirm int64 `json:"confirm"`
ConfirmDetails details `json:"confirm_details"`
Publish int64 `json:"publish"`
PublishDetails details `json:"publish_details"`
ReturnUnroutable int64 `json:"return_unroutable"`
ReturnUnroutableDetails details `json:"return_unroutable_details"`
}
type federationLinkChannel struct {
AcksUncommitted int64 `json:"acks_uncommitted"`
ConsumerCount int64 `json:"consumer_count"`
MessagesUnacknowledged int64 `json:"messages_unacknowledged"`
MessagesUncommitted int64 `json:"messages_uncommitted"`
MessagesUnconfirmed int64 `json:"messages_unconfirmed"`
MessageStats federationLinkChannelMessageStats `json:"message_stats"`
}
type federationLink struct {
Type string `json:"type"`
Queue string `json:"queue"`
UpstreamQueue string `json:"upstream_queue"`
Exchange string `json:"exchange"`
UpstreamExchange string `json:"upstream_exchange"`
Vhost string `json:"vhost"`
Upstream string `json:"upstream"`
LocalChannel federationLinkChannel `json:"local_channel"`
}
type memoryResponse struct {
Memory *memory `json:"memory"`
}
// memory details
type memory struct {
ConnectionReaders int64 `json:"connection_readers"`
ConnectionWriters int64 `json:"connection_writers"`
ConnectionChannels int64 `json:"connection_channels"`
ConnectionOther int64 `json:"connection_other"`
QueueProcs int64 `json:"queue_procs"`
QueueSlaveProcs int64 `json:"queue_slave_procs"`
Plugins int64 `json:"plugins"`
OtherProc int64 `json:"other_proc"`
Metrics int64 `json:"metrics"`
MgmtDB int64 `json:"mgmt_db"`
Mnesia int64 `json:"mnesia"`
OtherEts int64 `json:"other_ets"`
Binary int64 `json:"binary"`
MsgIndex int64 `json:"msg_index"`
Code int64 `json:"code"`
Atom int64 `json:"atom"`
OtherSystem int64 `json:"other_system"`
AllocatedUnused int64 `json:"allocated_unused"`
ReservedUnallocated int64 `json:"reserved_unallocated"`
Total interface{} `json:"total"`
}
type errorResponse struct {
Error string `json:"error"`
Reason string `json:"reason"`
}
type gatherFunc func(r *RabbitMQ, acc telegraf.Accumulator)
var gatherFunctions = map[string]gatherFunc{
"exchange": gatherExchanges,
"federation": gatherFederationLinks,
"node": gatherNodes,
"overview": gatherOverview,
"queue": gatherQueues,
}
func boolToInt(b bool) int64 {
if b {
return 1
}
return 0
}
func (*RabbitMQ) SampleConfig() string {
return sampleConfig
}
func (r *RabbitMQ) Init() error {
var err error
// Create gather filters
if err := r.createQueueFilter(); err != nil {
return err
}
if err := r.createUpstreamFilter(); err != nil {
return err
}
// Create a filter for the metrics
if r.metricFilter, err = filter.NewIncludeExcludeFilter(r.MetricInclude, r.MetricExclude); err != nil {
return err
}
tlsCfg, err := r.ClientConfig.TLSConfig()
if err != nil {
return err
}
tr := &http.Transport{
ResponseHeaderTimeout: time.Duration(r.ResponseHeaderTimeout),
TLSClientConfig: tlsCfg,
}
r.client = &http.Client{
Transport: tr,
Timeout: time.Duration(r.ClientTimeout),
}
return nil
}
func (r *RabbitMQ) Gather(acc telegraf.Accumulator) error {
var wg sync.WaitGroup
for name, f := range gatherFunctions {
// Query only metrics that are supported
if !r.metricFilter.Match(name) {
continue
}
wg.Add(1)
go func(gf gatherFunc) {
defer wg.Done()
gf(r, acc)
}(f)
}
wg.Wait()
return nil
}
func (r *RabbitMQ) requestEndpoint(u string) ([]byte, error) {
if r.URL == "" {
r.URL = defaultURL
}
endpoint := r.URL + u
r.Log.Debugf("Requesting %q...", endpoint)
req, err := http.NewRequest("GET", endpoint, nil)
if err != nil {
return nil, err
}
username := defaultUsername
if !r.Username.Empty() {
usernameSecret, err := r.Username.Get()
if err != nil {
return nil, err
}
defer usernameSecret.Destroy()
username = usernameSecret.String()
}
password := defaultPassword
if !r.Password.Empty() {
passwordSecret, err := r.Password.Get()
if err != nil {
return nil, err
}
defer passwordSecret.Destroy()
password = passwordSecret.String()
}
req.SetBasicAuth(username, password)
resp, err := r.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
r.Log.Debugf("HTTP status code: %v %v", resp.StatusCode, http.StatusText(resp.StatusCode))
if resp.StatusCode < 200 || resp.StatusCode > 299 {
return nil, fmt.Errorf("getting %q failed: %v %v", u, resp.StatusCode, http.StatusText(resp.StatusCode))
}
return io.ReadAll(resp.Body)
}
func (r *RabbitMQ) requestJSON(u string, target interface{}) error {
buf, err := r.requestEndpoint(u)
if err != nil {
return err
}
if err := json.Unmarshal(buf, target); err != nil {
var jsonErr *json.UnmarshalTypeError
if errors.As(err, &jsonErr) {
// Try to get the error reason from the response
var errResponse errorResponse
if json.Unmarshal(buf, &errResponse) == nil && errResponse.Error != "" {
// Return the error reason in the response
return fmt.Errorf("error response trying to get %q: %q (reason: %q)", u, errResponse.Error, errResponse.Reason)
}
}
return fmt.Errorf("decoding answer from %q failed: %w", u, err)
}
return nil
}
func gatherOverview(r *RabbitMQ, acc telegraf.Accumulator) {
overview := &overviewResponse{}
err := r.requestJSON("/api/overview", &overview)
if err != nil {
acc.AddError(err)
return
}
if overview.QueueTotals == nil || overview.ObjectTotals == nil || overview.MessageStats == nil {
acc.AddError(errors.New("wrong answer from rabbitmq, probably auth issue"))
return
}
var clusteringListeners, amqpListeners int64 = 0, 0
for _, listener := range overview.Listeners {
if listener.Protocol == "clustering" {
clusteringListeners++
} else if listener.Protocol == "amqp" {
amqpListeners++
}
}
tags := map[string]string{"url": r.URL}
if r.Name != "" {
tags["name"] = r.Name
}
fields := map[string]interface{}{
"messages": overview.QueueTotals.Messages,
"messages_ready": overview.QueueTotals.MessagesReady,
"messages_unacked": overview.QueueTotals.MessagesUnacknowledged,
"channels": overview.ObjectTotals.Channels,
"connections": overview.ObjectTotals.Connections,
"consumers": overview.ObjectTotals.Consumers,
"exchanges": overview.ObjectTotals.Exchanges,
"queues": overview.ObjectTotals.Queues,
"messages_acked": overview.MessageStats.Ack,
"messages_delivered": overview.MessageStats.Deliver,
"messages_delivered_get": overview.MessageStats.DeliverGet,
"messages_published": overview.MessageStats.Publish,
"clustering_listeners": clusteringListeners,
"amqp_listeners": amqpListeners,
"return_unroutable": overview.MessageStats.ReturnUnroutable,
"return_unroutable_rate": overview.MessageStats.ReturnUnroutableDetails.Rate,
}
acc.AddFields("rabbitmq_overview", fields, tags)
}
func gatherNodes(r *RabbitMQ, acc telegraf.Accumulator) {
allNodes := make([]*node, 0)
err := r.requestJSON("/api/nodes", &allNodes)
if err != nil {
acc.AddError(err)
return
}
nodes := allNodes[:0]
for _, singleNode := range allNodes {
if r.shouldGatherNode(singleNode) {
nodes = append(nodes, singleNode)
}
}
var wg sync.WaitGroup
for _, singleNode := range nodes {
wg.Add(1)
go func(singleNode *node) {
defer wg.Done()
tags := map[string]string{"url": r.URL}
tags["node"] = singleNode.Name
fields := map[string]interface{}{
"disk_free": singleNode.DiskFree,
"disk_free_limit": singleNode.DiskFreeLimit,
"disk_free_alarm": boolToInt(singleNode.DiskFreeAlarm),
"fd_total": singleNode.FdTotal,
"fd_used": singleNode.FdUsed,
"mem_limit": singleNode.MemLimit,
"mem_used": singleNode.MemUsed,
"mem_alarm": boolToInt(singleNode.MemAlarm),
"proc_total": singleNode.ProcTotal,
"proc_used": singleNode.ProcUsed,
"run_queue": singleNode.RunQueue,
"sockets_total": singleNode.SocketsTotal,
"sockets_used": singleNode.SocketsUsed,
"uptime": singleNode.Uptime,
"mnesia_disk_tx_count": singleNode.MnesiaDiskTxCount,
"mnesia_disk_tx_count_rate": singleNode.MnesiaDiskTxCountDetails.Rate,
"mnesia_ram_tx_count": singleNode.MnesiaRAMTxCount,
"mnesia_ram_tx_count_rate": singleNode.MnesiaRAMTxCountDetails.Rate,
"gc_num": singleNode.GcNum,
"gc_num_rate": singleNode.GcNumDetails.Rate,
"gc_bytes_reclaimed": singleNode.GcBytesReclaimed,
"gc_bytes_reclaimed_rate": singleNode.GcBytesReclaimedDetails.Rate,
"io_read_avg_time": singleNode.IoReadAvgTime,
"io_read_avg_time_rate": singleNode.IoReadAvgTimeDetails.Rate,
"io_read_bytes": singleNode.IoReadBytes,
"io_read_bytes_rate": singleNode.IoReadBytesDetails.Rate,
"io_write_avg_time": singleNode.IoWriteAvgTime,
"io_write_avg_time_rate": singleNode.IoWriteAvgTimeDetails.Rate,
"io_write_bytes": singleNode.IoWriteBytes,
"io_write_bytes_rate": singleNode.IoWriteBytesDetails.Rate,
"running": boolToInt(singleNode.Running),
}
var memory memoryResponse
err = r.requestJSON("/api/nodes/"+singleNode.Name+"/memory", &memory)
if err != nil {
acc.AddError(err)
return
}
if memory.Memory != nil {
fields["mem_connection_readers"] = memory.Memory.ConnectionReaders
fields["mem_connection_writers"] = memory.Memory.ConnectionWriters
fields["mem_connection_channels"] = memory.Memory.ConnectionChannels
fields["mem_connection_other"] = memory.Memory.ConnectionOther
fields["mem_queue_procs"] = memory.Memory.QueueProcs
fields["mem_queue_slave_procs"] = memory.Memory.QueueSlaveProcs
fields["mem_plugins"] = memory.Memory.Plugins
fields["mem_other_proc"] = memory.Memory.OtherProc
fields["mem_metrics"] = memory.Memory.Metrics
fields["mem_mgmt_db"] = memory.Memory.MgmtDB
fields["mem_mnesia"] = memory.Memory.Mnesia
fields["mem_other_ets"] = memory.Memory.OtherEts
fields["mem_binary"] = memory.Memory.Binary
fields["mem_msg_index"] = memory.Memory.MsgIndex
fields["mem_code"] = memory.Memory.Code
fields["mem_atom"] = memory.Memory.Atom
fields["mem_other_system"] = memory.Memory.OtherSystem
fields["mem_allocated_unused"] = memory.Memory.AllocatedUnused
fields["mem_reserved_unallocated"] = memory.Memory.ReservedUnallocated
switch v := memory.Memory.Total.(type) {
case float64:
fields["mem_total"] = int64(v)
case map[string]interface{}:
var foundEstimator bool
for _, estimator := range []string{"rss", "allocated", "erlang"} {
if x, found := v[estimator]; found {
if total, ok := x.(float64); ok {
fields["mem_total"] = int64(total)
foundEstimator = true
break
}
acc.AddError(fmt.Errorf("unknown type %T for %q total memory", x, estimator))
}
}
if !foundEstimator {
acc.AddError(fmt.Errorf("no known memory estimation in %v", v))
}
default:
acc.AddError(fmt.Errorf("unknown type %T for total memory", memory.Memory.Total))
}
}
acc.AddFields("rabbitmq_node", fields, tags)
}(singleNode)
}
wg.Wait()
}
func gatherQueues(r *RabbitMQ, acc telegraf.Accumulator) {
if r.excludeEveryQueue {
return
}
// Gather information about queues
queues := make([]queue, 0)
err := r.requestJSON("/api/queues", &queues)
if err != nil {
acc.AddError(err)
return
}
for _, queue := range queues {
if !r.queueFilter.Match(queue.Name) {
continue
}
tags := map[string]string{
"url": r.URL,
"queue": queue.Name,
"vhost": queue.Vhost,
"node": queue.Node,
"durable": strconv.FormatBool(queue.Durable),
"auto_delete": strconv.FormatBool(queue.AutoDelete),
}
fields := map[string]interface{}{
// common information
"consumers": queue.Consumers,
"consumer_utilisation": queue.ConsumerUtilisation,
"idle_since": queue.IdleSince,
"slave_nodes": len(queue.SlaveNodes),
"synchronised_slave_nodes": len(queue.SynchronisedSlaveNodes),
"memory": queue.Memory,
// messages information
"message_bytes": queue.MessageBytes,
"message_bytes_ready": queue.MessageBytesReady,
"message_bytes_unacked": queue.MessageBytesUnacknowledged,
"message_bytes_ram": queue.MessageRAM,
"message_bytes_persist": queue.MessagePersistent,
"messages": queue.Messages,
"messages_ready": queue.MessagesReady,
"messages_unack": queue.MessagesUnacknowledged,
"messages_ack": queue.messageStats.Ack,
"messages_ack_rate": queue.messageStats.AckDetails.Rate,
"messages_deliver": queue.messageStats.Deliver,
"messages_deliver_rate": queue.messageStats.DeliverDetails.Rate,
"messages_deliver_get": queue.messageStats.DeliverGet,
"messages_deliver_get_rate": queue.messageStats.DeliverGetDetails.Rate,
"messages_publish": queue.messageStats.Publish,
"messages_publish_rate": queue.messageStats.PublishDetails.Rate,
"messages_redeliver": queue.messageStats.Redeliver,
"messages_redeliver_rate": queue.messageStats.RedeliverDetails.Rate,
}
if queue.HeadMessageTimestamp != nil {
fields["head_message_timestamp"] = *queue.HeadMessageTimestamp
}
acc.AddFields(
"rabbitmq_queue",
fields,
tags,
)
}
}
func gatherExchanges(r *RabbitMQ, acc telegraf.Accumulator) {
// Gather information about exchanges
exchanges := make([]exchange, 0)
err := r.requestJSON("/api/exchanges", &exchanges)
if err != nil {
acc.AddError(err)
return
}
for _, exchange := range exchanges {
if !r.shouldGatherExchange(exchange.Name) {
continue
}
tags := map[string]string{
"url": r.URL,
"exchange": exchange.Name,
"type": exchange.Type,
"vhost": exchange.Vhost,
"internal": strconv.FormatBool(exchange.Internal),
"durable": strconv.FormatBool(exchange.Durable),
"auto_delete": strconv.FormatBool(exchange.AutoDelete),
}
acc.AddFields(
"rabbitmq_exchange",
map[string]interface{}{
"messages_publish_in": exchange.messageStats.PublishIn,
"messages_publish_in_rate": exchange.messageStats.PublishInDetails.Rate,
"messages_publish_out": exchange.messageStats.PublishOut,
"messages_publish_out_rate": exchange.messageStats.PublishOutDetails.Rate,
},
tags,
)
}
}
func gatherFederationLinks(r *RabbitMQ, acc telegraf.Accumulator) {
// Gather information about federation links
federationLinks := make([]federationLink, 0)
err := r.requestJSON("/api/federation-links", &federationLinks)
if err != nil {
acc.AddError(err)
return
}
for _, link := range federationLinks {
if !r.shouldGatherFederationLink(link) {
continue
}
tags := map[string]string{
"url": r.URL,
"type": link.Type,
"vhost": link.Vhost,
"upstream": link.Upstream,
}
if link.Type == "exchange" {
tags["exchange"] = link.Exchange
tags["upstream_exchange"] = link.UpstreamExchange
} else {
tags["queue"] = link.Queue
tags["upstream_queue"] = link.UpstreamQueue
}
acc.AddFields(
"rabbitmq_federation",
map[string]interface{}{
"acks_uncommitted": link.LocalChannel.AcksUncommitted,
"consumers": link.LocalChannel.ConsumerCount,
"messages_unacknowledged": link.LocalChannel.MessagesUnacknowledged,
"messages_uncommitted": link.LocalChannel.MessagesUncommitted,
"messages_unconfirmed": link.LocalChannel.MessagesUnconfirmed,
"messages_confirm": link.LocalChannel.MessageStats.Confirm,
"messages_publish": link.LocalChannel.MessageStats.Publish,
"messages_return_unroutable": link.LocalChannel.MessageStats.ReturnUnroutable,
},
tags,
)
}
}
func (r *RabbitMQ) shouldGatherNode(node *node) bool {
if len(r.Nodes) == 0 {
return true
}
for _, name := range r.Nodes {
if name == node.Name {
return true
}
}
return false
}
func (r *RabbitMQ) createQueueFilter() error {
// Backwards compatibility for deprecated `queues` parameter.
if len(r.Queues) > 0 {
r.QueueInclude = append(r.QueueInclude, r.Queues...)
}
queueFilter, err := filter.NewIncludeExcludeFilter(r.QueueInclude, r.QueueExclude)
if err != nil {
return err
}
r.queueFilter = queueFilter
for _, q := range r.QueueExclude {
if q == "*" {
r.excludeEveryQueue = true
}
}
return nil
}
func (r *RabbitMQ) createUpstreamFilter() error {
upstreamFilter, err := filter.NewIncludeExcludeFilter(r.FederationUpstreamInclude, r.FederationUpstreamExclude)
if err != nil {
return err
}
r.upstreamFilter = upstreamFilter
return nil
}
func (r *RabbitMQ) shouldGatherExchange(exchangeName string) bool {
if len(r.Exchanges) == 0 {
return true
}
for _, name := range r.Exchanges {
if name == exchangeName {
return true
}
}
return false
}
func (r *RabbitMQ) shouldGatherFederationLink(link federationLink) bool {
if !r.upstreamFilter.Match(link.Upstream) {
return false
}
switch link.Type {
case "exchange":
return r.shouldGatherExchange(link.Exchange)
case "queue":
return r.queueFilter.Match(link.Queue)
default:
return false
}
}
func init() {
inputs.Add("rabbitmq", func() telegraf.Input {
return &RabbitMQ{
ResponseHeaderTimeout: config.Duration(defaultResponseHeaderTimeout * time.Second),
ClientTimeout: config.Duration(defaultClientTimeout * time.Second),
}
})
}

View file

@ -0,0 +1,688 @@
package rabbitmq
import (
"errors"
"fmt"
"net/http"
"net/http/httptest"
"os"
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/testutil"
)
func TestRabbitMQGeneratesMetricsSet1(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var jsonFilePath string
switch r.URL.Path {
case "/api/overview":
jsonFilePath = "testdata/set1/overview.json"
case "/api/nodes":
jsonFilePath = "testdata/set1/nodes.json"
case "/api/queues":
jsonFilePath = "testdata/set1/queues.json"
case "/api/exchanges":
jsonFilePath = "testdata/set1/exchanges.json"
case "/api/federation-links":
jsonFilePath = "testdata/set1/federation-links.json"
case "/api/nodes/rabbit@vagrant-ubuntu-trusty-64/memory":
jsonFilePath = "testdata/set1/memory.json"
default:
w.WriteHeader(http.StatusInternalServerError)
t.Errorf("unknown path %q", r.URL.Path)
return
}
data, err := os.ReadFile(jsonFilePath)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
t.Errorf("Could not read from data file %q: %v", jsonFilePath, err)
return
}
if _, err = w.Write(data); err != nil {
w.WriteHeader(http.StatusInternalServerError)
t.Error(err)
return
}
}))
defer ts.Close()
// Define test cases
expected := []telegraf.Metric{
testutil.MustMetric("rabbitmq_overview",
map[string]string{
"url": ts.URL,
},
map[string]interface{}{
"messages": int64(5),
"messages_ready": int64(32),
"messages_unacked": int64(27),
"messages_acked": int64(5246),
"messages_delivered": int64(5234),
"messages_delivered_get": int64(3333),
"messages_published": int64(5258),
"channels": int64(44),
"connections": int64(44),
"consumers": int64(65),
"exchanges": int64(43),
"queues": int64(62),
"clustering_listeners": int64(2),
"amqp_listeners": int64(2),
"return_unroutable": int64(10),
"return_unroutable_rate": float64(3.3),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_queue",
map[string]string{
"auto_delete": "false",
"durable": "false",
"node": "rabbit@rmqlocal-0.rmqlocal.ankorabbitstatefulset3.svc.cluster.local",
"queue": "reply_a716f0523cd44941ad2ea6ce4a3869c3",
"url": ts.URL,
"vhost": "sorandomsorandom",
},
map[string]interface{}{
"consumers": int64(3),
"consumer_utilisation": float64(1.0),
"head_message_timestamp": int64(1446362534),
"memory": int64(143776),
"message_bytes": int64(3),
"message_bytes_ready": int64(4),
"message_bytes_unacked": int64(5),
"message_bytes_ram": int64(6),
"message_bytes_persist": int64(7),
"messages": int64(44),
"messages_ready": int64(32),
"messages_unack": int64(44),
"messages_ack": int64(3457),
"messages_ack_rate": float64(9.9),
"messages_deliver": int64(22222),
"messages_deliver_rate": float64(333.4),
"messages_deliver_get": int64(3457),
"messages_deliver_get_rate": float64(0.2),
"messages_publish": int64(3457),
"messages_publish_rate": float64(11.2),
"messages_redeliver": int64(33),
"messages_redeliver_rate": float64(2.5),
"idle_since": "2015-11-01 8:22:14",
"slave_nodes": int64(1),
"synchronised_slave_nodes": int64(1),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_node",
map[string]string{
"node": "rabbit@vagrant-ubuntu-trusty-64",
"url": ts.URL,
},
map[string]interface{}{
"disk_free": int64(3776),
"disk_free_limit": int64(50000000),
"disk_free_alarm": int64(0),
"fd_total": int64(1024),
"fd_used": int64(63),
"mem_limit": int64(2503),
"mem_used": int64(159707080),
"mem_alarm": int64(1),
"proc_total": int64(1048576),
"proc_used": int64(783),
"run_queue": int64(0),
"sockets_total": int64(829),
"sockets_used": int64(45),
"uptime": int64(7464827),
"running": int64(1),
"mnesia_disk_tx_count": int64(16),
"mnesia_ram_tx_count": int64(296),
"mnesia_disk_tx_count_rate": float64(1.1),
"mnesia_ram_tx_count_rate": float64(2.2),
"gc_num": int64(57280132),
"gc_bytes_reclaimed": int64(2533),
"gc_num_rate": float64(274.2),
"gc_bytes_reclaimed_rate": float64(16490856.3),
"io_read_avg_time": float64(983.0),
"io_read_avg_time_rate": float64(88.77),
"io_read_bytes": int64(1111),
"io_read_bytes_rate": float64(99.99),
"io_write_avg_time": float64(134.0),
"io_write_avg_time_rate": float64(4.32),
"io_write_bytes": int64(823),
"io_write_bytes_rate": float64(32.8),
"mem_connection_readers": int64(1234),
"mem_connection_writers": int64(5678),
"mem_connection_channels": int64(1133),
"mem_connection_other": int64(2840),
"mem_queue_procs": int64(2840),
"mem_queue_slave_procs": int64(0),
"mem_plugins": int64(1755976),
"mem_other_proc": int64(23056584),
"mem_metrics": int64(196536),
"mem_mgmt_db": int64(491272),
"mem_mnesia": int64(115600),
"mem_other_ets": int64(2121872),
"mem_binary": int64(418848),
"mem_msg_index": int64(42848),
"mem_code": int64(25179322),
"mem_atom": int64(1041593),
"mem_other_system": int64(14741981),
"mem_allocated_unused": int64(38208528),
"mem_reserved_unallocated": int64(0),
"mem_total": int64(83025920),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "true",
"durable": "false",
"exchange": "reply_a716f0523cd44941ad2ea6ce4a3869c3",
"internal": "false",
"type": "direct",
"url": ts.URL,
"vhost": "sorandomsorandom",
},
map[string]interface{}{
"messages_publish_in": int64(3678),
"messages_publish_in_rate": float64(3.2),
"messages_publish_out": int64(3677),
"messages_publish_out_rate": float64(5.1),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_federation",
map[string]string{
"queue": "exampleLocalQueue",
"type": "queue",
"upstream": "ExampleFederationUpstream",
"upstream_queue": "exampleUpstreamQueue",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"acks_uncommitted": int64(1),
"consumers": int64(2),
"messages_unacknowledged": int64(3),
"messages_uncommitted": int64(4),
"messages_unconfirmed": int64(5),
"messages_confirm": int64(67),
"messages_publish": int64(890),
"messages_return_unroutable": int64(1),
},
time.Unix(0, 0),
),
}
// Run the test
plugin := &RabbitMQ{
URL: ts.URL,
Log: testutil.Logger{},
}
require.NoError(t, plugin.Init())
acc := &testutil.Accumulator{}
require.NoError(t, plugin.Gather(acc))
acc.Wait(len(expected))
require.Empty(t, acc.Errors)
testutil.RequireMetricsEqual(t, expected, acc.GetTelegrafMetrics(), testutil.IgnoreTime(), testutil.SortMetrics())
}
func TestRabbitMQGeneratesMetricsSet2(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var jsonFilePath string
switch r.URL.Path {
case "/api/overview":
jsonFilePath = "testdata/set2/overview.json"
case "/api/nodes":
jsonFilePath = "testdata/set2/nodes.json"
case "/api/queues":
jsonFilePath = "testdata/set2/queues.json"
case "/api/exchanges":
jsonFilePath = "testdata/set2/exchanges.json"
case "/api/federation-links":
jsonFilePath = "testdata/set2/federation-links.json"
case "/api/nodes/rabbit@rmqserver/memory":
jsonFilePath = "testdata/set2/memory.json"
default:
w.WriteHeader(http.StatusInternalServerError)
t.Errorf("unknown path %q", r.URL.Path)
return
}
data, err := os.ReadFile(jsonFilePath)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
t.Errorf("Could not read from data file %q: %v", jsonFilePath, err)
return
}
if _, err = w.Write(data); err != nil {
w.WriteHeader(http.StatusInternalServerError)
t.Error(err)
return
}
}))
defer ts.Close()
// Define test cases
expected := []telegraf.Metric{
testutil.MustMetric("rabbitmq_overview",
map[string]string{
"url": ts.URL,
},
map[string]interface{}{
"messages": int64(30),
"messages_ready": int64(30),
"messages_unacked": int64(0),
"messages_acked": int64(3736443),
"messages_delivered": int64(3736446),
"messages_delivered_get": int64(3736446),
"messages_published": int64(770025),
"channels": int64(43),
"connections": int64(43),
"consumers": int64(37),
"exchanges": int64(8),
"queues": int64(34),
"clustering_listeners": int64(1),
"amqp_listeners": int64(2),
"return_unroutable": int64(0),
"return_unroutable_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_queue",
map[string]string{
"auto_delete": "false",
"durable": "false",
"node": "rabbit@rmqserver",
"queue": "39fd2caf-63e5-41e3-c15a-ba8fa11434b2",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"consumers": int64(1),
"consumer_utilisation": float64(1.0),
"memory": int64(15840),
"message_bytes": int64(0),
"message_bytes_ready": int64(0),
"message_bytes_unacked": int64(0),
"message_bytes_ram": int64(0),
"message_bytes_persist": int64(0),
"messages": int64(0),
"messages_ready": int64(0),
"messages_unack": int64(0),
"messages_ack": int64(180),
"messages_ack_rate": float64(0.0),
"messages_deliver": int64(180),
"messages_deliver_rate": float64(0.0),
"messages_deliver_get": int64(180),
"messages_deliver_get_rate": float64(0.0),
"messages_publish": int64(180),
"messages_publish_rate": float64(0.0),
"messages_redeliver": int64(0),
"messages_redeliver_rate": float64(0.0),
"idle_since": "2021-06-28 15:54:14",
"slave_nodes": int64(0),
"synchronised_slave_nodes": int64(0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_queue",
map[string]string{
"auto_delete": "false",
"durable": "false",
"node": "rabbit@rmqserver",
"queue": "39fd2cb4-aa2d-c08b-457a-62d0893523a1",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"consumers": int64(1),
"consumer_utilisation": float64(1.0),
"memory": int64(15600),
"message_bytes": int64(0),
"message_bytes_ready": int64(0),
"message_bytes_unacked": int64(0),
"message_bytes_ram": int64(0),
"message_bytes_persist": int64(0),
"messages": int64(0),
"messages_ready": int64(0),
"messages_unack": int64(0),
"messages_ack": int64(177),
"messages_ack_rate": float64(0.0),
"messages_deliver": int64(177),
"messages_deliver_rate": float64(0.0),
"messages_deliver_get": int64(177),
"messages_deliver_get_rate": float64(0.0),
"messages_publish": int64(177),
"messages_publish_rate": float64(0.0),
"messages_redeliver": int64(0),
"messages_redeliver_rate": float64(0.0),
"idle_since": "2021-06-28 15:54:14",
"slave_nodes": int64(0),
"synchronised_slave_nodes": int64(0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_queue",
map[string]string{
"auto_delete": "false",
"durable": "false",
"node": "rabbit@rmqserver",
"queue": "39fd2cb5-3820-e01b-6e20-ba29d5553fc3",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"consumers": int64(1),
"consumer_utilisation": float64(1.0),
"memory": int64(15584),
"message_bytes": int64(0),
"message_bytes_ready": int64(0),
"message_bytes_unacked": int64(0),
"message_bytes_ram": int64(0),
"message_bytes_persist": int64(0),
"messages": int64(0),
"messages_ready": int64(0),
"messages_unack": int64(0),
"messages_ack": int64(175),
"messages_ack_rate": float64(0.0),
"messages_deliver": int64(175),
"messages_deliver_rate": float64(0.0),
"messages_deliver_get": int64(175),
"messages_deliver_get_rate": float64(0.0),
"messages_publish": int64(175),
"messages_publish_rate": float64(0.0),
"messages_redeliver": int64(0),
"messages_redeliver_rate": float64(0.0),
"idle_since": "2021-06-28 15:54:15",
"slave_nodes": int64(0),
"synchronised_slave_nodes": int64(0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_node",
map[string]string{
"node": "rabbit@rmqserver",
"url": ts.URL,
},
map[string]interface{}{
"disk_free": int64(25086496768),
"disk_free_limit": int64(50000000),
"disk_free_alarm": int64(0),
"fd_total": int64(65536),
"fd_used": int64(78),
"mem_limit": int64(1717546188),
"mem_used": int64(387645440),
"mem_alarm": int64(0),
"proc_total": int64(1048576),
"proc_used": int64(1128),
"run_queue": int64(1),
"sockets_total": int64(58893),
"sockets_used": int64(43),
"uptime": int64(4150152129),
"running": int64(1),
"mnesia_disk_tx_count": int64(103),
"mnesia_ram_tx_count": int64(2257),
"mnesia_disk_tx_count_rate": float64(0.0),
"mnesia_ram_tx_count_rate": float64(0.0),
"gc_num": int64(329526389),
"gc_bytes_reclaimed": int64(13660012170840),
"gc_num_rate": float64(125.2),
"gc_bytes_reclaimed_rate": float64(6583379.2),
"io_read_avg_time": float64(0.0),
"io_read_avg_time_rate": float64(0.0),
"io_read_bytes": int64(1),
"io_read_bytes_rate": float64(0.0),
"io_write_avg_time": float64(0.0),
"io_write_avg_time_rate": float64(0.0),
"io_write_bytes": int64(193066),
"io_write_bytes_rate": float64(0.0),
"mem_connection_readers": int64(1246768),
"mem_connection_writers": int64(72108),
"mem_connection_channels": int64(308588),
"mem_connection_other": int64(4883596),
"mem_queue_procs": int64(780996),
"mem_queue_slave_procs": int64(0),
"mem_plugins": int64(11932828),
"mem_other_proc": int64(39203520),
"mem_metrics": int64(626932),
"mem_mgmt_db": int64(3341264),
"mem_mnesia": int64(396016),
"mem_other_ets": int64(3771384),
"mem_binary": int64(209324208),
"mem_msg_index": int64(32648),
"mem_code": int64(32810827),
"mem_atom": int64(1458513),
"mem_other_system": int64(14284124),
"mem_allocated_unused": int64(61026048),
"mem_reserved_unallocated": int64(0),
"mem_total": int64(385548288),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "false",
"durable": "true",
"exchange": "",
"internal": "false",
"type": "direct",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(284725),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(284572),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "false",
"durable": "true",
"exchange": "amq.direct",
"internal": "false",
"type": "direct",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(0),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(0),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "false",
"durable": "true",
"exchange": "amq.fanout",
"internal": "false",
"type": "fanout",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(0),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(0),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "false",
"durable": "true",
"exchange": "amq.headers",
"internal": "false",
"type": "headers",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(0),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(0),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "false",
"durable": "true",
"exchange": "amq.match",
"internal": "false",
"type": "headers",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(0),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(0),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "false",
"durable": "true",
"exchange": "amq.rabbitmq.trace",
"internal": "true",
"type": "topic",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(0),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(0),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "false",
"durable": "true",
"exchange": "amq.topic",
"internal": "false",
"type": "topic",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(0),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(0),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
testutil.MustMetric("rabbitmq_exchange",
map[string]string{
"auto_delete": "true",
"durable": "false",
"exchange": "Exchange",
"internal": "false",
"type": "topic",
"url": ts.URL,
"vhost": "/",
},
map[string]interface{}{
"messages_publish_in": int64(18006),
"messages_publish_in_rate": float64(0.0),
"messages_publish_out": int64(60798),
"messages_publish_out_rate": float64(0.0),
},
time.Unix(0, 0),
),
}
expectedErrors := []error{
errors.New("error response trying to get \"/api/federation-links\": \"Object Not Found\" (reason: \"Not Found\")"),
}
// Run the test
plugin := &RabbitMQ{
URL: ts.URL,
Log: testutil.Logger{},
}
require.NoError(t, plugin.Init())
acc := &testutil.Accumulator{}
require.NoError(t, plugin.Gather(acc))
acc.Wait(len(expected))
require.Len(t, acc.Errors, len(expectedErrors))
require.ElementsMatch(t, expectedErrors, acc.Errors)
testutil.RequireMetricsEqual(t, expected, acc.GetTelegrafMetrics(), testutil.IgnoreTime(), testutil.SortMetrics())
}
func TestRabbitMQMetricFilerts(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprintf("unknown path %q", r.URL.Path), http.StatusNotFound)
}))
defer ts.Close()
metricErrors := map[string]error{
"exchange": errors.New("getting \"/api/exchanges\" failed: 404 Not Found"),
"federation": errors.New("getting \"/api/federation-links\" failed: 404 Not Found"),
"node": errors.New("getting \"/api/nodes\" failed: 404 Not Found"),
"overview": errors.New("getting \"/api/overview\" failed: 404 Not Found"),
"queue": errors.New("getting \"/api/queues\" failed: 404 Not Found"),
}
// Include test
for name, expected := range metricErrors {
plugin := &RabbitMQ{
URL: ts.URL,
Log: testutil.Logger{},
MetricInclude: []string{name},
}
require.NoError(t, plugin.Init())
acc := &testutil.Accumulator{}
require.NoError(t, plugin.Gather(acc))
require.Len(t, acc.Errors, 1)
require.ElementsMatch(t, []error{expected}, acc.Errors)
}
// Exclude test
for name := range metricErrors {
// Exclude the current metric error from the list of expected errors
var expected []error
for n, e := range metricErrors {
if n != name {
expected = append(expected, e)
}
}
plugin := &RabbitMQ{
URL: ts.URL,
Log: testutil.Logger{},
MetricExclude: []string{name},
}
require.NoError(t, plugin.Init())
acc := &testutil.Accumulator{}
require.NoError(t, plugin.Gather(acc))
require.Len(t, acc.Errors, len(expected))
require.ElementsMatch(t, expected, acc.Errors)
}
}

View file

@ -0,0 +1,50 @@
# Reads metrics from RabbitMQ servers via the Management Plugin
[[inputs.rabbitmq]]
## Management Plugin url. (default: http://localhost:15672)
# url = "http://localhost:15672"
## Credentials
# username = "guest"
# password = "guest"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
## Optional request timeouts
##
## ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait
## for a server's response headers after fully writing the request.
# header_timeout = "3s"
##
## client_timeout specifies a time limit for requests made by this client.
## Includes connection time, any redirects, and reading the response body.
# client_timeout = "4s"
## A list of nodes to gather as the rabbitmq_node measurement. If not
## specified, metrics for all nodes are gathered.
# nodes = ["rabbit@node1", "rabbit@node2"]
## A list of exchanges to gather as the rabbitmq_exchange measurement. If not
## specified, metrics for all exchanges are gathered.
# exchanges = ["telegraf"]
## Metrics to include and exclude. Globs accepted.
## Note that an empty array for both will include all metrics
## Currently the following metrics are supported: "exchange", "federation", "node", "overview", "queue"
# metric_include = []
# metric_exclude = []
## Queues to include and exclude. Globs accepted.
## Note that an empty array for both will include all queues
# queue_name_include = []
# queue_name_exclude = []
## Federation upstreams to include and exclude specified as an array of glob
## pattern strings. Federation links can also be limited by the queue and
## exchange filters.
# federation_upstream_include = []
# federation_upstream_exclude = []

View file

@ -0,0 +1,22 @@
[
{
"message_stats": {
"publish_in_details": {
"rate": 3.2
},
"publish_in": 3678,
"publish_out_details": {
"rate": 5.1
},
"publish_out": 3677
},
"user_who_performed_action": "mistral_testuser_1",
"arguments": {},
"internal": false,
"auto_delete": true,
"durable": false,
"type": "direct",
"vhost": "sorandomsorandom",
"name": "reply_a716f0523cd44941ad2ea6ce4a3869c3"
}
]

View file

@ -0,0 +1,63 @@
[
{
"node": "rabbit@rmqlocal",
"queue": "exampleLocalQueue",
"upstream_queue": "exampleUpstreamQueue",
"type": "queue",
"vhost": "/",
"upstream": "ExampleFederationUpstream",
"id": "8ba5218f",
"status": "running",
"local_connection": "<rabbit@somehost>",
"uri": "amqp://appsv03",
"timestamp": "2019-08-19 15:34:15",
"local_channel": {
"acks_uncommitted": 1,
"confirm": true,
"connection_details": {
"name": "<rabbit@somehost>",
"peer_host": "undefined",
"peer_port": "undefined"
},
"consumer_count": 2,
"garbage_collection": {
"fullsweep_after": 65535,
"max_heap_size": 0,
"min_bin_vheap_size": 46422,
"min_heap_size": 233,
"minor_gcs": 203
},
"global_prefetch_count": 0,
"message_stats": {
"confirm": 67,
"confirm_details": {
"rate": 2
},
"publish": 890,
"publish_details": {
"rate": 2
},
"return_unroutable": 1,
"return_unroutable_details": {
"rate": 0.1
}
},
"messages_unacknowledged": 3,
"messages_uncommitted": 4,
"messages_unconfirmed": 5,
"name": "<rabbit@somehost>",
"node": "rabbit@rmqlocal",
"number": 1,
"prefetch_count": 0,
"reductions": 1926653,
"reductions_details": {
"rate": 1068
},
"state": "running",
"transactional": false,
"user": "none",
"user_who_performed_action": "none",
"vhost": "sorandomsorandom"
}
}
]

View file

@ -0,0 +1,24 @@
{
"memory": {
"connection_readers": 1234,
"connection_writers": 5678,
"connection_channels": 1133,
"connection_other": 2840,
"queue_procs": 2840,
"queue_slave_procs": 0,
"plugins": 1755976,
"other_proc": 23056584,
"metrics": 196536,
"mgmt_db": 491272,
"mnesia": 115600,
"other_ets": 2121872,
"binary": 418848,
"msg_index": 42848,
"code": 25179322,
"atom": 1041593,
"other_system": 14741981,
"allocated_unused": 38208528,
"reserved_unallocated": 0,
"total": 83025920
}
}

View file

@ -0,0 +1,87 @@
[
{
"db_dir": "/var/lib/rabbitmq/mnesia/rabbit@vagrant-ubuntu-trusty-64",
"disk_free": 3776,
"disk_free_alarm": false,
"disk_free_details": {
"rate": 0.0
},
"disk_free_limit": 50000000,
"enabled_plugins": [
"rabbitmq_management"
],
"gc_num": 57280132,
"gc_num_details": {
"rate": 274.2
},
"gc_bytes_reclaimed": 2533,
"gc_bytes_reclaimed_details": {
"rate": 16490856.3
},
"fd_total": 1024,
"fd_used": 63,
"fd_used_details": {
"rate": 0.0
},
"io_read_avg_time": 983,
"io_read_avg_time_details": {
"rate": 88.77
},
"io_read_bytes": 1111,
"io_read_bytes_details": {
"rate": 99.99
},
"io_read_count": 1,
"io_read_count_details": {
"rate": 0.0
},
"io_sync_avg_time": 0,
"io_sync_avg_time_details": {
"rate": 0.0
},
"io_write_avg_time": 134,
"io_write_avg_time_details": {
"rate": 4.32
},
"io_write_bytes": 823,
"io_write_bytes_details": {
"rate": 32.8
},
"log_file": "/var/log/rabbitmq/rabbit@vagrant-ubuntu-trusty-64.log",
"mem_alarm": true,
"mem_limit": 2503,
"mem_used": 159707080,
"mem_used_details": {
"rate": 15185.6
},
"mnesia_disk_tx_count": 16,
"mnesia_disk_tx_count_details": {
"rate": 1.1
},
"mnesia_ram_tx_count": 296,
"mnesia_ram_tx_count_details": {
"rate": 2.2
},
"name": "rabbit@vagrant-ubuntu-trusty-64",
"net_ticktime": 60,
"os_pid": "14244",
"partitions": [],
"proc_total": 1048576,
"proc_used": 783,
"proc_used_details": {
"rate": 0.0
},
"processors": 1,
"rates_mode": "basic",
"run_queue": 0,
"running": true,
"sasl_log_file": "/var/log/rabbitmq/rabbit@vagrant-ubuntu-trusty-64-sasl.log",
"sockets_total": 829,
"sockets_used": 45,
"sockets_used_details": {
"rate": 0.0
},
"type": "disc",
"uptime": 7464827
}
]

View file

@ -0,0 +1,63 @@
{
"message_stats": {
"ack": 5246,
"ack_details": {
"rate": 0.0
},
"deliver": 5234,
"deliver_details": {
"rate": 0.0
},
"deliver_get": 3333,
"deliver_get_details": {
"rate": 0.0
},
"publish": 5258,
"publish_details": {
"rate": 0.0
},
"return_unroutable": 10,
"return_unroutable_details": {
"rate": 3.3
}
},
"object_totals": {
"channels": 44,
"connections": 44,
"consumers": 65,
"exchanges": 43,
"queues": 62
},
"queue_totals": {
"messages": 5,
"messages_details": {
"rate": 0.0
},
"messages_ready": 32,
"messages_ready_details": {
"rate": 0.0
},
"messages_unacknowledged": 27,
"messages_unacknowledged_details": {
"rate": 0.0
}
},
"listeners": [
{
"name": "rabbit@node-a",
"protocol": "amqp"
},
{
"name": "rabbit@node-b",
"protocol": "amqp"
},
{
"name": "rabbit@node-a",
"protocol": "clustering"
},
{
"name": "rabbit@node-b",
"protocol": "clustering"
}
]
}

View file

@ -0,0 +1,120 @@
[
{
"messages_details": {
"rate": 0.0
},
"messages": 44,
"messages_unacknowledged_details": {
"rate": 0.0
},
"messages_unacknowledged": 44,
"messages_ready_details": {
"rate": 0.0
},
"messages_ready": 32,
"reductions_details": {
"rate": 223.0
},
"reductions": 15875433,
"message_stats": {
"deliver_get_details": {
"rate": 0.2
},
"deliver_get": 3457,
"ack_details": {
"rate": 9.9
},
"ack": 3457,
"redeliver_details": {
"rate": 2.5
},
"redeliver": 33,
"deliver_no_ack_details": {
"rate": 0.0
},
"deliver_no_ack": 0,
"deliver_details": {
"rate": 333.4
},
"deliver": 22222,
"get_no_ack_details": {
"rate": 0.0
},
"get_no_ack": 0,
"get_details": {
"rate": 0.0
},
"get": 0,
"publish_details": {
"rate": 11.2
},
"publish": 3457
},
"node": "rabbit@rmqlocal-0.rmqlocal.ankorabbitstatefulset3.svc.cluster.local",
"arguments": {
"x-expires": 1800000,
"x-ha-policy": "all"
},
"exclusive": false,
"auto_delete": false,
"durable": false,
"vhost": "sorandomsorandom",
"name": "reply_a716f0523cd44941ad2ea6ce4a3869c3",
"message_bytes_paged_out": 0,
"messages_paged_out": 0,
"idle_since": "2015-11-01 8:22:14",
"backing_queue_status": {
"avg_ack_egress_rate": 0.2374460025857711,
"avg_ack_ingress_rate": 0.2374460025857711,
"avg_egress_rate": 0.2374460025857711,
"avg_ingress_rate": 0.2374460025857711,
"delta": [
"delta",
"undefined",
0,
0,
"undefined"
],
"len": 0,
"mode": "default",
"next_seq_id": 3457,
"q1": 0,
"q2": 0,
"q3": 0,
"q4": 0,
"target_ram_count": 0
},
"head_message_timestamp": 1446362534,
"message_bytes_persistent": 7,
"message_bytes_ram": 6,
"message_bytes_unacknowledged": 5,
"message_bytes_ready": 4,
"message_bytes": 3,
"messages_persistent": 0,
"messages_unacknowledged_ram": 0,
"messages_ready_ram": 0,
"messages_ram": 0,
"garbage_collection": {
"minor_gcs": 314,
"fullsweep_after": 65535,
"min_heap_size": 233,
"min_bin_vheap_size": 46422,
"max_heap_size": 0
},
"state": "running",
"recoverable_slaves": null,
"memory": 143776,
"consumer_utilisation": 1.0,
"consumers": 3,
"exclusive_consumer_tag": null,
"effective_policy_definition": [],
"operator_policy": null,
"policy": null,
"slave_nodes":[
"rabbit@ip-10-1-2-118"
],
"synchronised_slave_nodes":[
"rabbit@ip-10-1-2-118"
]
}
]

View file

@ -0,0 +1,104 @@
[
{
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": false,
"message_stats": {
"publish_in": 284725,
"publish_in_details": {
"rate": 0
},
"publish_out": 284572,
"publish_out_details": {
"rate": 0
}
},
"name": "",
"type": "direct",
"user_who_performed_action": "rmq-internal",
"vhost": "/"
},
{
"arguments": {
"x-expires": 300000
},
"auto_delete": true,
"durable": false,
"internal": false,
"message_stats": {
"publish_in": 18006,
"publish_in_details": {
"rate": 0
},
"publish_out": 60798,
"publish_out_details": {
"rate": 0
}
},
"name": "Exchange",
"type": "topic",
"user_who_performed_action": "user",
"vhost": "/"
},
{
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": false,
"name": "amq.direct",
"type": "direct",
"user_who_performed_action": "rmq-internal",
"vhost": "/"
},
{
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": false,
"name": "amq.fanout",
"type": "fanout",
"user_who_performed_action": "rmq-internal",
"vhost": "/"
},
{
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": false,
"name": "amq.headers",
"type": "headers",
"user_who_performed_action": "rmq-internal",
"vhost": "/"
},
{
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": false,
"name": "amq.match",
"type": "headers",
"user_who_performed_action": "rmq-internal",
"vhost": "/"
},
{
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": true,
"name": "amq.rabbitmq.trace",
"type": "topic",
"user_who_performed_action": "rmq-internal",
"vhost": "/"
},
{
"arguments": {},
"auto_delete": false,
"durable": true,
"internal": false,
"name": "amq.topic",
"type": "topic",
"user_who_performed_action": "rmq-internal",
"vhost": "/"
}
]

View file

@ -0,0 +1 @@
{"error":"Object Not Found","reason":"Not Found"}

View file

@ -0,0 +1,31 @@
{
"memory": {
"connection_readers": 1246768,
"connection_writers": 72108,
"connection_channels": 308588,
"connection_other": 4883596,
"queue_procs": 780996,
"queue_slave_procs": 0,
"quorum_queue_procs": 0,
"plugins": 11932828,
"other_proc": 39203520,
"metrics": 626932,
"mgmt_db": 3341264,
"mnesia": 396016,
"quorum_ets": 47920,
"other_ets": 3771384,
"binary": 209324208,
"msg_index": 32648,
"code": 32810827,
"atom": 1458513,
"other_system": 14284124,
"allocated_unused": 61026048,
"reserved_unallocated": 0,
"strategy": "rss",
"total": {
"erlang": 324522240,
"rss": 385548288,
"allocated": 385548288
}
}
}

View file

@ -0,0 +1,417 @@
[
{
"partitions": [],
"os_pid": "8268",
"fd_total": 65536,
"sockets_total": 58893,
"mem_limit": 1717546188,
"mem_alarm": false,
"disk_free_limit": 50000000,
"disk_free_alarm": false,
"proc_total": 1048576,
"rates_mode": "basic",
"uptime": 4150152129,
"run_queue": 1,
"processors": 4,
"exchange_types": [
{
"name": "topic",
"description": "AMQP topic exchange, as per the AMQP specification",
"enabled": true
},
{
"name": "fanout",
"description": "AMQP fanout exchange, as per the AMQP specification",
"enabled": true
},
{
"name": "direct",
"description": "AMQP direct exchange, as per the AMQP specification",
"enabled": true
},
{
"name": "headers",
"description": "AMQP headers exchange, as per the AMQP specification",
"enabled": true
}
],
"auth_mechanisms": [
{
"name": "PLAIN",
"description": "SASL PLAIN authentication mechanism",
"enabled": true
},
{
"name": "AMQPLAIN",
"description": "QPid AMQPLAIN mechanism",
"enabled": true
},
{
"name": "RABBIT-CR-DEMO",
"description": "RabbitMQ Demo challenge-response authentication mechanism",
"enabled": false
}
],
"applications": [
{
"name": "amqp_client",
"description": "RabbitMQ AMQP Client",
"version": "3.8.14"
},
{
"name": "asn1",
"description": "The Erlang ASN1 compiler version 5.0.14",
"version": "5.0.14"
},
{
"name": "aten",
"description": "Erlang node failure detector",
"version": "0.5.5"
},
{
"name": "compiler",
"description": "ERTS CXC 138 10",
"version": "7.6.6"
},
{
"name": "cowboy",
"description": "Small, fast, modern HTTP server.",
"version": "2.8.0"
},
{
"name": "cowlib",
"description": "Support library for manipulating Web protocols.",
"version": "2.9.1"
},
{
"name": "credentials_obfuscation",
"description": "Helper library that obfuscates sensitive values in process state",
"version": "2.4.0"
},
{
"name": "crypto",
"description": "CRYPTO",
"version": "4.8.3"
},
{
"name": "cuttlefish",
"description": "cuttlefish configuration abstraction",
"version": "2.6.0"
},
{
"name": "gen_batch_server",
"description": "Generic batching server",
"version": "0.8.4"
},
{
"name": "goldrush",
"description": "Erlang event stream processor",
"version": "0.1.9"
},
{
"name": "inets",
"description": "INETS CXC 138 49",
"version": "7.3.2"
},
{
"name": "jsx",
"description": "a streaming, evented json parsing toolkit",
"version": "2.11.0"
},
{
"name": "kernel",
"description": "ERTS CXC 138 10",
"version": "7.2.1"
},
{
"name": "lager",
"description": "Erlang logging framework",
"version": "3.8.2"
},
{
"name": "mnesia",
"description": "MNESIA CXC 138 12",
"version": "4.18.1"
},
{
"name": "observer_cli",
"description": "Visualize Erlang Nodes On The Command Line",
"version": "1.6.1"
},
{
"name": "os_mon",
"description": "CPO CXC 138 46",
"version": "2.6.1"
},
{
"name": "public_key",
"description": "Public key infrastructure",
"version": "1.9.2"
},
{
"name": "ra",
"description": "Raft library",
"version": "1.1.8"
},
{
"name": "rabbit",
"description": "RabbitMQ",
"version": "3.8.14"
},
{
"name": "rabbit_common",
"description": "Modules shared by rabbitmq-server and rabbitmq-erlang-client",
"version": "3.8.14"
},
{
"name": "rabbitmq_management",
"description": "RabbitMQ Management Console",
"version": "3.8.14"
},
{
"name": "rabbitmq_management_agent",
"description": "RabbitMQ Management Agent",
"version": "3.8.14"
},
{
"name": "rabbitmq_prelaunch",
"description": "RabbitMQ prelaunch setup",
"version": "3.8.14"
},
{
"name": "rabbitmq_web_dispatch",
"description": "RabbitMQ Web Dispatcher",
"version": "3.8.14"
},
{
"name": "ranch",
"description": "Socket acceptor pool for TCP protocols.",
"version": "1.7.1"
},
{
"name": "recon",
"description": "Diagnostic tools for production use",
"version": "2.5.1"
},
{
"name": "sasl",
"description": "SASL CXC 138 11",
"version": "4.0.1"
},
{
"name": "ssl",
"description": "Erlang/OTP SSL application",
"version": "10.2.4"
},
{
"name": "stdlib",
"description": "ERTS CXC 138 10",
"version": "3.14"
},
{
"name": "stdout_formatter",
"description": "Tools to format paragraphs, lists and tables as plain text",
"version": "0.2.4"
},
{
"name": "syntax_tools",
"description": "Syntax tools",
"version": "2.4"
},
{
"name": "sysmon_handler",
"description": "Rate-limiting system_monitor event handler",
"version": "1.3.0"
},
{
"name": "tools",
"description": "DEVTOOLS CXC 138 16",
"version": "3.4.3"
},
{
"name": "xmerl",
"description": "XML parser",
"version": "1.3.26"
}
],
"contexts": [
{
"description": "RabbitMQ Management",
"path": "/",
"cowboy_opts": "[{sendfile,false}]",
"port": "15672"
}
],
"log_files": [
"c:/Users/user/AppData/Roaming/RabbitMQ/log/rabbit@rmqserver.log",
"c:/Users/user/AppData/Roaming/RabbitMQ/log/rabbit@rmqserver_upgrade.log"
],
"db_dir": "c:/Users/user/AppData/Roaming/RabbitMQ/db/rabbit@rmqserver-mnesia",
"config_files": [
"c:/Users/user/AppData/Roaming/RabbitMQ/advanced.config"
],
"net_ticktime": 60,
"enabled_plugins": [
"rabbitmq_management"
],
"mem_calculation_strategy": "rss",
"ra_open_file_metrics": {
"ra_log_wal": 1,
"ra_log_segment_writer": 0
},
"name": "rabbit@rmqserver",
"type": "disc",
"running": true,
"mem_used": 387645440,
"mem_used_details": {
"rate": 419430.4
},
"fd_used": 78,
"fd_used_details": {
"rate": 0
},
"sockets_used": 43,
"sockets_used_details": {
"rate": 0
},
"proc_used": 1128,
"proc_used_details": {
"rate": 0
},
"disk_free": 25086496768,
"disk_free_details": {
"rate": -118784
},
"gc_num": 329526389,
"gc_num_details": {
"rate": 125.2
},
"gc_bytes_reclaimed": 13660012170840,
"gc_bytes_reclaimed_details": {
"rate": 6583379.2
},
"context_switches": 974149754,
"context_switches_details": {
"rate": 270
},
"io_read_count": 1,
"io_read_count_details": {
"rate": 0
},
"io_read_bytes": 1,
"io_read_bytes_details": {
"rate": 0
},
"io_read_avg_time": 0,
"io_read_avg_time_details": {
"rate": 0
},
"io_write_count": 45,
"io_write_count_details": {
"rate": 0
},
"io_write_bytes": 193066,
"io_write_bytes_details": {
"rate": 0
},
"io_write_avg_time": 0,
"io_write_avg_time_details": {
"rate": 0
},
"io_sync_count": 45,
"io_sync_count_details": {
"rate": 0
},
"io_sync_avg_time": 0,
"io_sync_avg_time_details": {
"rate": 0
},
"io_seek_count": 31,
"io_seek_count_details": {
"rate": 0
},
"io_seek_avg_time": 0,
"io_seek_avg_time_details": {
"rate": 0
},
"io_reopen_count": 0,
"io_reopen_count_details": {
"rate": 0
},
"mnesia_ram_tx_count": 2257,
"mnesia_ram_tx_count_details": {
"rate": 0
},
"mnesia_disk_tx_count": 103,
"mnesia_disk_tx_count_details": {
"rate": 0
},
"msg_store_read_count": 0,
"msg_store_read_count_details": {
"rate": 0
},
"msg_store_write_count": 1,
"msg_store_write_count_details": {
"rate": 0
},
"queue_index_journal_write_count": 165,
"queue_index_journal_write_count_details": {
"rate": 0
},
"queue_index_write_count": 0,
"queue_index_write_count_details": {
"rate": 0
},
"queue_index_read_count": 0,
"queue_index_read_count_details": {
"rate": 0
},
"io_file_handle_open_attempt_count": 882,
"io_file_handle_open_attempt_count_details": {
"rate": 0
},
"io_file_handle_open_attempt_avg_time": 0.05442176870748299,
"io_file_handle_open_attempt_avg_time_details": {
"rate": 0
},
"connection_created": 2310,
"connection_created_details": {
"rate": 0
},
"connection_closed": 2268,
"connection_closed_details": {
"rate": 0
},
"channel_created": 2310,
"channel_created_details": {
"rate": 0
},
"channel_closed": 2267,
"channel_closed_details": {
"rate": 0
},
"queue_declared": 144281,
"queue_declared_details": {
"rate": 0
},
"queue_created": 663,
"queue_created_details": {
"rate": 0
},
"queue_deleted": 629,
"queue_deleted_details": {
"rate": 0
},
"cluster_links": [],
"metrics_gc_queue_length": {
"connection_closed": 0,
"channel_closed": 0,
"consumer_deleted": 0,
"exchange_deleted": 0,
"queue_deleted": 0,
"vhost_deleted": 0,
"node_node_deleted": 0,
"channel_consumer_deleted": 0
}
}
]

View file

@ -0,0 +1 @@
{"management_version":"3.8.14","rates_mode":"basic","sample_retention_policies":{"global":[600,3600,28800,86400],"basic":[600,3600],"detailed":[600]},"exchange_types":[{"name":"direct","description":"AMQP direct exchange, as per the AMQP specification","enabled":true},{"name":"fanout","description":"AMQP fanout exchange, as per the AMQP specification","enabled":true},{"name":"headers","description":"AMQP headers exchange, as per the AMQP specification","enabled":true},{"name":"topic","description":"AMQP topic exchange, as per the AMQP specification","enabled":true}],"product_version":"3.8.14","product_name":"RabbitMQ","rabbitmq_version":"3.8.14","cluster_name":"rabbit@rmqserver","erlang_version":"23.2.7","erlang_full_version":"Erlang/OTP 23 [erts-11.1.8] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]","disable_stats":false,"enable_queue_totals":false,"message_stats":{"ack":3736443,"ack_details":{"rate":0.0},"confirm":0,"confirm_details":{"rate":0.0},"deliver":3736446,"deliver_details":{"rate":0.0},"deliver_get":3736446,"deliver_get_details":{"rate":0.0},"deliver_no_ack":0,"deliver_no_ack_details":{"rate":0.0},"disk_reads":0,"disk_reads_details":{"rate":0.0},"disk_writes":55,"disk_writes_details":{"rate":0.0},"drop_unroutable":0,"drop_unroutable_details":{"rate":0.0},"get":0,"get_details":{"rate":0.0},"get_empty":0,"get_empty_details":{"rate":0.0},"get_no_ack":0,"get_no_ack_details":{"rate":0.0},"publish":770025,"publish_details":{"rate":0.0},"redeliver":1,"redeliver_details":{"rate":0.0},"return_unroutable":0,"return_unroutable_details":{"rate":0.0}},"churn_rates":{"channel_closed":2267,"channel_closed_details":{"rate":0.0},"channel_created":2310,"channel_created_details":{"rate":0.0},"connection_closed":2268,"connection_closed_details":{"rate":0.0},"connection_created":2310,"connection_created_details":{"rate":0.0},"queue_created":663,"queue_created_details":{"rate":0.0},"queue_declared":144281,"queue_declared_details":{"rate":0.0},"queue_deleted":629,"queue_deleted_details":{"rate":0.0}},"queue_totals":{"messages":30,"messages_details":{"rate":0.0},"messages_ready":30,"messages_ready_details":{"rate":0.0},"messages_unacknowledged":0,"messages_unacknowledged_details":{"rate":0.0}},"object_totals":{"channels":43,"connections":43,"consumers":37,"exchanges":8,"queues":34},"statistics_db_event_queue":0,"node":"rabbit@rmqserver","listeners":[{"node":"rabbit@rmqserver","protocol":"amqp","ip_address":"0.0.0.0","port":5672,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false}},{"node":"rabbit@rmqserver","protocol":"amqp","ip_address":"::","port":5672,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false}},{"node":"rabbit@rmqserver","protocol":"amqp/ssl","ip_address":"0.0.0.0","port":5671,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false,"versions":["tlsv1.3","tlsv1.2","tlsv1.1","tlsv1"],"cacertfile":"C:\\ProgramData\\Chain.pem","certfile":"C:\\ProgramData\\server.crt","keyfile":"C:\\ProgramData\\server.key","verify":"verify_peer","depth":3,"fail_if_no_peer_cert":false}},{"node":"rabbit@rmqserver","protocol":"amqp/ssl","ip_address":"::","port":5671,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false,"versions":["tlsv1.3","tlsv1.2","tlsv1.1","tlsv1"],"cacertfile":"C:\\ProgramData\\Chain.pem","certfile":"C:\\ProgramData\\server.crt","keyfile":"C:\\ProgramData\\server.key","verify":"verify_peer","depth":3,"fail_if_no_peer_cert":false}},{"node":"rabbit@rmqserver","protocol":"clustering","ip_address":"::","port":25672,"socket_opts":[]},{"node":"rabbit@rmqserver","protocol":"http","ip_address":"0.0.0.0","port":15672,"socket_opts":{"cowboy_opts":{"sendfile":false},"port":15672}},{"node":"rabbit@rmqserver","protocol":"http","ip_address":"::","port":15672,"socket_opts":{"cowboy_opts":{"sendfile":false},"port":15672}}],"contexts":[{"ssl_opts":[],"node":"rabbit@rmqserver","description":"RabbitMQ Management","path":"/","cowboy_opts":"[{sendfile,false}]","port":"15672"}]}

View file

@ -0,0 +1,356 @@
[
{
"arguments": {
"x-expires": 300000
},
"auto_delete": false,
"backing_queue_status": {
"avg_ack_egress_rate": 0,
"avg_ack_ingress_rate": 0,
"avg_egress_rate": 0,
"avg_ingress_rate": 0,
"delta": [
"delta",
"undefined",
0,
0,
"undefined"
],
"len": 0,
"mode": "default",
"next_seq_id": 180,
"q1": 0,
"q2": 0,
"q3": 0,
"q4": 0,
"target_ram_count": "infinity"
},
"consumer_capacity": 1,
"consumer_utilisation": 1,
"consumers": 1,
"durable": false,
"effective_policy_definition": {},
"exclusive": false,
"exclusive_consumer_tag": null,
"garbage_collection": {
"fullsweep_after": 65535,
"max_heap_size": 0,
"min_bin_vheap_size": 46422,
"min_heap_size": 233,
"minor_gcs": 16174
},
"head_message_timestamp": null,
"idle_since": "2021-06-28 15:54:14",
"memory": 15840,
"message_bytes": 0,
"message_bytes_paged_out": 0,
"message_bytes_persistent": 0,
"message_bytes_ram": 0,
"message_bytes_ready": 0,
"message_bytes_unacknowledged": 0,
"message_stats": {
"ack": 180,
"ack_details": {
"rate": 0
},
"deliver": 180,
"deliver_details": {
"rate": 0
},
"deliver_get": 180,
"deliver_get_details": {
"rate": 0
},
"deliver_no_ack": 0,
"deliver_no_ack_details": {
"rate": 0
},
"get": 0,
"get_details": {
"rate": 0
},
"get_empty": 0,
"get_empty_details": {
"rate": 0
},
"get_no_ack": 0,
"get_no_ack_details": {
"rate": 0
},
"publish": 180,
"publish_details": {
"rate": 0
},
"redeliver": 0,
"redeliver_details": {
"rate": 0
}
},
"messages": 0,
"messages_details": {
"rate": 0
},
"messages_paged_out": 0,
"messages_persistent": 0,
"messages_ram": 0,
"messages_ready": 0,
"messages_ready_details": {
"rate": 0
},
"messages_ready_ram": 0,
"messages_unacknowledged": 0,
"messages_unacknowledged_details": {
"rate": 0
},
"messages_unacknowledged_ram": 0,
"name": "39fd2caf-63e5-41e3-c15a-ba8fa11434b2",
"node": "rabbit@rmqserver",
"operator_policy": null,
"policy": null,
"recoverable_slaves": null,
"reductions": 11766294,
"reductions_details": {
"rate": 0
},
"single_active_consumer_tag": null,
"state": "running",
"type": "classic",
"vhost": "/"
},
{
"arguments": {
"x-expires": 300000
},
"auto_delete": false,
"backing_queue_status": {
"avg_ack_egress_rate": 0,
"avg_ack_ingress_rate": 0,
"avg_egress_rate": 0,
"avg_ingress_rate": 0,
"delta": [
"delta",
"undefined",
0,
0,
"undefined"
],
"len": 0,
"mode": "default",
"next_seq_id": 177,
"q1": 0,
"q2": 0,
"q3": 0,
"q4": 0,
"target_ram_count": "infinity"
},
"consumer_capacity": 1,
"consumer_utilisation": 1,
"consumers": 1,
"durable": false,
"effective_policy_definition": {},
"exclusive": false,
"exclusive_consumer_tag": null,
"garbage_collection": {
"fullsweep_after": 65535,
"max_heap_size": 0,
"min_bin_vheap_size": 46422,
"min_heap_size": 233,
"minor_gcs": 16205
},
"head_message_timestamp": null,
"idle_since": "2021-06-28 15:54:14",
"memory": 15600,
"message_bytes": 0,
"message_bytes_paged_out": 0,
"message_bytes_persistent": 0,
"message_bytes_ram": 0,
"message_bytes_ready": 0,
"message_bytes_unacknowledged": 0,
"message_stats": {
"ack": 177,
"ack_details": {
"rate": 0
},
"deliver": 177,
"deliver_details": {
"rate": 0
},
"deliver_get": 177,
"deliver_get_details": {
"rate": 0
},
"deliver_no_ack": 0,
"deliver_no_ack_details": {
"rate": 0
},
"get": 0,
"get_details": {
"rate": 0
},
"get_empty": 0,
"get_empty_details": {
"rate": 0
},
"get_no_ack": 0,
"get_no_ack_details": {
"rate": 0
},
"publish": 177,
"publish_details": {
"rate": 0
},
"redeliver": 0,
"redeliver_details": {
"rate": 0
}
},
"messages": 0,
"messages_details": {
"rate": 0
},
"messages_paged_out": 0,
"messages_persistent": 0,
"messages_ram": 0,
"messages_ready": 0,
"messages_ready_details": {
"rate": 0
},
"messages_ready_ram": 0,
"messages_unacknowledged": 0,
"messages_unacknowledged_details": {
"rate": 0
},
"messages_unacknowledged_ram": 0,
"name": "39fd2cb4-aa2d-c08b-457a-62d0893523a1",
"node": "rabbit@rmqserver",
"operator_policy": null,
"policy": null,
"recoverable_slaves": null,
"reductions": 11706656,
"reductions_details": {
"rate": 0
},
"single_active_consumer_tag": null,
"state": "running",
"type": "classic",
"vhost": "/"
},
{
"arguments": {
"x-expires": 300000
},
"auto_delete": false,
"backing_queue_status": {
"avg_ack_egress_rate": 0,
"avg_ack_ingress_rate": 0,
"avg_egress_rate": 0,
"avg_ingress_rate": 0,
"delta": [
"delta",
"undefined",
0,
0,
"undefined"
],
"len": 0,
"mode": "default",
"next_seq_id": 175,
"q1": 0,
"q2": 0,
"q3": 0,
"q4": 0,
"target_ram_count": "infinity"
},
"consumer_capacity": 1,
"consumer_utilisation": 1,
"consumers": 1,
"durable": false,
"effective_policy_definition": {},
"exclusive": false,
"exclusive_consumer_tag": null,
"garbage_collection": {
"fullsweep_after": 65535,
"max_heap_size": 0,
"min_bin_vheap_size": 46422,
"min_heap_size": 233,
"minor_gcs": 16183
},
"head_message_timestamp": null,
"idle_since": "2021-06-28 15:54:15",
"memory": 15584,
"message_bytes": 0,
"message_bytes_paged_out": 0,
"message_bytes_persistent": 0,
"message_bytes_ram": 0,
"message_bytes_ready": 0,
"message_bytes_unacknowledged": 0,
"message_stats": {
"ack": 175,
"ack_details": {
"rate": 0
},
"deliver": 175,
"deliver_details": {
"rate": 0
},
"deliver_get": 175,
"deliver_get_details": {
"rate": 0
},
"deliver_no_ack": 0,
"deliver_no_ack_details": {
"rate": 0
},
"get": 0,
"get_details": {
"rate": 0
},
"get_empty": 0,
"get_empty_details": {
"rate": 0
},
"get_no_ack": 0,
"get_no_ack_details": {
"rate": 0
},
"publish": 175,
"publish_details": {
"rate": 0
},
"redeliver": 0,
"redeliver_details": {
"rate": 0
}
},
"messages": 0,
"messages_details": {
"rate": 0
},
"messages_paged_out": 0,
"messages_persistent": 0,
"messages_ram": 0,
"messages_ready": 0,
"messages_ready_details": {
"rate": 0
},
"messages_ready_ram": 0,
"messages_unacknowledged": 0,
"messages_unacknowledged_details": {
"rate": 0
},
"messages_unacknowledged_ram": 0,
"name": "39fd2cb5-3820-e01b-6e20-ba29d5553fc3",
"node": "rabbit@rmqserver",
"operator_policy": null,
"policy": null,
"recoverable_slaves": null,
"reductions": 11649471,
"reductions_details": {
"rate": 0
},
"single_active_consumer_tag": null,
"state": "running",
"type": "classic",
"vhost": "/"
}
]