allow for alerting on non-dns AWS instances..pick the best alerting text

This commit is contained in:
Jeff Bryner 2014-03-25 17:12:40 -07:00
Родитель dc5ae816d5
Коммит a40aa67d24
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -117,7 +117,12 @@ def createAlerts(es,esResults):
alert['eventsource']=flattenDict(r)
if r['eventName']=='RunInstances':
for i in r['responseElements']['instancesSet']['items']:
alert['summary'] += (' running {0} '.format(i['privateDnsName']))
if 'privateDnsName' in i.keys():
alert['summary'] += (' running {0} '.format(i['privateDnsName']))
elif 'instanceId' in i.keys():
alert['summary'] += (' running {0} '.format(i['instanceId']))
else:
alert['summary'] += (' running {0} '.format(flattenDict(i)))
if r['eventName']=='StartInstances':
for i in r['requestParameters']['instancesSet']['items']:
alert['summary'] += (' starting {0} '.format(i['instanceId']))