omni-lchen / zabbix-cloudwatch

71 stars 61 forks source link

Error when trying to get SNS data from CW #4

Closed maiconbaumx closed 7 years ago

maiconbaumx commented 7 years ago

Hello! I have a problem when I try to get SNS data from CloudWatch... This don't return anything when I use this command:

bash cron.d/cron.SNS.sh "<SNS-TOPIC>" "<ZABBIX-HOST>" "<ZABBIX-SERVER>" "<AWS-PROFILE>" "<AWS-REGION>"

And if I try to parse with awsLLD, this dont return any data...

python awsLLD.py -a "<AWS-PROFILE>" -r "<AWS-REGION>" -q "SNSTopics" -c "<SNS-TOPIC>"

{
    "data": []
}

It happens with any SNS topic in all AWS accounts that I have, no matter what I try to do.. I try to put some prints in code, trying to search what is my problem and aparently, when this action happens: nextToken = topicsResults['ListTopicsResponse']['ListTopicsResult']['NextToken'] my "nextToken" comes empty...

maiconbaumx commented 7 years ago

UPDATE

The same happens with SQS.

omni-lchen commented 7 years ago

You have to do some tweaks in the script to adapt to what you need, you need to modify the statement of re.search in the script, it checks the keyword in the name of SQS queues or SNS topics, for example, you have SQS names like app1-queue1, app1-topic1, app1-queue1-dead-letter, you can use -q "app1" in the command line. If you have a good naming convention, the logic should be straight forward, otherwise you have to add more conditions to the regex match.

maiconbaumx commented 7 years ago

Oh, I got it now. Thank you! :D