diff --git a/uplink b/uplink index 81fd81f..6a2f00e 100755 --- a/uplink +++ b/uplink @@ -110,7 +110,7 @@ def get_data(config, inc): password=config["database_password"], database=config["database"]) except Exception as err: - logger.error("ERROR: Database connection failed!" + str(err)) + logger.error(RED + "ERROR: Database connection failed!" + str(err) + END) # see https://stackoverflow.com/questions/1489669/how-to-exit-the-entire-application-from-a-python-thread # maybe the following is better. need to evaluate: # thread.interrupt_main() @@ -124,7 +124,7 @@ def get_data(config, inc): try: fc = FritzStatus(address=config["uplinks"][inc]["ip"], password=config["uplinks"][inc]["password"]) except Exception as err: - logger.error("ERROR: " + str(err) + " on device with ip:" + config["uplinks"][inc]["ip"]) + logger.error(RED + "ERROR: " + str(err) + " on device with ip:" + config["uplinks"][inc]["ip"] + END) sql = 'INSERT INTO log (timestamp, date, time, internal_ip, is_linked, is_connected, provider, message, ' \ 'source_host) VALUES (\"' + str(timestamp) + '\",\"' + str(d) + '\",\"' + str(t) + '\",\"' + \ str(config["uplinks"][inc]["ip"]) + '\",\"' + "0" + '\",\"' + "0" + '\",\"' + \ @@ -138,10 +138,11 @@ def get_data(config, inc): if fc.is_connected: status = "UP" + logger.info(GREEN + config["uplinks"][inc]["provider"] + " " + status + END) else: status = "DOWN" + logger.info(RED + config["uplinks"][inc]["provider"] + " " + status + END) - logger.info(config["uplinks"][inc]["provider"] + " " + status) sql = 'INSERT INTO log (timestamp, date, time, uptime, internal_ip, external_ip, external_ipv6, is_linked, ' \ 'is_connected, str_transmission_rate_up, str_transmission_rate_down, str_max_bit_rate_up, ' \ 'str_max_bit_rate_down, str_max_linked_bit_rate_up, str_max_linked_bit_rate_down, modelname, ' \ @@ -203,5 +204,5 @@ if __name__ == "__main__": try: run(_config) except KeyboardInterrupt: - logger.info("uplink terminated!") + logger.info(RED + "uplink terminated!" + END) exit(0)