Index: html/includes/graphs/application/vmwaretools_cpu.inc.php
===================================================================
--- html/includes/graphs/application/vmwaretools_cpu.inc.php (revision 0)
+++ html/includes/graphs/application/vmwaretools_cpu.inc.php (revision 0)
@@ -0,0 +1,34 @@
+ array('descr' => 'CPU speed'),
+ 'vmcpulimit' => array('descr' => 'CPU limit'),
+ 'vmcpures' => array('descr' => 'CPU reservation'),
+ );
+
+$i = 0;
+
+if (is_file($rrd_filename))
+{
+ foreach ($array as $ds => $data)
+ {
+ $rrd_list[$i]['filename'] = $rrd_filename;
+ $rrd_list[$i]['descr'] = $data['descr'];
+ $rrd_list[$i]['ds'] = $ds;
+ $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i];
+ $i++;
+ }
+} else {
+ echo("file missing: $file");
+}
+
+include("includes/graphs/generic_multi_line.inc.php");
+?>
Index: html/includes/graphs/application/vmwaretools_mem.inc.php
===================================================================
--- html/includes/graphs/application/vmwaretools_mem.inc.php (revision 0)
+++ html/includes/graphs/application/vmwaretools_mem.inc.php (revision 0)
@@ -0,0 +1,64 @@
+ 'Reservation shows the guaranteed memory allocation on this virtual machine, Limit is the upper limit for memory useage on this virtual machine, vSwap show the memory swapped to the ESX host from this virtual machine, Balloon show how much memory is being ballooned on this virtual machine.', 'rrds' => array($rrd_filename));
+
+}
+?>
Index: html/pages/device/apps/vmwaretools.inc.php
===================================================================
--- html/pages/device/apps/vmwaretools.inc.php (revision 0)
+++ html/pages/device/apps/vmwaretools.inc.php (revision 0)
@@ -0,0 +1,15 @@
+ 'Memory Resource Allocation',
+ 'vmwaretools_cpu' => 'CPU Resource Allocation');
Index: includes/polling/applications/vmwaretools.inc.php
===================================================================
--- includes/polling/applications/vmwaretools.inc.php (revision 0)
+++ includes/polling/applications/vmwaretools.inc.php (revision 0)
@@ -0,0 +1,56 @@
+>>
+//vmtotalmem:2051
+//vmswap:117
+//vmballoon:1302
+//vmmemres:256
+//vmmemlimit:U
+//vmspeed:2660000000
+//vmcpulimit:U
+//vmcpures:0
+
+if (!empty($agent_data['app']['vmwaretools']))
+{
+ $vmwaretools = $agent_data['app']['vmwaretools'];
+
+ // Parse the data, first try key:value format
+ $lines = explode("\n", $vmwaretools);
+ foreach ($lines as $line) {
+
+ // Parse key:value line
+ list($key, $value) = explode(':', $line, 2);
+ $values[$key] = $value;
+ }
+
+
+ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-vmwaretools-".$app['app_id'].".rrd";
+
+ list ($vmtotalmem, $vmswap, $vmballoon) = explode("\n", $agent_data['app']['vmwaretools']);
+
+ if (!is_file($rrd_filename))
+ {
+ rrdtool_create($rrd_filename, " \
+ DS:vmtotalmem:GAUGE:600:0:1000000 \
+ DS:vmswap:GAUGE:600:0:1000000 \
+ DS:vmballoon:GAUGE:600:0:1000000 \
+ DS:vmmemres:GAUGE:600:0:1000000 \
+ DS:vmmemlimit:GAUGE:600:0:1000000 \
+ DS:vmspeed:GAUGE:600:0:10000000000 \
+ DS:vmcpulimit:GAUGE:600:0:10000000000 \
+ DS:vmcpures:GAUGE:600:0:10000000000 ");
+ }
+
+ // Construct the data
+ $rrd_data = "";
+ $rrd_keys = array('vmtotalmem', 'vmswap', 'vmballoon', 'vmmemres', 'vmmemlimit', 'vmspeed', 'vmcpulimit', 'vmcpures');
+
+ foreach ($rrd_keys as $key)
+ {
+ $rrd_data .= ":".$values[$key];
+ }
+
+ rrdtool_update($rrd_filename, "N".$rrd_data);
+}
+
+?>
Index: scripts/agent-local/vmwaretools
===================================================================
--- scripts/agent-local/vmwaretools (revision 0)
+++ scripts/agent-local/vmwaretools (revision 0)
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# vmwaretools agent script by dennis@kruyt.org
+#
+# This will add support for vmware's mem/cpu resource allocations for the virtual machine to observium.
+#
+# Install:
+# make sure you have vmware tools running on the virtual machine.
+# copy script/agent-local/vmwaretools to /usr/lib/observium_agent/local on the virtual machine
+#
+
+VMWARETOOLBOX=/usr/bin/vmware-toolbox-cmd
+
+if [ -f $VMWARETOOLBOX ];
+ then
+ echo "<<>>"
+ echo -n "vmtotalmem:"
+ expr `free -k | grep ^Mem | awk '{print $2}'` / 1000
+ echo -n "vmswap:"
+ $VMWARETOOLBOX stat swap | cut -d" " -f1
+ echo -n "vmballoon:"
+ $VMWARETOOLBOX stat balloon | cut -d" " -f1
+ echo -n "vmmemres:"
+ $VMWARETOOLBOX stat memres | cut -d" " -f1
+ echo -n "vmmemlimit:"
+ memlimit=` $VMWARETOOLBOX stat memlimit | cut -d" " -f1`
+ if [ $memlimit = 4294967295 ];
+ then
+ memlimit=U
+ fi
+ echo $memlimit
+ echo -n "vmspeed:"
+ expr `$VMWARETOOLBOX stat speed | cut -d" " -f1` \* 1000000
+ echo -n "vmcpulimit:"
+ cpulimit=` $VMWARETOOLBOX stat cpulimit | cut -d" " -f1`
+ if [ $cpulimit = 4294967295 ];
+ then
+ cpulimit=U
+ else
+ cpulimit=`expr $cpulimit \* 1000000`
+ fi
+ echo $cpulimit
+ echo -n "vmcpures:"
+ expr `$VMWARETOOLBOX stat cpures | cut -d" " -f1` \* 1000000
+
+fi
Property changes on: scripts/agent-local/vmwaretools
___________________________________________________________________
Added: svn:executable
+ *