Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieving Azure Performance Counters
    primarykey
    data
    text
    <p>I am in the process of coding a cloud monitoring application and coudnt find useful logic of getting performance counters from AZURE php SDK documentation(such as CPU utilization, disk utilization, ram usage). </p> <p>can anybody help ??</p> <pre><code>define('PRODUCTION_SITE', false); // Controls connections to cloud or local storage define('AZURE_STORAGE_KEY', '&lt;your_storage_key&gt;'); define('AZURE_SERVICE', '&lt;your_domain_extension&gt;'); define('ROLE_ID', $_SERVER['RoleDeploymentID'] . '/' . $_SERVER['RoleName'] . '/' . $_SERVER['RoleInstanceID']); define('PERF_IN_SEC', 30); // How many seconds between times dumping performance metrics to table storage /** Microsoft_WindowsAzure_Storage_Blob */ require_once 'Microsoft/WindowsAzure/Storage/Blob.php'; /** Microsoft_WindowsAzure_Diagnostics_Manager **/ require_once 'Microsoft/WindowsAzure/Diagnostics/Manager.php'; /** Microsoft_WindowsAzure_Storage_Table */ require_once 'Microsoft/WindowsAzure/Storage/Table.php'; if(PRODUCTION_SITE) { $blob = new Microsoft_WindowsAzure_Storage_Blob( 'blob.core.windows.net', AZURE_SERVICE, AZURE_STORAGE_KEY ); $table = new Microsoft_WindowsAzure_Storage_Table( 'table.core.windows.net', AZURE_SERVICE, AZURE_STORAGE_KEY ); } else { // Connect to local Storage Emulator $blob = new Microsoft_WindowsAzure_Storage_Blob(); $table = new Microsoft_WindowsAzure_Storage_Table(); } $manager = new Microsoft_WindowsAzure_Diagnostics_Manager($blob); ////////////////////////////// // Bring in global include file require_once('setup.php'); // Performance counters to subscribe to $counters = array( '\Processor(_Total)\% Processor Time', '\TCPv4\Connections Established', ); // Retrieve the current configuration information for the running role $configuration = $manager-&gt;getConfigurationForRoleInstance(ROLE_ID); // Add each subscription counter to the configuration foreach($counters as $c) { $configuration-&gt;DataSources-&gt;PerformanceCounters-&gt;addSubscription($c, PERF_IN_SEC); } // These settings are required by the diagnostics manager to know when to transfer the metrics to the storage table $configuration-&gt;DataSources-&gt;OverallQuotaInMB = 10; $configuration-&gt;DataSources-&gt;PerformanceCounters-&gt;BufferQuotaInMB = 10; $configuration-&gt;DataSources-&gt;PerformanceCounters-&gt;ScheduledTransferPeriodInMinutes = 1; // Update the configuration for the current running role $manager-&gt;setConfigurationForRoleInstance(ROLE_ID,$configuration); /////////////////////////////////////// // Bring in global include file //require_once('setup.php'); // Grab all entities from the metrics table $metrics = $table-&gt;retrieveEntities('WADPerformanceCountersTable'); // Loop through metric entities and display results foreach($metrics AS $m) { echo $m-&gt;RoleInstance . " - " . $m-&gt;CounterName . ": " . $m-&gt;CounterValue . "&lt;br/&gt;"; } </code></pre> <p>this is the code I crafted to extract processor info ...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload