jmal98 / sqs-exporter

A Prometheus Exporter for the Amazon Simple Queue Service (SQS)
Apache License 2.0
26 stars 28 forks source link

Sqs Queue name #7

Closed Dudesons closed 5 years ago

Dudesons commented 5 years ago

Hi,

I'm trying this export I have a problem on the queue detection. I want to set manually which queues are monitored. So I see the exporter support this environment variable: SQS_QUEUE_NAMES set to myQueue0,MyQueue1

But the exporter will fetch all queues ... When I remove all list queues capabilities the exporter doesn't return metrics

I don't understand why I have this isssue because when I'm reading the code:

String queueNames = System.getenv("SQS_QUEUE_NAMES");
String queueNamePrefix = System.getenv("SQS_QUEUE_NAME_PREFIX");
if (queueNames != null) {
   // find the URLs for the named queues .
   String[] names = queueNames.split(",");
   queueUrls = new ArrayList<String>();
   for(String name : names) {
       queueUrls.add(sqs.getQueueUrl(name).getQueueUrl());
   }
} else {
    // get URLs for all queues visible to this account (with prefix if specified)
    ListQueuesResult queues = sqs.listQueues(queueNamePrefix); //If null is passed in the whole                     unfiltered list is returned
    queueUrls = queues.getQueueUrls();
}

It seems the code enter in the else instead of the if or I miss something (I'm not java dev)

version: jmal98/sqs-exporter:0.0.5 iam policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1542622727660",
      "Action": [
        "sqs:GetQueueAttributes",
        "sqs:GetQueueUrl",
        "sqs:ListDeadLetterSourceQueues",
        "sqs:ListQueueTags",
        "sqs:ListQueues"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}

container logs:

19 Nov 2018 16:08:30,109 org.jmal98.metrics.collector.Sqs:44 AmazonSQS client is connected to region: (eu-west-1)
2018-11-19 16:08:31.964:INFO::main: Logging initialized @3733ms to org.eclipse.jetty.util.log.StdErrLog
2018-11-19 16:08:32.051:INFO:oejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-06-05T18:24:03.829Z; git: d5fc0523cfa96bfebfbda19606cad384d772f04c; jvm 1.8.0_171-b11
2018-11-19 16:08:32.112:INFO:oejs.AbstractConnector:main: Started ServerConnector@3574e198{HTTP/1.1,[http/1.1]}{0.0.0.0:9384}
2018-11-19 16:08:32.114:INFO:oejs.Server:main: Started @3882ms
19 Nov 2018 16:08:32,115 org.jmal98.sqs.exporter.Application:51 Exporter has started.
jmal98 commented 5 years ago

Hello,

I suspect that this is because the 0.0.5 version of the exporter does not contain these recent updates. I will create a 0.0.6 version within the hour.

Once created, can you re-try with 0.0.6?

Dudesons commented 5 years ago

Yes i'll try that :)

Le lun. 19 nov. 2018 19:25, Jamal notifications@github.com a écrit :

Hello,

I suspect that this is because the 0.0.5 version of the exporter does not contain these recent updates. I will create a 0.0.6 version within the hour.

Once created, can you re-try with 0.0.6?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jmal98/sqs-exporter/issues/7#issuecomment-439993247, or mute the thread https://github.com/notifications/unsubscribe-auth/ADp4jRFFNrMgkPmHX49bHOt8Zkhh9bgJks5uwvd7gaJpZM4YpgDy .

Dudesons commented 5 years ago

@jmal98 it works :) thank you