Skip to content

Commit 8f0103b

Browse files
authored
Merge pull request #653 from Paraphraser/20230129-influxdb-master
2023-01-29 InfluxDB documentation - master branch
2 parents 7818e40 + efa75c6 commit 8f0103b

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

docs/Containers/InfluxDB.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,9 @@ SSD-drives have pretty good controllers spreading out writes, so this isn't a th
662662

663663
This is especially important if you plan on having Grafana or Chronograf displaying up-to-date data on a dashboard, making queries all the time.
664664

665-
## Container won't start { #debugging }
665+
### Debugging { #debugging }
666+
667+
### Container won't start { #debugInspection }
666668

667669
Sometimes you need start the container without starting influxdb to access its maintenance tools. Usually when influx crashes on startup.
668670

@@ -677,18 +679,72 @@ influxdb:
677679
Recreate the container using the new entrypoint:
678680

679681
``` console
680-
pi@raspberrypi:~/IOTstack $ docker-compose up -d influxdb
682+
$ docker-compose up -d influxdb
681683
Recreating influxdb ... done
682684
```
683685

684-
Now it should start and you can get a shell to poke around and try the `influx_inspect`:
686+
Now the container should start and you can get a shell to poke around and try the `influx_inspect` command:
685687

686688
``` console
687689
$ docker exec -it influxdb bash
688-
root@5ecc8536174f:/# influx_inspect
690+
# influx_inspect
689691
Usage: influx_inspect [[command] [arguments]]
690692
```
691693

692-
You may need to do `apt update` and `apt install` some tools you need. The container is pretty bare-bones by default.
694+
Once you have finished poking around, you should undo the change by removing the custom entrypoint and `up -d` again to return to normal container behaviour where you can then test to see if your fixes worked.
695+
696+
### Adding packages { #debugPackages }
697+
698+
The container is pretty bare-bones by default. It is OK to install additional tools. Start by running:
699+
700+
``` console
701+
# apt update
702+
```
703+
704+
and then use `apt install` to add whatever you need. Packages you add will persist until the next time the container is re-created.
705+
706+
### Sniffing traffic { #debugSniff }
707+
708+
If you need to see the actual packets being sent to Influx for insertion into your database, you can set it up like this:
709+
710+
``` console
711+
$ docker exec influxdb bash -c 'apt update && apt install tcpdump -y'
712+
```
713+
714+
That adds `tcpdump` to the running container and, as noted above, that will persist until you re-create the container.
715+
716+
To capture traffic:
717+
718+
``` console
719+
$ docker exec influxdb tcpdump -i eth0 -s 0 -n -c 100 -w /var/lib/influxdb/capture.pcap dst port 8086
720+
```
721+
722+
Breaking that down:
723+
724+
* `-i eth0` is the container's internal virtual Ethernet network interface (attached to the internal bridged network)
725+
* `-s 0` means "capture entire packets"
726+
* `-n` means "do not try to resolve IP addresses to domain names
727+
* `-c 100` is optional and means "capture 100 packets then stop". If you omit this option, `tcpdump` will capture packets until you press <kbd>control</kbd>+<kbd>C</kbd>.
728+
* `-w /var/lib/influxdb/capture.pcap` is the internal path to the file where captured packets are written. You can, of course, substitute any filename you like for `capture.pcap`.
729+
* `dst port 8086` captures all packets where the destination port field is 8086, which is the InfluxDB internal port number.
730+
731+
The internal path:
732+
733+
```
734+
/var/lib/influxdb/capture.pcap
735+
```
736+
737+
maps to the external path:
738+
739+
```
740+
~/IOTstack/volumes/influxdb/data/capture.pcap
741+
```
742+
743+
You can copy that file to another system where you have a tool like WireShark installed. WireShark will open the file and you can inspect packets and verify that the information being sent to InfluxDB is what you expect.
744+
745+
Do not forget to clean-up any packet capture files:
693746

694-
Of course remove the custom entrypoint and "up -d" again to test if your fixes worked.
747+
```
748+
$ cd ~/IOTstack/volumes/influxdb/data
749+
$ sudo rm capture.pcap
750+
```

0 commit comments

Comments
 (0)