Cloudwatch issue - ModuleNotFoundError: No module named 'cwlogs'

0

Hello, I'm facing some complicated and un-thinking issue with Cloudwatch,I believe Cloudwatch are easy to use and install because i used to install it at others EC2 instance before.

Unfortunately,but it doesn't happen this time.Might need your guys help for this issue.

The issue is: -Cloudwatch unable to get the metric information from my EC2.

Troubleshooting i do as per below:

  1. Check config file: /etc/awslogs/awslogs.conf point to correct server - MyServer1 & /etc/awslogs/awscli.conf point to correct region = ap-southeast-1

2)Following the step to re-install cloudwatch: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html Stuck at because there's an error at the log. "To install and configure CloudWatch Logs on an existing Amazon Linux instance" section, (Optional) Check the /var/log/awslogs.log file for errors logged when starting the service.

The error as per below - /var/log/awslog.log: File "/usr/lib/python3.7/site-packages/awscli/plugin.py", line 58, in _import_plugins plugins.append(import(path)) ModuleNotFoundError: No module named 'cwlogs'

What i do is install =
pip install awscli-cwlogs

But the issue still persist.Any steps that i missing?Please advice.

4 Risposte
0
Risposta accettata

I notice the error happen because of python are unable to communicate with aws api. What i do to settle this issue is:

1)Python version conflict - got 2 version at server which is 3.7 & 2.7 -AWS API so far not support python 3 -Solution: Remove python "yum remove python3" . 2)Re-install cloudwatch agent services at server "sudo yum install -y awslogs" . 3)Reconfigure cloudwatch config files steps https://youtu.be/22lzkpra_WU

Issue solved...thanks everyone...

profile picture
Zeee
con risposta un anno fa
profile picture
ESPERTO
verificato 25 giorni fa
0

Hi, sounds like the module is still missing. Did you try running the above command with a sudo (not sure if you need the sudo or not, might depend on how you access your EC2)? sudo pip install awscli-cwlogs

What does that command says?

if the command succeeds, did you also try running pip install --upgrade awscli-cwlogs (again, not sure whether you need sudo or not)

profile pictureAWS
Jsc
con risposta un anno fa
  • Hi mate.. Thanks for your reply...Just to inform u that I'm in root account,but i will run the command as per suggest and give you the results... Thanks again for the reply..

0

Hello... I run the command as per suggested.This is the output: . sudo pip install awscli-cwlogs Enter image description here

Another one Enter image description here

profile picture
Zeee
con risposta un anno fa
0

I'm sorry I don't know what's causing your issue, I hope someone else jumps in with another suggestion

profile pictureAWS
Jsc
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande