check_monitor_bot: remove debug print

This commit is contained in:
Cyberes 2023-05-30 21:50:54 -06:00
parent 4878b668c4
commit 0ddcbdc382
1 changed files with 2 additions and 4 deletions

View File

@ -14,7 +14,7 @@ parser.add_argument('--domain', required=True, help='Our domain.')
parser.add_argument('--ignore', nargs='*', default=[], help='Ignore these hosts.') parser.add_argument('--ignore', nargs='*', default=[], help='Ignore these hosts.')
parser.add_argument('--timeout', type=float, default=90, help='Request timeout limit.') parser.add_argument('--timeout', type=float, default=90, help='Request timeout limit.')
parser.add_argument('--warn', type=float, default=20, help='Manually set warn level for response time in seconds.') parser.add_argument('--warn', type=float, default=20, help='Manually set warn level for response time in seconds.')
parser.add_argument('--crit', type=float, default=30, help='Manually set critical levelfor response time in seconds.') parser.add_argument('--crit', type=float, default=30, help='Manually set critical level for response time in seconds.')
parser.add_argument('--warn-percent', type=int, default=30, parser.add_argument('--warn-percent', type=int, default=30,
help='Manually set warn level for the percentage of hosts that must fail the checks.') help='Manually set warn level for the percentage of hosts that must fail the checks.')
parser.add_argument('--crit-percent', type=int, default=50, parser.add_argument('--crit-percent', type=int, default=50,
@ -58,7 +58,6 @@ def main():
m = re.match(r'<span class="tooltip">\s*Send: (.*?)\s*<br\/>\s*Receive: (.*?)\s*<\/span>', str(item)) m = re.match(r'<span class="tooltip">\s*Send: (.*?)\s*<br\/>\s*Receive: (.*?)\s*<\/span>', str(item))
if m: if m:
domain = item.parent.parent.find('span', {'class': 'domain'}).text domain = item.parent.parent.find('span', {'class': 'domain'}).text
print(domain)
s = ms_to_s(m.group(1)) s = ms_to_s(m.group(1))
r = ms_to_s(m.group(2)) r = ms_to_s(m.group(2))
data[domain] = { data[domain] = {
@ -108,8 +107,7 @@ def main():
if len(crit_failed_hosts) / len(data.keys()) >= (args.crit_percent / 100): if len(crit_failed_hosts) / len(data.keys()) >= (args.crit_percent / 100):
# CRIT takes precedence # CRIT takes precedence
exit_code = nagios.CRITICAL exit_code = nagios.CRITICAL
print( print(f'CRITICAL: {make_percent(len(crit_failed_hosts) / len(data.keys()))}% of hosts are marked as critical.')
f'CRITICAL: {make_percent(len(crit_failed_hosts) / len(data.keys()))}% of hosts are marked as critical.')
elif len(warn_failed_hosts) / len(data.keys()) >= (args.warn_percent / 100): elif len(warn_failed_hosts) / len(data.keys()) >= (args.warn_percent / 100):
exit_code = nagios.WARNING exit_code = nagios.WARNING
print(f'WARN: {make_percent(len(warn_failed_hosts) / len(data.keys()))}% of hosts are marked as warn.') print(f'WARN: {make_percent(len(warn_failed_hosts) / len(data.keys()))}% of hosts are marked as warn.')