Skip to content

Commit 3209499

Browse files
pingping: JSONL storage only; SQLite build moved to fogping
1 parent d1be063 commit 3209499

23 files changed

Lines changed: 564 additions & 710 deletions

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
github: githubflyideas
2+
# 爱发电开通后取消注释:
23
# custom: ["https://afdian.com/a/githubflyideas"]

.goreleaser.yaml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# GoReleaser — linux/amd64 only. SQLite (mattn/go-sqlite3) needs CGO, which rules out
2-
# cross-compiling to darwin and arm64 from the release runner. scp-and-run stays the
3-
# primary path; the Homebrew tap is gone with the macOS builds.
1+
# GoReleaser — cross-platform tarballs. No apt/deb, no rpm, no brew tap (dropped:
2+
# not worth the token upkeep for a secondary channel — scp-and-run is the primary path).
3+
# Zero-dependency single binary.
44
version: 2
55

66
project_name: pingping
@@ -14,25 +14,22 @@ builds:
1414
main: .
1515
binary: pingping
1616
env:
17-
- CGO_ENABLED=1
17+
- CGO_ENABLED=0
1818
flags:
1919
- -trimpath
2020
ldflags:
21-
# Static link: CGO otherwise ties the binary to the builder glibc, so one built
22-
# on Ubuntu 24 refuses to start on anything older. Static keeps "copy it over
23-
# and run it" true, which is the whole point of this project.
24-
- -s -w -X main.version={{ .Version }} -linkmode external -extldflags -static
25-
goos: [linux]
26-
goarch: [amd64]
27-
28-
# Tarballs for the "scp and run" crowd. No clean.sh: storage is SQLite now and
29-
# retention is handled in-process by --days.
21+
- -s -w -X main.version={{ .Version }}
22+
goos: [linux, darwin]
23+
goarch: [amd64, arm64]
24+
25+
# Tarballs for the "scp and run" crowd — unchanged experience, plus LICENSE and clean.sh.
3026
archives:
3127
- id: tar
3228
formats: [tar.gz]
3329
name_template: "{{ .ProjectName }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}"
3430
files:
3531
- LICENSE
32+
- clean.sh
3633

3734
checksum:
3835
name_template: "SHA256SUMS"
@@ -45,9 +42,4 @@ release:
4542
header: |
4643
## Install
4744
48-
```bash
49-
tar xzf pingping-*-linux-amd64.tar.gz && ./pingping
50-
```
51-
Storage is SQLite; history is kept for 40 days by default (`--days=300` for longer).
52-
linux/amd64 only in this release — SQLite needs CGO, so the other platforms are
53-
not cross-compiled here.
45+
scp a tarball below, extract, `./pingping`. Zero dependencies.

README.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
A smokeping-like network tool
2-
-----One binary file-----
3-
Just scp and run
1+
🌐 [English](#english) · [中文](#中文) · [Español](#español) · [Français](#français) · [Português](#português) · [Deutsch](#deutsch) · [Русский](#русский) · [日本語](#日本語) · [한국어](#한국어) · [Bahasa Indonesia](#bahasa-indonesia) · [Tiếng Việt](#tiếng-việt) · [العربية](#العربية) · [हिन्दी](#हिन्दी) · [বাংলা](#বাংলা) · [اردو](#اردو) · [Türkçe](#türkçe) · [ไทย](#ไทย)
42

3+
![window: a 40-minute congestion event — smoke spreads, bursts marked ◆](docs/hero8.png)
4+
![window: a 40-minute congestion event — smoke spreads, bursts marked ◆](docs/hero9.png)
55

6-
```bash
7-
mkdir /home/pingping -p &&cd /home/pingping
86

7+
A smokeping-like network tool.One binary file,
8+
Just scp and run
9+
10+
```bash
11+
cd /home
912
wget https://github.com/githubflyideas/pingping/releases/download/v2.11.2/pingping-v2.11.2-linux-amd64.tar.gz
10-
tar -zxvf pingping-v2.11.2-linux-amd64.tar.gz
11-
./pingping user=admin passwd=admin
1213

13-
or v3.2.0
14+
tar -zxvf pingping-v2.11.2-linux-amd64.tar.gz
1415

15-
wget https://github.com/githubflyideas/pingping/releases/download/v3.2.0/pingping-v3.2.0-linux-amd64.tar.gz
16-
tar -zxvf pingping-v3.2.0-linux-amd64.tar.gz
16+
cd pingping-v2.11.2-linux-amd64
1717
./pingping user=admin passwd=admin
1818
```
19-
Open http://localhost:8517 and watch your first puff of network smoke  
20-
21-
*v2.x:Storage is JSON ; history is kept for 300 days by default
22-
*v3.x:Storage is SQLite; history is kept for 40 days by default (--days=300 for longer)
19+
Open http://localhost:8517 and watch your first puff of network smoke.
2320

2421
-----------------------------------------------------------
2522
Add target host
2623
```
2724
echo "1.2.3.4 myhost pace=fast" >> targets/ping.list
2825
echo "10.0.0.5:443 ads-api" >> targets/tcp.list
2926
```
30-
3127
Data cleanup
3228
Retention is fixed at 300 days. To purge earlier by hand, the bundled `clean.sh` is all you need
3329
(data is plain per-day JSONL, so cleanup is just find+delete):
@@ -37,12 +33,6 @@ Retention is fixed at 300 days. To purge earlier by hand, the bundled `clean.sh`
3733
```
3834
Latest [Releases](https://github.com/githubflyideas/pingping/releases)
3935

40-
🌐 [English](#english) · [中文](#中文) · [Español](#español) · [Français](#français) · [Português](#português) · [Deutsch](#deutsch) · [Русский](#русский) · [日本語](#日本語) · [한국어](#한국어) · [Bahasa Indonesia](#bahasa-indonesia) · [Tiếng Việt](#tiếng-việt) · [العربية](#العربية) · [हिन्दी](#हिन्दी) · [বাংলা](#বাংলা) · [اردو](#اردو) · [Türkçe](#türkçe) · [ไทย](#ไทย)
41-
![window: a 40-minute congestion event — smoke spreads, bursts marked ◆](docs/hero15.png)
42-
![window: a 40-minute congestion event — smoke spreads, bursts marked ◆](docs/hero17.png)
43-
![window: a 40-minute congestion event — smoke spreads, bursts marked ◆](docs/hero16.png)
44-
45-
4636
## English
4737

4838
PingPing is a lightweight network latency and link quality visualization tool.
@@ -361,7 +351,7 @@ Friendly Links smokeping--- https://github.com/oetiker/SmokePing
361351

362352
pingping is a minimalist smokeping-like network oscilloscope: probes go in, JSONL text files sit on disk (300-day retention). It features a built-in, read-only Web UI with native auth—no external databases, Nginx, or Caddy required. Just scp and run.
363353

364-
If you need alerting, multi-platform notifications, hot reload, or tiered storage, that lives in the sibling project fogping.
354+
pingping stays on plain JSONL and stays cgo-free. If you want SQLite storage with indexed queries and in-process rollup/retention, that is the sibling project [fogping](https://github.com/githubflyideas/fogping).
365355

366356
## License
367357

clean.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
# clean.sh [N] — delete pingping probe data older than N days (default 30).
3+
# Data files are plain per-day JSONL under ./data/<target>/YYYY-MM-DD.jsonl,
4+
# so cleanup is just find+delete. Run from the pingping directory.
5+
days="${1:-30}"
6+
find ./data -type f -name '20*.jsonl' -mtime +"$days" -print -delete

config.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main
22

33
import (
4-
"fmt"
4+
"fmt"
55
"net"
66
"os"
77
"path/filepath"
@@ -29,8 +29,8 @@ func defaultConfig() *Config {
2929
DataDir: "./data",
3030
TargetsDir: "./targets",
3131
Probe: ProbeCfg{IntervalSec: 60, Packets: 20, GapMs: 50, TimeoutMs: 1000},
32-
HotDays: 2, // raw samples: enough for the sub-day windows
33-
RetentionDays: 40, // hourly rollups; --days overrides
32+
HotDays: 30,
33+
RetentionDays: 300,
3434
}
3535
}
3636

@@ -99,6 +99,7 @@ func validateTargets(cfg *Config) error {
9999
return nil
100100
}
101101

102+
102103
// loadTargetLists reads targets/ping.list and tcp.list.
103104
// line format: host[:port] [name...] [pace=fast|slow] [interval=sec]
104105
func loadTargetLists(dir string) ([]TargetCfg, error) {
@@ -168,3 +169,4 @@ func parseListLine(line, typ string) (TargetCfg, error) {
168169
}
169170
return t, nil
170171
}
172+

docs/advance.readme.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
systemd
2+
3+
# /etc/systemd/system/pingping.service
4+
[Unit]
5+
Description=pingping link quality oscilloscope
6+
After=network-online.target
7+
8+
[Service]
9+
ExecStart=/opt/pingping/pingping -c /opt/pingping/pingping.jsonc
10+
WorkingDirectory=/opt/pingping
11+
Restart=always
12+
RestartSec=5
13+
#2way #not root user
14+
# 1) sysctl net.ipv4.ping_group_range="0 2147483647"
15+
# 2) AmbientCapabilities=CAP_NET_RAW
16+
User=pingping
17+
AmbientCapabilities=CAP_NET_RAW
18+
19+
[Install]
20+
WantedBy=multi-user.target
21+
useradd -r -s /sbin/nologin pingping
22+
mkdir -p /opt/pingping && cp pingping /opt/pingping/ && chown -R pingping: /opt/pingping
23+
systemctl enable --now pingping
24+
25+
------------------------ssl behind caddy------
26+
27+
Caddy( auto HTTPS + basic auth):
28+
29+
ping.example.com {
30+
basic_auth {
31+
yong $2a$14$... # caddy hash-password
32+
}
33+
reverse_proxy 127.0.0.1:8517
34+
}
35+
Nginx:
36+
37+
server {
38+
listen 443 ssl;
39+
server_name ping.example.com;
40+
auth_basic "pingping";
41+
auth_basic_user_file /etc/nginx/htpasswd; # htpasswd -c generation
42+
43+
location / { proxy_pass http://127.0.0.1:8517; }
44+
}

docs/hero10.png

-168 KB
Binary file not shown.

docs/hero15.png

-128 KB
Binary file not shown.

docs/hero16.png

-267 KB
Binary file not shown.

docs/hero17.png

-179 KB
Binary file not shown.

0 commit comments

Comments
 (0)