NAME
WWW::Hetzner::Robot::API::Traffic - Hetzner Robot Traffic API
VERSION
version 0.001
SYNOPSIS
my $robot = WWW::Hetzner::Robot->new(...);
# Query daily traffic for an IP
my $traffic = $robot->traffic->query(
type => 'day',
from => '2024-01-01T00',
to => '2024-01-02T00',
ip => '1.2.3.4',
);
# Query monthly traffic for multiple IPs
my $traffic = $robot->traffic->query(
type => 'month',
from => '2024-01-01',
to => '2024-02-01',
ip => ['1.2.3.4', '5.6.7.8'],
);
# Query with single_values for hourly breakdown
my $traffic = $robot->traffic->query(
type => 'day',
from => '2024-01-01T00',
to => '2024-01-02T00',
ip => '1.2.3.4',
single_values => 1,
);
DESCRIPTION
Query traffic statistics for IPs and subnets.
NAME
WWW::Hetzner::Robot::API::Traffic - Hetzner Robot Traffic API
METHODS
query
my $traffic = $robot->traffic->query(%params);
Query traffic statistics. Returns hashref with traffic data.
Parameters:
- type (required)
-
Type of traffic query:
day,month, oryear. - from (required)
-
Start date/time. Format depends on type:
day:
YYYY-MM-DDTHH(e.g., 2024-01-01T00)month:
YYYY-MM-DD(e.g., 2024-01-01)year:
YYYY-MM(e.g., 2024-01)
- to (required)
-
End date/time. Same format as
from. - ip
-
Single IP address or arrayref of IP addresses.
- subnet
-
Single subnet or arrayref of subnets.
- single_values
-
If true, returns data grouped by hour/day/month.
Response structure:
{
type => 'day',
from => '2024-01-01T00',
to => '2024-01-02T00',
data => {
'1.2.3.4' => {
in => 10.5, # GB inbound
out => 25.3, # GB outbound
sum => 35.8, # GB total
},
},
}
SUPPORT
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
https://github.com/Getty/p5-www-hetzner
git clone https://github.com/Getty/p5-www-hetzner.git
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.