Skip to content

Installation

smilebasti edited this page Aug 4, 2023 · 19 revisions

This guides you through the installation of npmGrafStats.

A complete installation example is available with the docker-compose.yml file.

This instruction presumes that your working directory is /home/docker

pre setup

See the requirements page for what you will need!

  1. create an influx Organisation called npmgrafstats
  2. Create a Bucket called npmgrafstats and a API-Token for npmgrafstats with write access to the bucket
  3. Get your GeoLite2-City.mmdb from the geoliteupdate container or download it from maxmind manually to the /home/docker/geolite directory

Supported architectures: amd64, arm/v7 and arm64. See Docker Hub Tags.

Github Registry is now additionally available to Docker Registry by adding ghcr.io/ in front of smilebasti/npmgrafstats:latest.

Docker container command

docker run --name npmgraf -it -d
-v /home/docker/nginx-proxy-manager/data/logs:/logs \
-v /home/docker/geolite:/geolite \
-v /home/docker/monitoringips.txt:/monitoringips.txt \ # optional only mount if preexists and a wanted feature
-e INFLUX_HOST=<replace>:8086 \  # use host IP
-e INFLUX_BUCKET=npmgrafstats \
-e INFLUX_ORG=npmgrafstats \
-e INFLUX_TOKEN=<replace> \
-e INTERNAL_LOGS=<set> \ # set to TRUE or FALSE # IMPORTANT see below for more info about this feature
-e MONITORING_LOGS=<set> \ # set to TRUE or FALSE # IMPORTANT see below for more info about this feature
-e REDIRECTION_LOGS=<set> # set to TRUE or FALSE or ONLY
smilebasti/npmgrafstats

Docker-Compose

version: '3'
services:
  npmgraf:
    image: smilebasti/npmgrafstats
    environment:
      - INFLUX_HOST=<replace>:8086  # use host IP
      - INFLUX_BUCKET=npmgrafstats
      - INFLUX_ORG=npmgrafstats
      - INFLUX_TOKEN=<replace>
      - REDIRECTION_LOGS=<set> # set to TRUE or FALSE or ONLY
      - INTERNAL_LOGS=<set> # set to TRUE or FALSE or ONLY # IMPORTANT see below for more info about this feature
      - MONITORING_LOGS=<set> # set to TRUE or FALSE or ONLY # IMPORTANT see below for more info about this feature
    volumes:
      - /home/docker/nginx-proxy-manager/data/logs:/logs
      - /home/docker/geolite:/geolite
      - /home/docker/monitoringips.txt:/monitoringips.txt # optional only mount if preexists and a wanted feature

Set your credentials, variables and directories

  1. Set REDIRECTION_LOGS to TRUE for Reverse-Proxy and Redirection logs, to ONLY for only Redirection logs and FALSE for only Reverse-Proxy logs
  2. optional: set INTERNAL_LOGS and MONITORING_LOGS to TRUE if wanted. IMPORTANT read below!
  3. create the monitoringips.txt file and fill it with the IP's of Uptimerobot, Hetrixtools or similar services. (1 IP per row)(This is optional but is recommended if you monitor your domains via http(s) with external services).
  4. set your credentials for InfluxDB
  5. Run the docker container command or start the docker-compose with adjusted settings

Important INTERNAL_LOGS and MONITORING_LOGS

This is optional!. If you add the INTERNAL_LOGS and MONITORING_LOGS you will gather much more logs! In my testing environment it worked with only a few domains and services monitoring these. In production, I can't recommend using it because the process was too slow to keep up with new logs (45 Domains and all of them being monitored). You can test it and see if these show up in Grafana in 1 minute of being logged.

Grafana

See Grafana Installation on how to set up the Data source and the Dashboard to display the gathered logs.

A complete installation example is available with the docker-compose.yml file.