Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Micke Nordin f5e9f96f1e Merge branch 'master' of https://github.com/mickenordin/weather il y a 1 an
LICENSE Initial commit il y a 1 an
README.md Add crontab example il y a 1 an
aggregateweather.py Fix dates il y a 1 an
check_rainfall.sh Add nagios plugin il y a 1 an
getweather.py Add human readable station name il y a 1 an
grafana_dashboard.json Add cumulative graph il y a 1 an
requirements.txt Collection of data and aggregation to mysql works il y a 1 an
weather.ini Add grafana dashboard il y a 1 an
weather.sql Add human readable station name il y a 1 an



Some pythonscripts that get weather data from SMHI and calculates evapotranspiration. Create a user to run scripts:

useradd -s /usr/sbin/nologin -r -M -d /opt/weather weather

Clone repo:

git clone https://github.com/mickenordin/weather.git /opt/weather


chown -R weather:weather /opt/weather

Create mysql database:

mysql -e "CREATE DATABASE weather"
mysql -e "CREATE USER 'weather'@'localhost' IDENTIFIED BY 'password'"
mysql -e "GRANT ALL PRIVILEGES ON weather.* TO 'weather'@'localhost'"
mysql weather < /opt/weather/weather.sql

Install requirements:

sudo -u  weather pip3 install -r /opt/weather/requirements.txt

Configure and run:

vim /opt/weather/weather.ini

Example crontab entry for weather user:

# m h  dom mon dow   command
15 * * * * /opt/weather/getweather.py
30 * * * * /opt/weather/getweather.py --station 97280
45 2,14 * * * /opt/weather/aggregateweather.py
45 3,15 * * * /opt/weather/aggregateweather.py --station 97280