blog:vcenter_vm_monitoring_with_graphite

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
blog:vcenter_vm_monitoring_with_graphite [2014/10/01 02:44] – created brettblog:vcenter_vm_monitoring_with_graphite [2014/10/01 04:12] (current) brett
Line 3: Line 3:
 This was done on a CentOS 6.3 server your mileage may vary on another platform. This was done on a CentOS 6.3 server your mileage may vary on another platform.
  
-{{:blog:graphite-vc-tree.png?nolink|}}+The problem I was trying to solve was that I wanted to monitor the vitals of all my VM's without having to install collectd into each VM, by talking to vCenter we can pull everything out that we need.  This work was inspired by [[https://github.com/llambiel/collectd-vcenter|collectd-vcenter]] which I could not get to work as its assumes you have an ESX Cluster.  So I wrote my own.
  
-You will need to have a version of collectd compiled that has the python plugin enabled.  This can be down by downloading the collectd source and building it, making sure to have python-devel package installed.+See details on setting up [[livebox/graphite]] which I used for my xAP monitoring  
 + 
 +{{:blog:graphite-vc-tree.png?nolink|}}
  
 We don't use the collectd RPM from the EPEL repository as its too old and does not have the graphite_write plugin. We don't use the collectd RPM from the EPEL repository as its too old and does not have the graphite_write plugin.
 +
 +You will need to have a version of collectd compiled that has the python plugin enabled.  This can be down by downloading the collectd source and building it, making sure to have python-devel package installed.
  
 Mathew has a good write on the graphite / collectd compilation and configuration for graphite.  http://blog.matthewdfuller.com/2014/06/sending-collectd-metrics-to-graphite.html Mathew has a good write on the graphite / collectd compilation and configuration for graphite.  http://blog.matthewdfuller.com/2014/06/sending-collectd-metrics-to-graphite.html
Line 13: Line 17:
 Be sure to have this installed before run "./configure" Be sure to have this installed before run "./configure"
 <code> <code>
 +yum install python
 yum install python-devel yum install python-devel
-<code>+</code>
  
 The configuration of /opt/collectd/etc/collectd.conf requires the following entries.  Adjust the Username, Vcenter and Password to suit your environment. The configuration of /opt/collectd/etc/collectd.conf requires the following entries.  Adjust the Username, Vcenter and Password to suit your environment.
Line 36: Line 41:
 </code> </code>
  
-This works fine in my lab where I have a single vCenter instance.+You'll need to have [[http://code.google.com/p/pysphere/|pysphere]] installed.  Paraphrasing the installation: 
 +<code> 
 +yum install python-setuptools 
 +easy_install -U pysphere 
 +</code> 
 +The magic script that pulls all the stats we need.  This works in my ESX 5.1 lab where I have a single vCenter instance. 
 + 
 +vcenter.py
 <code python> <code python>
 #!/usr/bin/python #!/usr/bin/python
Line 47: Line 59:
  
 # Metric and reporting type as a value # Metric and reporting type as a value
 +# https://collectd.org/wiki/index.php/Data_source
 +# /opt/collectd/share/collectd/types.db
 +# https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.Summary.QuickStats.html
 METRIC={"name":None, METRIC={"name":None,
         "runtime.powerState":None,         "runtime.powerState":None,
-        "summary.quickStats.overallCpuUsage":"gauge",+        "summary.quickStats.overallCpuUsage":"cpufreq",  # Mhz
         "summary.quickStats.uptimeSeconds":"gauge",         "summary.quickStats.uptimeSeconds":"gauge",
         "summary.quickStats.guestMemoryUsage":"bytes",         "summary.quickStats.guestMemoryUsage":"bytes",
         "summary.quickStats.hostMemoryUsage":"bytes",         "summary.quickStats.hostMemoryUsage":"bytes",
-        "summary.quickStats.overallCpuUsage":"gauge", 
         "config.hardware.memoryMB":"bytes"}         "config.hardware.memoryMB":"bytes"}
  
Line 158: Line 172:
 </code> </code>
  
-{{tag>graphite,python,esx}}+{{tag>graphite python esx}}
  
 ~~LINKBACK~~ ~~LINKBACK~~
  
  
  • blog/vcenter_vm_monitoring_with_graphite.1412131457.txt.gz
  • Last modified: 2014/10/01 02:44
  • by brett