Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when I connect telegraf to 3rd party RabbitMQ. Unnecessary condition for Listeners #9300

Closed
Levarix opened this issue May 25, 2021 · 3 comments · Fixed by #9315
Closed

Comments

@Levarix
Copy link

Levarix commented May 25, 2021

I have access to RabbitMQ from 3rd party and I guess not full. It's important to monitor queues to which I have access, but when I connect telegraf to the cluster I'm getting Wrong answer from rabbitmq. Probably auth issue error which is problematic because we monitor any error with it.

Condition:

if overview.QueueTotals == nil || overview.ObjectTotals == nil || overview.MessageStats == nil || overview.Listeners == nil {
acc.AddError(fmt.Errorf("Wrong answer from rabbitmq. Probably auth issue"))
return
}

As you can see from my snippet of JSON file from api/overview I don't have in it Listeners so conditional is true and the plugin writes in my output the error. I think it's an unnecessary condition for Listeners or maybe you can add an option in the plugin configuration for skipping it.

{
  "management_version": "3.8.5",
  "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
    },
    {
      "name": "x-consistent-hash",
      "description": "Consistent Hashing Exchange",
      "enabled": true
    },
    {
      "name": "x-federation-upstream",
      "description": "Federation upstream helper exchange",
      "internal_purpose": "federation",
      "enabled": true
    }
  ],
  "product_version": "3.8.5",
  "product_name": "RabbitMQ",
  "rabbitmq_version": "3.8.5",
  "cluster_name": "<sensitive>",
  "erlang_version": "23.1",
  "erlang_full_version": "Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:64]",
  "disable_stats": false,
  "enable_queue_totals": false,
  "message_stats": {
    "ack": 52335,
    "ack_details": {
      "rate": 0.0
    },
    "confirm": 0,
    "confirm_details": {
      "rate": 0.0
    },
    "deliver": 54947,
    "deliver_details": {
      "rate": 0.0
    },
    "deliver_get": 54947,
    "deliver_get_details": {
      "rate": 0.0
    },
    "deliver_no_ack": 0,
    "deliver_no_ack_details": {
      "rate": 0.0
    },
    "disk_reads": 5992,
    "disk_reads_details": {
      "rate": 0.0
    },
    "disk_writes": 78112,
    "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": 6627,
    "publish_details": {
      "rate": 0.0
    },
    "redeliver": 3,
    "redeliver_details": {
      "rate": 0.0
    },
    "return_unroutable": 0,
    "return_unroutable_details": {
      "rate": 0.0
    }
  },
  "churn_rates": {
    "channel_closed": 262895,
    "channel_closed_details": {
      "rate": 0.0
    },
    "channel_created": 263045,
    "channel_created_details": {
      "rate": 0.0
    },
    "connection_closed": 162401,
    "connection_closed_details": {
      "rate": 0.0
    },
    "connection_created": 53318,
    "connection_created_details": {
      "rate": 0.0
    },
    "queue_created": 3447,
    "queue_created_details": {
      "rate": 0.0
    },
    "queue_declared": 76230,
    "queue_declared_details": {
      "rate": 0.0
    },
    "queue_deleted": 3267,
    "queue_deleted_details": {
      "rate": 0.0
    }
  },
  "queue_totals": {
    "messages": 1045,
    "messages_details": {
      "rate": 0.0
    },
    "messages_ready": 1045,
    "messages_ready_details": {
      "rate": 0.0
    },
    "messages_unacknowledged": 0,
    "messages_unacknowledged_details": {
      "rate": 0.0
    }
  },
  "object_totals": {
    "channels": 49,
    "connections": 17,
    "exchanges": 10,
    "queues": 34
  },
  "statistics_db_event_queue": 0
}
@reimda
Copy link
Contributor

reimda commented May 27, 2021

Hi @Levarix. It doesn't look like Listeners is always returned so it seems reasonable that it shouldn't generate an error.

@askainet You wrote this code a few years ago. What do you think about us removing || overview.Listeners == nil from line 411? Is it really an error condition?

@askainet
Copy link
Contributor

I think it's fine to just remove the Listeners condition from that check. If some implementations don't report listeners, this shouldn't be an error, and the count will be reported as 0.

@Levarix
Copy link
Author

Levarix commented May 28, 2021

Thanks for the fast answer. When can I expect a fix? I need the information to decide if work on a workaround or can wait for new version @reimda @askainet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants