APATIT is a set of exporters for the Website and Server Monitoring Service Ping-Admin.com. APATIT collects, processes and publishes the tasks monitoring metrics and statistics.
- 🔄 Automatic Metrics Collection: Periodically fetches metrics from Ping-Admin API for multiple tasks
- 📊 Prometheus Integration: Exposes metrics in standard Prometheus format at
/metrics - 📈 JSON Stats API: Provides additional JSON endpoints for task statistics
- 🌍 Location Translation: Supports translation of location names via
locations.json - 🚀 Concurrent Processing: Efficiently processes multiple tasks in parallel
- 🔁 Automatic Cleanup: Removes stale metrics when monitoring points are no longer available
- 🐳 Docker Support: Ready-to-use Docker image
docker run --rm -d \
--name apatit \
-p 8080:8080 \
-e API_KEY=your-api-key \
-e TASK_IDS=1,2,3 \
ghcr.io/ostrovok-tech/apatit:latest- Clone the repository:
git clone https://github.com/ostrovok-tech/apatit.git
cd apatit- Build the binary:
go build -o apatit ./cmd/apatit- Run the exporter:
./apatit --api-key=your-api-key --task-ids=1,2,3The exporter can be configured via command-line flags or environment variables.
| Flag | Environment Variable | Description | Default |
|---|---|---|---|
--api-key |
API_KEY |
Ping-Admin API key | required |
--task-ids |
TASK_IDS |
Comma-separated list of task IDs | required |
| Flag | Environment Variable | Description | Default |
|---|---|---|---|
--listen-address |
LISTEN_ADDRESS |
HTTP server listen address | :8080 |
--log-level |
LOG_LEVEL |
Log level (debug, info, warn, error) | info |
--locations-file |
LOCATIONS_FILE |
Path to locations.json file | locations.json |
--eng-mp-names |
ENG_MP_NAMES |
Translate MP names to English | true |
--refresh-interval |
REFRESH_INTERVAL |
Metrics refresh interval | 3m |
--api-update-delay |
API_UPDATE_DELAY |
Ping-Admin API data update delay | 4m |
--api-data-time-step |
API_DATA_TIME_STEP |
Time between API data points | 3m |
--max-allowed-staleness-steps |
MAX_ALLOWED_STALENESS_STEPS |
Max staleness steps before marking MP as unavailable | 3 |
--max-requests-per-second |
MAX_REQUESTS_PER_SECOND |
Maximum number of API requests allowed per second | 2 |
--request-delay |
REQUEST_DELAY |
Minimum delay before API request (randomized) | 3s |
--request-retries |
REQUEST_RETRIES |
Maximum number of retries for API requests | 3 |
./apatit \
--api-key=your-api-key \
--task-ids=1,2,3 \
--listen-address=:9090 \
--refresh-interval=5m \
--log-level=debugOr using environment variables:
export API_KEY=your-api-key
export TASK_IDS=1,2,3
export REFRESH_INTERVAL=5m
export LOG_LEVEL=debug
./apatit/- Home page with links to metrics and stats/metrics- Prometheus metrics endpoint/stats?type=task- JSON endpoint for task statistics/stats?type=all- JSON endpoint for all tasks information
Add the following to your prometheus.yml:
scrape_configs:
- job_name: 'apatit'
static_configs:
- targets: ['localhost:8080']The exporter exposes the following Prometheus metrics:
apatit_service_info- Information about the APATIT service (version, name, owner)
apatit_exporter_refresh_interval_seconds- Configured refresh intervalapatit_exporter_max_allowed_staleness_steps- Configured staleness thresholdapatit_exporter_refresh_duration_seconds{task_id, task_name}- Duration of last refresh cycleapatit_exporter_loops_total{exporter_type}- Total number of refresh loops for each exporter typeapatit_exporter_errors_total{error_module, error_type, task_id, task_name}- Total number of errors
All MP metrics include labels: task_id, task_name, mp_id, mp_name, mp_ip, mp_gps
apatit_mp_status- Status of monitoring point (1 = up, 0 = down/stale)apatit_mp_data_status- Status of the data for the monitoring point (1 = has data, 0 = no data)apatit_mp_connect_seconds- Connection establishment timeapatit_mp_dns_lookup_seconds- DNS lookup timeapatit_mp_server_processing_seconds- Server processing timeapatit_mp_total_duration_seconds- Total request durationapatit_mp_speed_bytes_per_second- Download speedapatit_mp_last_success_timestamp_seconds- Timestamp of last successful data pointapatit_mp_last_success_delta_seconds- Time since last successful data pointapatit_mp_data_staleness_steps- Number of missed API data steps (0 = fresh)
apatit/
├── cmd/
│ └── apatit/
│ └── main.go # Application entry point
├── internal/
│ ├── cache/ # Cache implementation
│ ├── client/ # Ping-Admin API client
│ ├── config/ # Configuration management
│ ├── exporter/ # Metrics and stats exporters logic
│ ├── log/ # Logging setup
│ ├── scheduler/ # Metrics and stats schedulers
│ ├── server/ # HTTP server
│ ├── translator/ # Location name translation
│ ├── utils/ # Utility functions
│ └── version/ # Version information
├── deploy/
│ └── docker-compose.yaml # Docker Compose configuration
├── Dockerfile # Container image definition
├── locations.json # Location translation mappings
└── go.mod # Go module definition
For issues and feature requests, please use the GitHub Issues page.
