Created
September 27, 2011 13:48
-
-
Save enygma/1245080 to your computer and use it in GitHub Desktop.
Pull the bandwidth graph data for a server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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