Network measurement automation built on top of the Globalping API.
This script performs:
- Traceroute measurements
- HTTP measurements
- Country-level summaries
- ASN-based follow-up measurements (derived from traceroute results)
- Export to JSON, CSV, Prometheus, or StatsD
- Optional Prometheus HTTP exporter mode
The script:
- Runs traceroute from selected countries.
- Extracts ASN information from traceroute probes.
- Uses discovered ASN locations for follow-up measurements.
- Runs HTTP (and optionally ping) tests.
- Aggregates results:
- Per country
- Per country + matched hop alias
- Exports metrics or exposes them for monitoring systems.
{
"targets": [
"docs.example.com",
"console.example.com"
],
"port": 443,
"traceroute_enabled": true,
"ping_enabled": false,
"http_enabled": true,
"traceroute_protocol": "TCP",
"ping_protocol": "ICMP",
"http_protocol": "HTTPS",
"method": "GET",
"countries": [
{"DE": 10},
{"IT": 8},
{"ES": 5}
],
"check_hops": {
"internet_line1": "1.2.3.4",
"internet_line2": "5.6.7.8"
}
}List of domains to measure.
Port used for traceroute, ping, and HTTP measurements.
Enable/disable traceroute phase.
Enable/disable ping phase.
Enable/disable HTTP phase.
Protocol used for traceroute (TCP / UDP / ICMP).
Protocol used for ping (ICMP / TCP).
HTTP protocol (HTTP / HTTPS).
HTTP method (GET / POST / HEAD).
Defines probe distribution per country.
Example:
[
{"DE": 10},
{"IT": 8},
{"ES": 5}
]Optional mapping of hop aliases to IP addresses. Used during traceroute analysis to match specific network hops.
pip install requests prometheus-clientpython3 globaping.py --config config.jsonpython3 globaping.py --config config.json --token YOUR_API_TOKENpython3 globaping.py --config config.json --json-output results.jsonpython3 globaping.py --config config.json --csv-output results.csvpython3 globaping.py --config config.json --prometheus-output /var/lib/node_exporter/globalping.prompython3 globaping.py --config config.json --prometheus-http --listen 0.0.0.0:9105 --interval 300Metrics available at:
python3 globaping.py --config config.json --statsd-output 127.0.0.1:8125Config → Traceroute → ASN Extraction
↓
HTTP/Ping
↓
Aggregation
↓
Export (JSON / CSV / Prom / StatsD)
After execution, API rate limits are printed:
- Limit
- Remaining
- Reset time
- Multi-country latency monitoring
- ISP/ASN path validation
- Routing comparison between providers
- Prometheus-based SLO monitoring
- External uptime and performance checks
- If traceroute_enabled is true, follow-up measurements are ASN-based.
- If disabled, measurements use country-based limits only.
- Duplicated ASN probes are preserved intentionally to maintain probe distribution accuracy.