Monitor Vmware ESX

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
csexton127
Posts: 2
Joined: Mon Mar 28, 2011 12:26 pm

Re: Monitor Vmware ESX

Post by csexton127 »

Has anyone else had an issue where cacti isn't adding the data to the rrd? I have set up the scripts according to Lee's post (great job, you're a life saver), and I'm able to get the data returned using the scripts:

Code: Select all

[root@server rra]# /home/www/cacti/scripts/esxiograph.sh cpu_vs XX.XX.XX.XX cacti "password"                       
usage:5.20
I did an import of the cacti template provided, changed the data input method to point to the script location:

Code: Select all

<path_cacti>/scripts/esxiograph.sh <command> <ip> <vmname> <username> <password>
After adding a device/datasources/graphs, and letting the poller run a few times, I noticed that the graphs were not getting created. When I check the rrd file for the datasource, I notice that all of the values in it are NaN's. This is for all of the scripts vs or vm, so it's something I'm missing on my cacti side. Has anyone seen/fixed an issue like that? I'm using cacti 0.8.7g.
ldjones48
Posts: 17
Joined: Tue Feb 15, 2011 6:33 am

Re: Monitor Vmware ESX

Post by ldjones48 »

csexton127 wrote:Has anyone else had an issue where cacti isn't adding the data to the rrd? I have set up the scripts according to Lee's post (great job, you're a life saver), and I'm able to get the data returned using the scripts:

Code: Select all

[root@server rra]# /home/www/cacti/scripts/esxiograph.sh cpu_vs XX.XX.XX.XX cacti "password"                       
usage:5.20
I did an import of the cacti template provided, changed the data input method to point to the script location:

Code: Select all

<path_cacti>/scripts/esxiograph.sh <command> <ip> <vmname> <username> <password>
After adding a device/datasources/graphs, and letting the poller run a few times, I noticed that the graphs were not getting created. When I check the rrd file for the datasource, I notice that all of the values in it are NaN's. This is for all of the scripts vs or vm, so it's something I'm missing on my cacti side. Has anyone seen/fixed an issue like that? I'm using cacti 0.8.7g.
Hi csexton127, what does the RRD tool error checking say? that fact that you are actually getting a graph is a good start. What are the permissions like on the file / folder where the script is located? Try making it 777 to make sure its not a permissions issues.

Lee
mamema
Posts: 5
Joined: Sun Oct 25, 2009 5:12 pm

Re: Monitor Vmware ESX

Post by mamema »

[/quote]

Hi Mamema,

Good to see it was useful. Out of interest how many VM's are you polling? What is the load on your cacti server like?

Lee[/quote]

polling 25 machines. load on cacti server is constantly on 50% CPU
csexton127
Posts: 2
Joined: Mon Mar 28, 2011 12:26 pm

Re: Monitor Vmware ESX

Post by csexton127 »

Hi csexton127, what does the RRD tool error checking say? that fact that you are actually getting a graph is a good start. What are the permissions like on the file / folder where the script is located? Try making it 777 to make sure its not a permissions issues.

Lee
Hey Lee, thanks for the reply. It ended up being a permissions issue with the cacti user and perl. The cacti user didn't have permissions to the perl libraries and modules so would fail when trying to run the scripts. I thought it was running correctly because I was testing the scripts as root.

Another issue I seem to be having is that the SDK doesn't seem to want to return any network statistics if there are multiple active NIC's. I know the VM is receiving traffic because of the guest servers show traffic statistics. I'm polling the guest servers through the VCenter server and the VM host server directly.

Code: Select all

[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET
CHECK_ESX3.PL OK - net receive=0.00 KB/s, send=0.00 KB/s, all 3 NICs are connected | net_receive=0.00KB;; net_send=0.00KB;; OK_NICs=3;; Bad_NICs=0;;
[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET -s USAGE
CHECK_ESX3.PL OK - net usage=302.29 KB/s | net_usage=302.29KB;;
[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET -s RECEIVE
CHECK_ESX3.PL OK - net receive=0.00 KB/s | net_receive=0.00KB;;
[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET -s SEND
CHECK_ESX3.PL OK - net send=0.00 KB/s | net_send=0.00KB;;
It seems to work as intended when I pull data from a VMWare server that only has 1 NIC. From what I can tell, this may be a problem with the SDK? I am using version 4.1.0-254719 of the SDK and ESX 4.0.0.


EDIT: It seems that with my version the lines calling the host performance values did not like the wildcard for the interface:

Code: Select all

$values = return_host_performance_values($host, 'net', ('received.average:*'));
Once I hardcoded the interface name into the script I was getting correct data back. In our environment we only have 1 NIC that was used, and the other 2 were for backup purposes only. While not an elegant solution, it does solve my immediate problem with the network statistics until we have to fail over. This fix would not work if you have traffic flowing on multiple NIC's. This may only be an issue with ESX 4 or a newer version of the SDK, and I will try and find a better solution. Here is an example of what I changed.

Code: Select all

$values = return_host_performance_values($host, 'net', (received.average:vmnic0'));
User avatar
gninja
Cacti User
Posts: 371
Joined: Tue Aug 24, 2004 5:02 pm
Location: San Francisco, CA
Contact:

Re: Monitor Vmware ESX

Post by gninja »

ironique wrote:Have followed your guide, but when I test the check_esx3.pl to see if it returns anything, I get the following:

CHECK_ESX3.PL CRITICAL - Server version unavailable at 'https://<vCenter-IP>:443/sdk/vimService.wsdl' at /usr/share/perl/5.10/VMware/VICommon.pm line 545
VMWare deploys with self-signed ssl certs, and you're running perl modules that are recent enough that they'll view a self-signed cert as a fatal error.

Add this near the top of check_esx3.pl:

Code: Select all

$ENV{SSL_verify_mode} = 0x00;
FreeBSD/RHEL
cacti-0.8.7i, spine 0.8.7i, PIA 3.1+boost 5.1
MySQL 5.5/InnoDB
RRDtool 1.2.27, PHP 5.1.6
street41
Posts: 1
Joined: Mon Jun 06, 2011 8:15 am

Re: Monitor Vmware ESX

Post by street41 »

I have the same problem:

/usr/local/icinga/libexec/check_esx.pl -H 192.168.xxx.xxx -u xxxxxxxx -p xxxxxxxxxxxx -l cpu
CHECK_ESX.PL CRITICAL - Server version unavailable at 'https://192.168.xxx.xxx:443/sdk/vimService.wsdl' at /usr/lib/perl5/5.8.8/VMware/VICommon.pm line 545.

I tried to add this at the top of the check_esx.pl without any changes:

$ENV{SSL_verify_mode} = 0x00;

I had already verify that on my linux box i had install all the vmware-sdk requirments

Andrea
mamema
Posts: 5
Joined: Sun Oct 25, 2009 5:12 pm

Re: Monitor Vmware ESX

Post by mamema »

i want to share a (unusual) way to get to some metrics of vmware ESX (don't know if it would work with ESXi)

I was trying to get my hands on the hardware sensors (temperature) and here is how i've done it:

First in ESX there is a webpage of every host which can be accessed here:

https://<esx-server-address>/mob/?moid=ha-host&doPath=runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo

On a second task, i've parsed this page, looking for what i want

On a third task i was writing the values to a file

and on a last task, i have used a host which as net-snmp running, because with net-snmp the command "extend" is possible to let some scripts kick in, whenever a special MIB-OID is parsed. For example this line in snmpd.conf:

extend .1.3.6.1.4.1.2021.560 lms1 /root/read_sensor.sh

would launch read_sensor.sh whenever the suitable OID would be parsed an put the value which was delivered by the script into the OID

I have used another host to present a value for another machine (the ESX host) because i haven't net-snmp running on my ESX host and the https download and parsing and file creation is running on a windows host. Perhaps it's possible to enable net-snmp and use the "extend" command on the ESX host itself. I haven't tested this.

After this, it's easy to make a Cacti graph which parses the suitable OID

regards

mamema
stulli
Posts: 1
Joined: Sat Jul 16, 2011 10:34 am

Re: Monitor Vmware ESX

Post by stulli »

Hi all!

Our network admins use Cacti and it would be great to use their installation to monitor our vSphere clusters, too. This thread is just what I need :)
ldjones48 wrote:each time you add a vm you need to add this in the cacti GUI. Thus if you removed one you would need to remove it. The reason being is it creates it own data collector per Virtual Machine not host.
What about http://docs.cacti.net/plugin:discovery? Maybe we could ask cigamit to provide a function like "addDiscoveredDevice()" and "removeDiscoveredDevice()" for this? Would be useful for other plugins monitoring virtualized environments, too.
ldjones48 wrote:
dmanchanda wrote:My graphs for VMs are working fine, but i want to get graphs for DISC IOs, Read, Write latencies from the LUNs attached to the hypervisor (HOST). any idea on this.
Not to sure on this to be honest, I know you can for each VM.
I havn't used the Perl SDK yet but I have been playing around with the web services API. Have a look at http://www.vmware.com/support/developer ... nager.html and especially at the performance counters documentations under "Performance Counters".

cu

stulli
ldjones48
Posts: 17
Joined: Tue Feb 15, 2011 6:33 am

Re: Monitor Vmware ESX

Post by ldjones48 »

csexton127 wrote:
Hi csexton127, what does the RRD tool error checking say? that fact that you are actually getting a graph is a good start. What are the permissions like on the file / folder where the script is located? Try making it 777 to make sure its not a permissions issues.

Lee
Hey Lee, thanks for the reply. It ended up being a permissions issue with the cacti user and perl. The cacti user didn't have permissions to the perl libraries and modules so would fail when trying to run the scripts. I thought it was running correctly because I was testing the scripts as root.

Another issue I seem to be having is that the SDK doesn't seem to want to return any network statistics if there are multiple active NIC's. I know the VM is receiving traffic because of the guest servers show traffic statistics. I'm polling the guest servers through the VCenter server and the VM host server directly.

Code: Select all

[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET
CHECK_ESX3.PL OK - net receive=0.00 KB/s, send=0.00 KB/s, all 3 NICs are connected | net_receive=0.00KB;; net_send=0.00KB;; OK_NICs=3;; Bad_NICs=0;;
[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET -s USAGE
CHECK_ESX3.PL OK - net usage=302.29 KB/s | net_usage=302.29KB;;
[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET -s RECEIVE
CHECK_ESX3.PL OK - net receive=0.00 KB/s | net_receive=0.00KB;;
[cacti@server scripts]$ perl check_esx3.pl -H X.X.X.X -u cacti -p "password" -l NET -s SEND
CHECK_ESX3.PL OK - net send=0.00 KB/s | net_send=0.00KB;;
It seems to work as intended when I pull data from a VMWare server that only has 1 NIC. From what I can tell, this may be a problem with the SDK? I am using version 4.1.0-254719 of the SDK and ESX 4.0.0.


EDIT: It seems that with my version the lines calling the host performance values did not like the wildcard for the interface:

Code: Select all

$values = return_host_performance_values($host, 'net', ('received.average:*'));
Once I hardcoded the interface name into the script I was getting correct data back. In our environment we only have 1 NIC that was used, and the other 2 were for backup purposes only. While not an elegant solution, it does solve my immediate problem with the network statistics until we have to fail over. This fix would not work if you have traffic flowing on multiple NIC's. This may only be an issue with ESX 4 or a newer version of the SDK, and I will try and find a better solution. Here is an example of what I changed.

Code: Select all

$values = return_host_performance_values($host, 'net', (received.average:vmnic0'));

Nice work on this! I was having trouble with our backup server that has two NICs, one for the network and another for a iSCSI target. I wanted to graph the network but it was just blank. I will use this to fix that issue.

Niceness!
astroalireza
Posts: 1
Joined: Wed Aug 03, 2011 11:42 am

Re: Monitor Vmware ESX

Post by astroalireza »

Whats wrong?

Code: Select all

perl /usr/share/cacti/site/scripts/check_esx3.pl -H <server-ip> -N <vm> -u <user> -p “<pass>” -l NET
Can't locate Nagios/Plugin.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/share/cacti/site/scripts/check_esx3.pl line 31.
BEGIN failed--compilation aborted at /usr/share/cacti/site/scripts/check_esx3.pl line 31.
User avatar
Echinocactus
Posts: 7
Joined: Mon Nov 08, 2010 2:43 pm

Re: Monitor Vmware ESX

Post by Echinocactus »

You have to install the CPAN Plugin:

perl -MCPAN -e 'install Nagios::Plugin'
thavinci
Posts: 26
Joined: Tue Nov 06, 2007 12:14 pm
Location: JHB
Contact:

Re: Monitor Vmware ESX

Post by thavinci »

Hi there.
feolener
I've got it.

The CPAN modules debian provides are a bit older than the once that are required and the ones that are required wouldn't install using CPAN.

I needed to manually make the CPAN modules. Now I do get output from the scripts..

Only IO gives all zero values. CPU and MEM for example work great
I would like to know from feolener which modules in particular he had to upgrade to get the script running....

I am also getting following:

Code: Select all

[root@gw2 /usr/local/share/cacti/scripts]# ./check_esx3.pl -H 192.168.0.254 -l mem -s usage -f test
CHECK_ESX3.PL CRITICAL - Server version unavailable at 'https://192.168.0.254:443/sdk/vimService.wsdl' at /usr/local/lib/perl5/site_perl/5.14.1/VMware/VICommon.pm line 545, <AUTH_FILE> line 2.

[root@gw2 /usr/local/share/cacti/scripts]# ./check_esx3.pl -H 192.168.0.254 -l mem -s usage -u root -p 'mypasswordhere'
CHECK_ESX3.PL CRITICAL - Server version unavailable at 'https://192.168.0.254:443/sdk/vimService.wsdl' at /usr/local/lib/perl5/site_perl/5.14.1/VMware/VICommon.pm line 545.
thavinci
Posts: 26
Joined: Tue Nov 06, 2007 12:14 pm
Location: JHB
Contact:

Re: Monitor Vmware ESX

Post by thavinci »

Oh and ive tried the

Code: Select all

$ENV{SSL_verify_mode} = 0x00;
method this morning with no changes in error message....
thavinci
Posts: 26
Joined: Tue Nov 06, 2007 12:14 pm
Location: JHB
Contact:

Re: Monitor Vmware ESX

Post by thavinci »

Ok for those in need i have found the issue ...

Add this instead to the top of youre perl script

Code: Select all

$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
visk
Posts: 4
Joined: Fri Nov 26, 2010 5:06 am

Re: Monitor Vmware ESX

Post by visk »

Does somebody has working host template for ESX 4.0 and cacti 0.8.7g ?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests