SHOW:
|
|
- or go back to the newest paste.
| 1 | - | from socket import gethostbyaddr |
| 1 | + | import socket |
| 2 | evt.summary = "LTM Service Down" | |
| 3 | ip = getattr(evt, 'bigipNotifyObjNode', 'Unknown') | |
| 4 | port = getattr(evt, 'bigipNotifyObjPort', 'Unknown') | |
| 5 | - | host = gethostbyaddr(ip) |
| 5 | + | try: |
| 6 | host = socket.gethostbyaddr(ip) | |
| 7 | evt.component = '%s:%s' % (host[0],port) | |
| 8 | - | evt.component = '%s:%s' % (host[0],port) |
| 8 | + | except socket.herror: |
| 9 | - | evt.message = '%s' % (message) |
| 9 | + | evt.component = '%s:%s' % (ip,port) |
| 10 | message = getattr(evt, 'bigipNotifyObjMsg') | |
| 11 | ||
| 12 | evt.message = '%s' % (message) | |
| 13 | ||
| 14 |