Writing information to database now at a fritzconnection exception.

This commit is contained in:
Johannes Findeisen 2022-09-23 23:21:13 +02:00
commit 6cc1ea70c7
2 changed files with 14 additions and 1 deletions

View file

@ -51,7 +51,7 @@ MINOR changes are "just-in-time" changes or small enhancements which should not
documentation. documentation.
FIXES should never affect anything else then stability or security. FIXES should never affect anything else then stability or security.
""" """
__version__ = '0.9.1.1' __version__ = '0.9.2'
__author__ = 'Johannes Findeisen <you@hanez.org>' __author__ = 'Johannes Findeisen <you@hanez.org>'
logger = logging.getLogger('uplink') logger = logging.getLogger('uplink')

View file

@ -157,6 +157,19 @@ class Uplink(Daemon):
except Exception as err: except Exception as err:
message = str('error when getting data from ' + uplink['ip'] + '') message = str('error when getting data from ' + uplink['ip'] + '')
model = Model(self.__configuration)
model.set_date(date_formatted)
model.set_internal_ip(uplink['ip'])
model.set_message('FATAL: ' + str(message.format(err)))
model.set_provider(uplink['provider'])
model.set_source_host(socket.gethostname())
model.set_time(time_formatted)
model.set_timestamp(timestamp)
database = Database(self.__configuration)
database.write_log_to_db(model)
logger.error(str(message.format(err))) logger.error(str(message.format(err)))
def run(self): def run(self):