GithubHelp home page GithubHelp logo

wertarbyte / hetzner-robot-perl Goto Github PK

View Code? Open in Web Editor NEW
19.0 4.0 4.0 145 KB

Perl module and command line tool for control over the Hetzner robot

Home Page: http://wertarbyte.de/

Perl 100.00%

hetzner-robot-perl's Introduction

Hetzner::Robot / hetzner-robot.pl
by Stefan Tomanek <[email protected]>

http://github.com/wertarbyte/hetzner-robot-perl

Control the Hetzner robot from your Perl scripts or console.

The script hetzner-robot.pl 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 (http://wiki.hetzner.de/index.php/Robot_Webservice) 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 1.2.3.4

hetzner-robot.pl --user "USERNAME" --password "PASSWORD" \
    --mode rdns --get --addr 1.2.3.4

# set reverse DNS entry for address 1.2.3.4 to "foobar.example.org"

hetzner-robot.pl --user "USERNAME" --password "PASSWORD" \
    --mode rdns --set --addr 1.2.3.4 --hostname foobar.example.org

# instruct the hetzner robot to trigger a hardware reset at server 1.2.3.4

hetzner-robot.pl --user "USERNAME" --password "PASSWORD" \
    --mode reset --address 1.2.3.4 --method hw

# enable the rescue system for server 1.2.3.4

hetzner-robot.pl --user "USERNAME" --password "PASSWORD" \
    --mode rescue --address 1.2.3.4 --system linux --arch 64

# send Wake-On-LAN signal to system 1.2.3.4

hetzner-robot.pl --user "USERNAME" --password "PASSWORD" \
    --mode wol --address 1.2.3.4

# switch failover address to server 1.2.3.4

hetzner-robot.pl --user "USERNAME" --password "PASSWORD" \
    --mode failover --address 5.6.7.8 --target 1.2.3.4

# retrieve status of a failover address

hetzner-robot.pl --user "USERNAME" --password "PASSWORD" \
    --mode failover --address 5.6.7.8 --status

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

echo "passphrase" | hetzner-robot.pl --user "USERNAME" --readpw ...

== Examples for use in scripts ==

#!/usr/bin/perl
# load module
use Hetzner::Robot;

my $robot = new Hetzner::Robot("username", "password");
my $serverA = $robot->server("1.2.3.4");
# 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->wol->execute;
    # $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.

hetzner-robot-perl's People

Contributors

simonswine avatar wertarbyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.