One more minor fixed and install.sh file update

This commit is contained in:
Alexey Nizhegolenko 2021-01-25 09:15:23 +02:00
parent 4eb5c68db7
commit 0f5df1ccee
3 changed files with 23 additions and 23 deletions

View file

@ -88,7 +88,7 @@ def logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSER
try:
CLIENT.write_points(METRICS)
except Exception:
logging.exception("Cannot establish connection to InfluxDB: ")
logging.exception("Cannot establish connection to InfluxDB: ") # NOQA
def main():
@ -115,7 +115,8 @@ def main():
if os.path.exists(LOGPATH):
logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSERPASS, MEASUREMENT, GEOIPDB, INODE) # NOQA
else:
print('File %s not found' % LOGPATH)
logging.info('Nginx log file %s not found', LOGPATH)
print('Nginx log file %s not found' % LOGPATH)
if __name__ == '__main__':

View file

@ -8,30 +8,21 @@
WORKDIR=$(pwd)
echo ""
echo "Downloading latest GeoLiteCity.dat from MaxMind"
echo "Creating virtual ENV and install all needed requirements..."
sleep 1
wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
mkdir tmpgeo
tar -xvf GeoLite2-City.tar.gz -C ./tmpgeo && cd ./tmpgeo/*/.
cp ./GeoLite2-City.mmdb $WORKDIR
cd $WORKDIR
python3 -m venv venv && source venv/bin/activate
pip3 install -r requirements.txt && deactivate
echo ""
echo "Creating virtual ENV and installing requirements..."
sleep 1
virtualenv venv && source venv/bin/activate
pip install -r requirements.txt && deactivate
echo ""
echo "Please edit settings.ini file and set right parameters..."
echo "Please edit settings.ini file and set the needed parameters..."
sleep 1
cp settings.ini.back settings.ini
"${VISUAL:-"${EDITOR:-vi}"}" "settings.ini"
echo ""
echo "Installing SystemD service..."
echo "Installing GeoStat SystemD service..."
sleep 1
while read line
do
@ -41,6 +32,14 @@ done < "./geostat.service.template" > /lib/systemd/system/geostat.service
systemctl enable geostat.service
echo ""
echo "All done, now you can start getting GEO data from your log"
echo "run 'systemctl start geostat.service' for this"
echo "Last step, you need to register and download the lates GeoLite2 City mmdb file from the maxmind.com website"
echo "After you get an account on the maxmind.com you can find the needed file by the link below"
echo "https://www.maxmind.com/en/accounts/YOURACCOUNTID/geoip/downloads"
echo "Please don't forget to unzip and put the GeoLite2-City.mmdb file in the same directory with the geoparse.py"
echo "script, or you can put it enywhere and then change the way in the settings.ini"
echo ""
echo "Good, all was done and you can start getting GEO data from your Nginx/Apache log file now"
echo "Please run 'systemctl start geostat.service' for starting the GeoStat script"
echo "You can find the GeoStat application logs in the syslog file if you need"
echo "Good Luck !"

View file

@ -8,15 +8,15 @@ geoipdb = ./GeoLite2-City.mmdb
[INFLUXDB]
# Database URL
host = 185.27.96.227
host = INFLUXDB_SERVER_IP
port = 8086
#Database name
database = telegraf
database = INFLUXDB_DATABASE_NAME
# HTTP Auth
username = telegraf
password = itieh0eeMo
username = INFLUXDB_USER_NAME
password = INFLUXDB_USER_PASSWORD
# Measurement name
measurement = geodata