-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_domain_expiry.py
executable file
·44 lines (37 loc) · 1.4 KB
/
generate_domain_expiry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Web Jan 6 18:45:29 2016
@author: Drew Anderson www.drewanderson.org
"""
import argparse
args = argparse.ArgumentParser()
args.add_argument("domain", help="domain to check")
args.add_argument("--ip", help="IP domain must report as", default=None)
args = args.parse_args()
check_command = "check_domain_expiry"
print("""define service {
use check-domain-expiry-parent
host_name domains.fakehost
service_description %(domain)s domain expiry
check_command %(check_command)s!%(domain)s
}
""" % dict(domain=args.domain, check_command=check_command, ip=args.ip))
check_command = "check_domain_response_ip"
if args.ip:
check_command = "check_domain_response_ip_match"
print("""define service {
use check-domain-expiry-parent
host_name domains.fakehost
service_description %(domain)s domain ip
check_command %(check_command)s!%(domain)s!%(ip)s
}
""" % dict(domain=args.domain, check_command=check_command, ip=args.ip))
print("""define service {
use check-domain-expiry-parent
host_name domains.fakehost
service_description %(domain)s domain ip www
check_command %(check_command)s!www.%(domain)s!%(ip)s
}
""" % dict(domain=args.domain, check_command=check_command, ip=args.ip))
print()