Skip to content

Commit fc1e5de

Browse files
authored
release v2.4.0 merge
1 parent 672ff14 commit fc1e5de

9 files changed

+5230
-17
lines changed

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN mkdir -p /root/.config/NPMGRAF
77

88
## install curl for slim image
99
RUN apt-get update && apt-get install -y \
10-
curl \
10+
curl gcc \
1111
&& rm -rf /var/lib/apt/lists/*
1212

1313
COPY requirements.txt /root/.config/NPMGRAF/requirements.txt
@@ -30,3 +30,6 @@ COPY start.sh /root/start.sh
3030
RUN chmod +x /root/start.sh
3131

3232
ENTRYPOINT ["/root/start.sh"]
33+
34+
35+

Getipinfo.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
measurement_name = (sys.argv[5]) # get measurement from argv
66
print ('Measurement-name: '+measurement_name)
77

8-
# argv1 = outsideip, agrv2 = Domain, argv3 length, argv4 tragetip
8+
# argv1 = outsideip, agrv2 = Domain, argv3 length, argv4 tragetip, sys.argv[5] bucketname, sys.argv[6] date, sys.argv[7] asn
9+
10+
11+
asn = str(sys.argv[7])
912

1013
import geoip2.database
1114
import socket
@@ -27,20 +30,22 @@
2730
Target = str(sys.argv[4])
2831
reader.close()
2932

30-
reader = geoip2.database.Reader('/geolite/GeoLite2-ASN.mmdb')
31-
response = reader.asn(str(sys.argv[1]))
32-
Asn = response.autonomous_system_organization
33-
reader.close()
33+
if asn =='true':
34+
reader = geoip2.database.Reader('/geolite/GeoLite2-ASN.mmdb')
35+
response = reader.asn(str(sys.argv[1]))
36+
Asn = response.autonomous_system_organization
37+
reader.close()
3438

3539
# print to log
3640
print (Country)
3741
print (State)
3842
print (City)
3943
print (Zip)
40-
print (Asn)
4144
print (Long)
4245
print (Lat)
4346
print (ISO)
47+
if asn =='true':
48+
print (Asn)
4449
print ('Outside IP: ', IP)
4550
print ('Target IP: ', Target)
4651
print ('Domain: ', Domain)
@@ -110,7 +115,8 @@
110115
point.tag("Name", Country)
111116
point.tag("IP", IP),
112117
point.tag("Target", Target)
113-
point.tag("Asn", Asn)
118+
if asn =='true':
119+
point.tag("Asn", Asn)
114120

115121
point.field("Domain", Domain)
116122
point.field("latitude", Lat)
@@ -120,7 +126,8 @@
120126
point.field("key", ISO)
121127
point.field("IP", IP)
122128
point.field("Target", Target)
123-
point.field("Asn", Asn)
129+
if asn =='true':
130+
point.field("Asn", Asn)
124131
point.field("Name", Country)
125132
point.field("duration", duration)
126133
point.field("metric", 1)

changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44
- Get lenght and device
55
- grafana more internal panels and plain numbers
66

7-
- use alpine as base image
87
### Not planned features
98
- maybe analys fallback/default/error logs
109
- grafan 10.1 missle map (route feature only one and not multiple possible)
1110

11+
## v2.4.0
12+
- add ASN as optional feature see #32 and #33 thanks to @maxdd
13+
- added ASN to Grafana
14+
- added no filter Grafana Dashboard #20121
15+
1216
## v2.3.2
1317
- Grafana Dashboard added Filter
1418
- Fix spelling in Readme

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ services:
3737
- ./mysql:/var/lib/mysql
3838

3939
npmgraf:
40-
image: smilebasti/npmgrafstats:latest # set tag to 'latest-arm' for arm/v7 and arm64 image
40+
image: smilebasti/npmgrafstats:latest # change to ghcr.io/smilebasti/npmgrafstats if you prefer Github Container Registry
4141
restart: unless-stopped
4242
environment:
4343
REDIRECTION_LOGS: '<set TRUE or FALSE or ONLY>' # TRUE or FALSE or ONLY
@@ -76,7 +76,7 @@ services:
7676
environment:
7777
GEOIPUPDATE_ACCOUNT_ID: '<replace>'
7878
GEOIPUPDATE_LICENSE_KEY: '<replace>'
79-
GEOIPUPDATE_EDITION_IDS: 'GeoLite2-City GeoLite2-ASN'
79+
GEOIPUPDATE_EDITION_IDS: 'GeoLite2-City GeoLite2-ASN' #GeoLite2-ASN is optional
8080
GEOIPUPDATE_FREQUENCY: 24
8181
volumes:
8282
- ./geolite:/usr/share/GeoIP

0 commit comments

Comments
 (0)