Skip to content

Instantly share code, notes, and snippets.

@enygma
Created September 27, 2011 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enygma/1245080 to your computer and use it in GitHub Desktop.
Save enygma/1245080 to your computer and use it in GitHub Desktop.
Pull the bandwidth graph data for a server
<?php
/**
* Pull the bandwidth graph data from the SoftLayer API via a custom graph config object
*
*/
$metrics = array();
$metric = new SoftLayer_Container_Metric_Data_Type(null);
$metric->name = 'url_uptime';
$metric->summaryType = 'publicIn';
$metric->keyName = 'PUBLICIN';
$metrics[] = new SoapVar($metric,SOAP_ENC_OBJECT,
'SoftLayer_Container_Metric_Data_Type','http://api.service.softlayer.com/soap/v3/');
$startDateDt = new DateTime('2011-09-01');
$endDateDt = new DateTime('2011-09-27');
$graphContainer = new SoftLayer_Container_Graph();
$graphContainer->startDatetime = $startDateDT->format('U');
$graphContainer->endDatetime = $endDateDT->format('U');
$graphContainer->metrics = $metrics;
$graphContainer->interval = 86400;
$graphContainer = new SoapVar($graphContainer,SOAP_ENC_OBJECT,
'SoftLayer_Container_Graph','http://api.service.softlayer.com/soap/v3/');
$graphData = $soapClient->getCustomGraphData($graphContainer);
var_dump($graphData);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment