Skip to content

Instantly share code, notes, and snippets.

"""
Reboot a SoftLayer server
Given a server id call the rebootDefault() method in the
SoftLayer_Hardware_Server service to attempt to reboot the server via IPMI or
its power strip if remote management is unavailable. See
<http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/rebootDefault>
for more information.
This script assumes you're using the SoftLayer API Python client
<?php
/**
* Get the recurring cost of a single server or all servers on your account.
*
* Perform two operations:
* 1) Get a list of servers on a SoftLayer account along with their recurring
* monthly costs. We can get that by calling getHardware() in the
* SoftLayer_Account API service with an object mask to retrieve cost.
* 2) Get the cost for a single server by calling getCost() in the
* SoftLayer_Hardware_Server service.
@softlayer
softlayer / gist:2560998
Created April 30, 2012 18:42
Identify status of LB resources
#!/usr/bin perl
use warnings;
use strict;
use SoftLayer::API::SOAP;
# Set SLAPI User and Key
my $api_username = '';
my $api_key = '';
# ID of LoadBalancer to poll
# Create a network monitor
# So we can talk to the SoftLayer API:
import SoftLayer.API
# For nice debug output:
import pprint
pp = pprint.PrettyPrinter(indent=4)
# Your SoftLayer API username and key.
@softlayer
softlayer / gist:815278
Created February 7, 2011 21:39
setReverseDns
<?php
/**
* Add/update a reverse DNS record by providing an IP and FQDN.
*
* This assumes the SoftLayer API PHP client
* <http://github.com/softlayer/softlayer-api-php-client> is installed in the
* directory '/SoftLayer' in this script's path and that you wish to use the
* SOAP client instead of our XML-RPC client.
*
* @see http://sldn.softlayer.com/wiki/index.php/SoftLayer_Network_Subnet
@softlayer
softlayer / gist:815182
Created February 7, 2011 20:53
getReverseRecords
<?php
/**
* Recieve an indexed array of IPs and their associated reverse DNS hostnames
* when providing an IP address. This reuiqres two api calls to accomplish,
* one to retrieve the privded IP address's subnet ID, then to get all of the
* reverse DNS records for that subnet.
*
* This assumes the SoftLayer API PHP client
* <http://github.com/softlayer/softlayer-api-php-client> is installed in the
* directory '/SoftLayer' in this script's path and that you wish to use the
@softlayer
softlayer / getServerBandwidthImage.php
Created November 6, 2010 18:24
Retrieve a bandwidth graph for a single server.
<?php
/**
* Retrieve a bandwidth graph for a single server.
*
* Retrieve a bandwidth graph for a single server for an arbitrary start and
* end date, specifying graph size and other graphing options. We can do this
* with two calls to the SoftLayer API.
*
* Counter data such as bandwidth counters and CCI resource use are stored in
* a server's metric tracking object. Our first call retrieves that server's
// Retrieve account VLAN and subnet information per server.
//
// Retrieve a list of all servers associated with a SoftLayer customer account
// and print a simple report detailing their VLANs and the subnets assigned to
// them. We do this with a call to the getHardare() method in the
// SoftLayer_Account API service using an object mask to retrieve the hardware,
// VLANs, VLANs' associated subnets and primary router records. See below for
// more details.
//
// Backend code to call the SoftLayer API was generated with the wsdl.exe
<?php
/**
* Order a control panel license for a virtual private server (VPS).
*
* Build a SoftLayer_Container_Product_Order_Software_Component_Virtual object
* for a new control panel license order and pass it to the
* SoftLayer_Product_Order API service to order it. See below for more details.
*
* This assumes the SoftLayer API PHP client
* <http://github.com/softlayer/softlayer-api-php-client> is installed in the
// Order a new SoftLayer IP subnet
//
// Build a SoftLayer_Container_Product_Order_Network_Subnet object for a new IP
// subnet order and pass it to the SoftLayer_Product_Order API service to order
// it. See below for more details.
//
// Backend code to call the SoftLayer API was generated with the wsdl.exe
// utility:
//
// wsdl.exe /language:CS /out:"C:\path\to\project\SoftLayer_API.cs" /sharetypes http://api.service.softlayer.com/soap/v3/SoftLayer_Product_Order?wsdl