def request(self, check_config):
domain = check_config.get('domain')
if check_config.get('ip_version') == 6:
af = socket.AF_INET6
elif check_config.get('ip_version') == 4:
af = socket.AF_INET
else:
af = 0
try:
result = socket.getaddrinfo(domain, 0, af)
except Exception as e:
return Plugin.STATUS_CRIT, '{}'.format(e)
ips = [ip[4][0] for ip in result]
return (
Plugin.STATUS_OK,
'Domain was resolved with {}'.format(', '.join(ips))
)
评论列表
文章目录