Perl module and command line tool for control over the Hetzner robot
Latest commit ed3493a Feb 15, 2011 @wertarbyte add server nickname


Hetzner::Robot /
by Stefan Tomanek <>

Control the Hetzner robot from your Perl scripts or console.

The script can be used as a standalone program as well as an
object oriented Perl module in your own scripts. It uses the JSON-Webservice
deployed by Hetzner ( and
encapsulates it into a class/object structure. Many default operations are
provided through a command line interface.

== Examples for standalone operation ==

# retrieve reverse DNS entry for IP address --user "USERNAME" --password "PASSWORD" \
    --mode rdns --get --addr

# set reverse DNS entry for address to "" --user "USERNAME" --password "PASSWORD" \
    --mode rdns --set --addr --hostname

# instruct the hetzner robot to trigger a hardware reset at server --user "USERNAME" --password "PASSWORD" \
    --mode reset --address --method hw

# enable the rescue system for server --user "USERNAME" --password "PASSWORD" \
    --mode rescue --address --system linux --arch 64

# send Wake-On-LAN signal to system --user "USERNAME" --password "PASSWORD" \
    --mode wol --address

# switch failover address to server --user "USERNAME" --password "PASSWORD" \
    --mode failover --address --target

# retrieve status of a failover address --user "USERNAME" --password "PASSWORD" \
    --mode failover --address --status

# to hide the password from the command line, it can be read from stdin:

echo "passphrase" | --user "USERNAME" --readpw ...

== Examples for use in scripts ==

# load module
use Hetzner::Robot;

my $robot = new Hetzner::Robot("username", "password");
my $serverA = $robot->server("");
# enumerate subnets assigned to server
for my $n ($serverA->subnets) {
    print $n->address."/".$n->netmask, "\n";

# send WOL signal to all servers
for my $sys ($robot->servers) {
    print "Waking up ".$sys->address."\n";
    # $sys->reset->execute("sw"); # we could trigger a soft reboot as well ;-)

The examples directory also contains a simple CGI script to grant customers
limited access to the reverse DNS capabilities of the robot; each customer
can access the RDNS records of the addresses associated with their username.