@@ -0,0 +1,2238 @@
+#This script runs on windows%0Aimport os%0Aimport datetime%0A%0A#put the path to the file with your hostnames%0Anames_list = %22hostnames.txt%22%0A%0A#put the path that you would like the report to be written to%0Aoutput_file_name = %22status.html%22%0A%0A#html template%0Atemplate_file = %22template/template.html%22%0A%0Atoday = (datetime.datetime.now())%0Anow = today.strftime(%22%25m/%25d/%25Y %25H:%25M:%25S%22)%0A%0A#floats needed to determine accurate percentage%0Aservers_up = 0.00%0Aservers_down = 0.00%0Aservers_percent = 0.00%0A%0A#this section determines which command to run and the count of how many servers are online%0Awith open(names_list, %22r%22) as ins:%0A    array = %5B%5D%0A    for servername in ins:%0A        array.append(servername)%0A        if os.system(%22ping -n 1 %22 + servername) == 0:%0A            servers_up += 1%0A        else:%0A            servers_down += 1%0A%0A#determine percentage of servers that are online%0Aserver_total = (servers_up + servers_down)%0Aservers_percent = str(round((((server_total) - servers_down) / (server_total)), 2))%0A%0A# empty status.html%0Af = open(output_file_name, %22w%22)%0Af.close()%0A%0A#write static lines from html file%0Af = open(output_file_name, %22r+%22)%0Af.writelines(%5Bl for l in open(template_file).readlines()%5D)%0Af.close()%0A%0A#fill in %22servers_percent%22%0Af = open(output_file_name, %22r+%22)%0Acontent = f.read()%0Af.seek(0)%0Af.truncate()%0Af.write(content.replace(%22#SERVERSPERCENT%22, servers_percent))%0Af.close()%0A%0A#fill in %22now%22%0Af = open(output_file_name, %22r+%22)%0Acontent = f.read()%0Af.seek(0)%0Af.truncate()%0Af.write(content.replace(%22#NOW%22, now))%0Af.close()%0A%0A#this section generates the html table%0Ahtml_file = open(output_file_name, %22a%22)%0Awith open(names_list, %22r%22) as ins:%0A    array = %5B%5D%0A    for servername in ins:%0A        array.append(servername)%0A        response = os.system(%22ping -n 1 %22+ servername)%0A%0A        if response == 0:%0A            html_file.write(%22%5Cn%09%09%3Ctr%3E%5Cn%22)%0A            html_file.write(%22%09%09%3Ctd class=%5C%22text-left%5C%22%3E%22 + (servername) + %22%3C/td%3E%22)%0A            html_file.write(%22%5Cn%09%09%3Ctd class=%5C%22green%5C%22%3EOnline%3C/td%3E%5Cn%09%09%3C/tr%3E%22)%0A        else:%0A            html_file.write(%22%5Cn%09%09%3Ctr%3E%5Cn%22)%0A            html_file.write(%22%09%09%3Ctd class=%5C%22text-left%5C%22%3E%22 + (servername) + %22%3C/td%3E%22)%0A            html_file.write(%22%5Cn%09%09%3Ctd class=%5C%22red%5C%22%3EOffline%3C/td%3E%5Cn%09%09%3C/tr%3E%22)%0A%0Ahtml_file.write('%5Cn%09%3C/tbody%3E%5Cn%09%3C/table%3E%5Cn%3C/body%3E%5Cn%3C/html%3E')%0A

Create report_windows.py