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

AttributeError: 'NoneType' object has no attribute 'get_metric_statistics' #53

Open
ycatoireDS opened this issue Dec 6, 2019 · 3 comments

Comments

@ycatoireDS
Copy link

Hi,

First, thank you for your work. But i have a problem when i launch cli command to retrieve metrics from RDS instance.

When i launch this command :
./cron.RDS.sh "database-zabbix" "FOUQUET RDS" "127.0.0.1" "awsfouquet" "eu-west-3"
Or this command :
./zabbixCloudWatch.py -z "127.0.0.1" -x "FOUQUET RDS" -a "awsfouquet" -r "" -s "RDS" -d "DBInstanceIdentifier=database-zabbix" -p "60" -f "2019-12-05 15:30:00" -t "2019-12-05 16:00:00"

I have these errors :

Traceback (most recent call last):
File "./zabbixCloudWatch.py", line 394, in
cw_data = getCloudWatchData(aws_account, aws_region, aws_service, dimensions)
File "./zabbixCloudWatch.py", line 181, in getCloudWatchData
results = cw.get_metric_statistics(period, start_time, end_time, metric_name, namespace, statistics, dimensions)
AttributeError: 'NoneType' object has no attribute 'get_metric_statistics'

But if i try to get metrics from AWS CLI, it works well :
aws cloudwatch get-metric-statistics --namespace 'AWS/RDS' --metric-name 'CPUUtilization' --dimensions Name=DBInstanceIdentifier,Value=database-zabbix --start-time '2019-12-05T12:00:00Z' --end-time '2019-12-05T12:30:00Z' --period 60 --statistics 'Maximum'

Result :
{
"Timestamp": "2019-12-05T12:24:00Z",
"Maximum": 1.47540983606554,
"Unit": "Percent"
}
],
"Label": "CPUUtilization"

Thanks for your help.

@ycatoireDS
Copy link
Author

Hi, nobody ? :)

@sherrerq
Copy link

Hello. I have the same problem. It appears when I uncomment get_metric_statistics function in zabbixCloudWatch.py. I have done it trying to solve other problem (TypeError: 'NoneType' object is not iterable) without success.

I do not know why it is uncommented in the script

@ycatoireDS
Copy link
Author

Hi @sherrerq ,

Thanks for your help. This is the line you talk ? (line 78 and 165) :
get_metric_statistics(period, start_time, end_time, metric_name, namespace, statistics, dimensions=None, unit=None)

Because these lines are commented in my zabbixCloudWatch.py. If i uncomment these lines i have this error :

Traceback (most recent call last):
  File "/opt/zabbix/cloudwatch/zabbixCloudWatch.py", line 394, in <module>
    cw_data = getCloudWatchData(aws_account, aws_region, aws_service, dimensions)
  File "/opt/zabbix/cloudwatch/zabbixCloudWatch.py", line 165, in getCloudWatchData
    get_metric_statistics(period, start_time, end_time, metric_name, namespace, statistics, dimensions=None, unit=None)
NameError: global name 'get_metric_statistics' is not defined

Thanks for your help.

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

No branches or pull requests

2 participants