Skip to content

Instantly share code, notes, and snippets.

@softlayer
softlayer / gist:2998774
Created June 26, 2012 20:37
Retrieve Passwords for all servers...print in a table
<?php
require_once('SoftLayer/SoapClient.class.php');
/**
* Set your SoftLayer API username and key.
*/
$apiUsername = 'USER HERE';
$apiKey = 'KEY HERE';
@softlayer
softlayer / gist:2998759
Created June 26, 2012 20:36
Update DNS Zone
<?php
require_once('SoftLayer/SoapClient.class.php');
function updateDns() {
$apiUsername = 'USER HERE';
$apiKey = 'KEY HERE';
$domainId = 'DOMAIN ID HERE';
$dnsClient = SoftLayer_SoapClient::getClient('SoftLayer_Dns_Domain', $domainId, $apiUsername, $apiKey);
$recordClient = SoftLayer_SoapClient::getClient('SoftLayer_Dns_Domain_ResourceRecord', null , $apiUsername, $apiKey);
@softlayer
softlayer / gist:2789898
Created May 25, 2012 19:03
OSreload multiple servers by IP
<?php
require_once('SoftLayer/SoapClient.class.php');
/**
* Set your SoftLayer API username and key.
*/
$apiUsername = '';
$apiKey = '';
@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
@softlayer
softlayer / gist:2158553
Created March 22, 2012 14:10
Firewall rule creation command line tool
import SoftLayer.API
import ipaddr
def splitIpCidrNotation(arg):
ipv4 = ipaddr.IPv4Network(arg)
return str(ipv4.ip), str(ipv4.netmask)
def getClients(user, key):
# So we can talk to the SoftLayer API:
import SoftLayer.API
import argparse
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
apiUsername = ''
apiKey = ''
# 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:1006343
Created June 3, 2011 13:30
CCI order with IP questionnaire
<?php
require_once dirname(__FILE__) . '/SoftLayer/SoapClient.class.php';
/**
* Your SoftLayer API username.
*
* @var string
*/
$apiUsername = 'API_USERNAME';
<?php
/**
* Retrieve graphs for specific metrics for a single server.
*
* This example shows how to use the SoftLayer API to retrieve graphs for the
* specific Advanced Monitoring metrics for a single hardware or virtual guest
* server instance.
*
* We will call the SoftLayer API to retrieve the monitoring agents,
* configuration template, and configuration values for a server instance.
@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