如何使用python获取所有没有特定标记的mysql实例?

如何使用python获取所有没有特定标记的mysql实例?,python,mysql,Python,Mysql,我正试图建立一个报警系统,将发送电子邮件,如果有些情况下没有报警。但对于一些测试实例,我不希望它们包括在内,因此我将在其中添加一个“NoAlarms”标记。我想在我现有的python脚本中添加此功能 这基本上就是我现在拥有的 from RDSFunctions import GetListRDSEndpoints from RDSFunctions import GetListRDSIdentifiers from boto.ec2.cloudwatch import CloudWatchCon

我正试图建立一个报警系统,将发送电子邮件,如果有些情况下没有报警。但对于一些测试实例,我不希望它们包括在内,因此我将在其中添加一个“NoAlarms”标记。我想在我现有的python脚本中添加此功能

这基本上就是我现在拥有的

from RDSFunctions import GetListRDSEndpoints
from RDSFunctions import GetListRDSIdentifiers
from boto.ec2.cloudwatch import CloudWatchConnection
from SMTPMail import SendSMTPMail
from boto import ec2
lst_instances = GetListRDSIdentifiers(accesskey, secretkey)
lst_expected_alarms = []
for inst in lst_instances:
    if "relprac" not in inst.lower():
        lst_expected_alarms.append(inst + ' - ' + 'CPUUtilization')

由于我们对这些实例而不是EC2使用RDS,我应该怎么做才能找到所有没有“NoAlarms”标记的实例?

是否需要这样做

import boto.ec2

conn = boto.ec2.connect_to_region("your_region", accesskey, secretkey)

lst_instances = conn.get_only_instances() #gets all instances

for instance in lst_instances:

    if instance.tags['NoAlarms']: #tags are a dictionary ie.['Name': 'NoAlarms']
        pass
    else:
        #add alarms