Skip to content

Commit

Permalink
release v2.4.0 merge
Browse files Browse the repository at this point in the history
  • Loading branch information
smilebasti authored Dec 10, 2023
1 parent 672ff14 commit fc1e5de
Show file tree
Hide file tree
Showing 9 changed files with 5,230 additions and 17 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN mkdir -p /root/.config/NPMGRAF

## install curl for slim image
RUN apt-get update && apt-get install -y \
curl \
curl gcc \
&& rm -rf /var/lib/apt/lists/*

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

ENTRYPOINT ["/root/start.sh"]



23 changes: 15 additions & 8 deletions Getipinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
measurement_name = (sys.argv[5]) # get measurement from argv
print ('Measurement-name: '+measurement_name)

# argv1 = outsideip, agrv2 = Domain, argv3 length, argv4 tragetip
# argv1 = outsideip, agrv2 = Domain, argv3 length, argv4 tragetip, sys.argv[5] bucketname, sys.argv[6] date, sys.argv[7] asn


asn = str(sys.argv[7])

import geoip2.database
import socket
Expand All @@ -27,20 +30,22 @@
Target = str(sys.argv[4])
reader.close()

reader = geoip2.database.Reader('/geolite/GeoLite2-ASN.mmdb')
response = reader.asn(str(sys.argv[1]))
Asn = response.autonomous_system_organization
reader.close()
if asn =='true':
reader = geoip2.database.Reader('/geolite/GeoLite2-ASN.mmdb')
response = reader.asn(str(sys.argv[1]))
Asn = response.autonomous_system_organization
reader.close()

# print to log
print (Country)
print (State)
print (City)
print (Zip)
print (Asn)
print (Long)
print (Lat)
print (ISO)
if asn =='true':
print (Asn)
print ('Outside IP: ', IP)
print ('Target IP: ', Target)
print ('Domain: ', Domain)
Expand Down Expand Up @@ -110,7 +115,8 @@
point.tag("Name", Country)
point.tag("IP", IP),
point.tag("Target", Target)
point.tag("Asn", Asn)
if asn =='true':
point.tag("Asn", Asn)

point.field("Domain", Domain)
point.field("latitude", Lat)
Expand All @@ -120,7 +126,8 @@
point.field("key", ISO)
point.field("IP", IP)
point.field("Target", Target)
point.field("Asn", Asn)
if asn =='true':
point.field("Asn", Asn)
point.field("Name", Country)
point.field("duration", duration)
point.field("metric", 1)
Expand Down
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
- Get lenght and device
- grafana more internal panels and plain numbers

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

## v2.4.0
- add ASN as optional feature see #32 and #33 thanks to @maxdd
- added ASN to Grafana
- added no filter Grafana Dashboard #20121

## v2.3.2
- Grafana Dashboard added Filter
- Fix spelling in Readme
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
- ./mysql:/var/lib/mysql

npmgraf:
image: smilebasti/npmgrafstats:latest # set tag to 'latest-arm' for arm/v7 and arm64 image
image: smilebasti/npmgrafstats:latest # change to ghcr.io/smilebasti/npmgrafstats if you prefer Github Container Registry
restart: unless-stopped
environment:
REDIRECTION_LOGS: '<set TRUE or FALSE or ONLY>' # TRUE or FALSE or ONLY
Expand Down Expand Up @@ -76,7 +76,7 @@ services:
environment:
GEOIPUPDATE_ACCOUNT_ID: '<replace>'
GEOIPUPDATE_LICENSE_KEY: '<replace>'
GEOIPUPDATE_EDITION_IDS: 'GeoLite2-City GeoLite2-ASN'
GEOIPUPDATE_EDITION_IDS: 'GeoLite2-City GeoLite2-ASN' #GeoLite2-ASN is optional
GEOIPUPDATE_FREQUENCY: 24
volumes:
- ./geolite:/usr/share/GeoIP
Expand Down
Loading

0 comments on commit fc1e5de

Please sign in to comment.