Added SystemD service file, and country code in Tags

This commit is contained in:
Alexey 2018-10-09 21:29:24 +03:00
parent 50700ce12e
commit 267a40e30e
3 changed files with 34 additions and 1 deletions

View file

@ -43,6 +43,7 @@ def logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSER
HASH = Geohash.encode(INFO['latitude'], INFO['longitude']) # NOQA
COUNT['count'] = 1
GEOHASH['geohash'] = HASH
GEOHASH['country_code'] = INFO['country_code']
IPS['tags'] = GEOHASH
IPS['fields'] = COUNT
IPS['measurement'] = MEASUREMENT
@ -76,4 +77,4 @@ if __name__ == '__main__':
main()
except KeyboardInterrupt:
os.system('clear')
sys.exit()
sys.exit(0)

16
geoparser.service Normal file
View file

@ -0,0 +1,16 @@
***GeoStat.service***
[Unit]
Description=GeoStat
After=network.target
[Service]
Type=simple
ExecStart=/opt/geostat/venv/bin/python geoparser.py
User=root
WorkingDirectory=/opt/geostat
Restart=always
RestartSec=2
[Install]
WantedBy=multi-user.target

View file

@ -1,2 +1,18 @@
[NGINX_LOG]
#Path for the log file (Nginx/Apache)
logpath = /var/log/nginx/access.log
[INFLUXDB]
# Database URL
host = 194.132.49.150
port = 8086
#Database name
database = telegraf
# HTTP Auth
username = "telegraf"
password = "secretpassword"
# Measurement name
measurement = geotags