-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# name: CI | ||
|
||
# on: | ||
# push: | ||
# branches: [main] | ||
# paths-ignore: | ||
# - "README.md" | ||
# - "doc/**" | ||
# pull_request: | ||
# branches: [main] | ||
# paths-ignore: | ||
# - "README.md" | ||
# - "doc/**" | ||
|
||
# jobs: | ||
# test: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Set up Python 3.10 | ||
# uses: actions/setup-python@v2 | ||
# with: | ||
# python-version: "3.10" | ||
# - name: Install dependencies for requirements and testing | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
# if [ -f requirements_dev.txt ]; then pip install -r requirements_dev.txt; fi | ||
# - name: Lint with pylint | ||
# run: | | ||
# pylint src/* | ||
# - name: Create token.txt | ||
# run: | | ||
# echo ${{ secrets.TOKEN }} > token.txt | ||
# - name: Test with pytest | ||
# run: | | ||
# pytest --cov=src --cov=main tests/ --cov-fail-under=75 | ||
# - name: Delete token.txt | ||
# run: | | ||
# rm -f token.txt |
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,2 +1,16 @@ | ||
# air-flow-monitor | ||
Real-time air quality tracking software | ||
|
||
# Prerequisites | ||
To use the Air-Flow Monitor, you should be familiar with the following: | ||
- [Docker](https://www.docker.com/) | ||
- [Python](https://www.python.org/) | ||
- API key (dipende dal provider scelto) | ||
|
||
|
||
## Logstash | ||
```bash | ||
cd logstash | ||
docker build . --tag tap:logstash | ||
docker run --rm -it --hostname="logstash" -v $PWD/pipeline/httpoller.conf:/usr/share/logstash/pipeline/logstash.conf -e XPACK_MONITORING_ENABLED=false docker.elastic.co/logstash/logstash:8.13.0 | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM docker.elastic.co/logstash/logstash:8.13.0 | ||
|
||
# Add your logstash plugins setup here | ||
RUN logstash-plugin install logstash-filter-sentimentalizer | ||
|
||
# to build with | ||
# docker build . --tag tap:logstash | ||
# and run with | ||
# docker run --rm -it --hostname="logstash" -v $PWD/pipeline/echostash.conf:/usr/share/logstash/pipeline/logstash.conf -e XPACK_MONITORING_ENABLED=false docker.elastic.co/logstash/logstash:8.13.0 | ||
# make sure that pipeline dir with proper conf is there% |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
input { | ||
http_poller { | ||
urls => { | ||
get_countries => { | ||
method => get | ||
url => "http://api.airvisual.com/v2/nearest_city?key=0e72cb61-87b6-4ab4-b422-0886e1305ac6" | ||
headers => { | ||
"Content-Type" => "application/json" | ||
# <add_authorization_or_password> | ||
} | ||
} | ||
} | ||
request_timeout => 60 | ||
codec => "json" | ||
type => "Http_poller" | ||
schedule => { "every" => "1h" } | ||
} | ||
} | ||
|
||
filter { | ||
json { | ||
source => "event.original" | ||
target => "parsed_data" | ||
} | ||
|
||
mutate { | ||
remove_field => ["event", "status", "@version"] # Rimuove i campi non necessari | ||
} | ||
|
||
# Rinomina i campi all'interno della struttura "data" per renderli più leggibili | ||
mutate { | ||
rename => { | ||
"[data][current][weather][ic]" => "weather_icon" | ||
"[data][current][weather][pr]" => "pressure" | ||
"[data][current][weather][tp]" => "temperature" | ||
"[data][current][weather][ws]" => "wind_speed" | ||
"[data][current][weather][hu]" => "humidity" | ||
"[data][current][weather][wd]" => "wind_direction" | ||
"[data][current][weather][ts]" => "weather_timestamp" | ||
"[data][current][pollution][maincn]" => "pollution_maincn" | ||
"[data][current][pollution][aqius]" => "pollution_aqius" | ||
"[data][current][pollution][mainus]" => "pollution_mainus" | ||
"[data][current][pollution][aqicn]" => "pollution_aqicn" | ||
"[data][current][pollution][ts]" => "pollution_timestamp" | ||
} | ||
} | ||
|
||
mutate { | ||
remove_field => ["[data][current][weather]", "[data][current][pollution]"] | ||
} | ||
} | ||
|
||
output { | ||
# file{ | ||
# path => "tmp/messages" | ||
# } | ||
|
||
stdout {} | ||
} |