-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
funneled scope of imports where possible fixed #59 Added fstrings where possible added logging both temporarily and in secondary places
- Loading branch information
1 parent
47f2f61
commit 61fcf3b
Showing
13 changed files
with
131 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,5 @@ GeoLite2-City.mmdb | |
GeoLite2-City.tar.gz | ||
data/varken.ini | ||
.idea/ | ||
Legacy/configuration.py | ||
varken-venv/ | ||
logs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import logging | ||
|
||
from logging import getLogger | ||
from influxdb import InfluxDBClient | ||
|
||
logger = logging.getLogger('varken') | ||
|
||
class DBManager(object): | ||
def __init__(self, server): | ||
self.server = server | ||
self.influx = InfluxDBClient(self.server.url, self.server.port, self.server.username, self.server.password, | ||
'varken') | ||
databases = [db['name'] for db in self.influx.get_list_database()] | ||
self.logger = getLogger() | ||
|
||
if 'varken' not in databases: | ||
self.logger.info("Creating varken database") | ||
self.influx.create_database('varken') | ||
|
||
self.logger.info("Creating varken retention policy (30d/1h)") | ||
self.influx.create_retention_policy('varken 30d/1h', '30d', '1', 'varken', False, '1h') | ||
|
||
def write_points(self, data): | ||
d = data | ||
logger.debug('Writing Data to InfluxDB %s', d) | ||
self.logger.debug('Writing Data to InfluxDB %s', d) | ||
self.influx.write_points(d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.