vmware / vsphere-automation-sdk-python

Python samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
MIT License
748 stars 311 forks source link

Sample for using appliance Monitoring #257

Closed karaatanassov closed 3 years ago

karaatanassov commented 3 years ago

This sample shows how to use the appliance Monitoring interface.

The sample calls:

  1. Monitoring.list() API to obtain list of counters.
  2. Monitoring.query() API to obtain CPU and Memory statistics for the last 5 days

Sample output (table with formatted time series data):

vcenter server = sc2-rdops-vm06-dhcp-192-66.eng.vmware.com
vc username = administrator@vsphere.local
Example: Query Monitoring for Timeseries Data:
-------------------

Metric                   2021-01-11              2021-01-12              2021-01-13              
cpu.totalfrequency       4788.91000000003        4788.910000000093       4788.910000000022       
cpu.systemload           0.6416814159292042      0.567210599721061       0.5591065830721007      
mem.util                 12477816.737463126      12260877.439330544      12179708.608150471      
mem.total                16413756.0              16413756.0              16413756.0              
mem.usage                76.02048390059609       74.69879191167777       74.20427480553785       
cpu.util                 13.568788627868807      12.823087055205912      11.284068845256204      
cpu.steal                0.0                     0.0                     0.0                     
swap.pageRate            1.3171504645318802e-05  1.1718624350229224e-05  1.166378552013087e-05 
vmwclabot commented 3 years ago

@karaatanassov, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <john.doe@email.org> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.