Board index

Cheshire Cat Software

Steve Shipway's Discussion Groups
Locations of visitors to this page
It is currently Fri 03 Sep, 2010 3:43 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 107 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next
Author Message
 Post subject: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Sun 28 Sep, 2008 10:57 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
BETA BETA BETA BETA BETA BETA

This plugin, for both MRTG and Nagios, uses the VMware VI API to query the virtualcentre (or individual ESX hosts) to obtain information. It can be somewhat resource intensive. You will need to install the Perl API packages (available from http://www.vmware.com) and also SOAP::Lite and Class::MethodMaker.

Use the --help option to get a full list of available options.

It has a --generate option to generate the MRTG (or Nagios) configuration files required.

Try setting a configfile with the necessary information, then:
Code:
check_vmware.pl --mode=mrtg --guest=guestname --config=configfile --generate
check_vmware.pl --mode=mrtg --cluster=clustername --config=configfile --generate


Examples:
Checking a particular guest CPU usage in MRTG
Code:
check_vmware.pl --config=vmconfig --report=cpu --mode=mrtg --guest=list
Checking all guest statuses in a cluster in Nagios and sending alerts via NSCA
Code:
check_vmware.pl --config=vmconfig --report=status --mode=nagios --nsca --nscastrip='.auckland.ac.nz' --nscaserver=nagios.auckland.ac.nz --tolower


Example configfile contents:
Code:
VI_PASSWORD=fjdkhfjksd
VI_SERVER=vcserver.auckland.ac.nz
VI_USERNAME=myusername


Attachments:
File comment: version 0.12beta
check_vmware.pl [61.04 KB]
Downloaded 66 times
File comment: version 0.9 beta
check_vmware.pl [60.28 KB]
Downloaded 939 times
File comment: NRPE plugins for Linux and Windows to query vCPU and Memory via VMware Tools API
VMWare.zip [73.17 KB]
Downloaded 717 times
File comment: Version 0.2 BETA
check_vmware.pl [47.52 KB]
Downloaded 358 times

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11
Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Sun 28 Sep, 2008 11:07 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
Here are some example graphs, taken from MRTG


Attachments:
File comment: Farm datastores (total)
example-farm-datastores-graph.png
example-farm-datastores-graph.png [ 43.2 KB | Viewed 9396 times ]
File comment: Guest CPU usage
example-guest-cpu-graph.png
example-guest-cpu-graph.png [ 54.4 KB | Viewed 9385 times ]
File comment: Host resource usage
example-host-resources-graph.png
example-host-resources-graph.png [ 68.01 KB | Viewed 9388 times ]

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11
Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Thu 02 Oct, 2008 2:16 am 
Offline
User

Joined: Thu 02 Oct, 2008 2:00 am
Posts: 4
Location: Hamburg (Germany)
Hi Steve,

i installed the plugin & API on OpenSuSe 11 and it is working perfect! Currently i'm monitoring 4 ESX Hosts.

Are there any plans to report performance data to nagios?

Regards from Hamburg (Germany)

Dennis


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Thu 02 Oct, 2008 4:59 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
Glad to hear its working!

The plugin already works with Nagios, and we're using it here.

Code:
define command {
       command_name check_vmware
       command_line check_vmware --mode=nagios --config=/usr/local/nagios/etc/vc.cfg --report=$ARG1$ $ARG2$
}


... and then, the configuration for the cluster. You can do similarly for hosts, guests, and datacentres of course.

Code:
define service {
    use                  generic-service
    host_name           virtualcentre
    service_description  VMWare: %OPTA% Status
    check_command        check_vmware!status!--cluster="cluster1"
    normal_check_interval   15
    retry_check_interval    5
    max_check_attempts  3

}
# Check host/cluster/datacenter memory
define service {
    use                  generic-service
    host_name            virtualcentre
    service_description  VMWare: clsuter1 Memory
    check_command        check_vmware!memory!--cluster="cluster1"
    normal_check_interval   5
    retry_check_interval    2
    max_check_attempts  4

}
# Check host/cluster/datacenter CPU
define service {
    use                  generic-service
    host_name            virtualcentre
    service_description  VMWare: cluster1 CPU
    check_command        check_vmware!cpu!--cluster="cluster1"
    normal_check_interval   5
    retry_check_interval    2
    max_check_attempts  4
}
# Check host/cluster/datacenter disk space
define service {
    use                  generic-service
    host_name            virtualcentre
    service_description  VMWare:  cluster1 Datastores
    check_command        check_vmware!disk!--cluster="clsuter1" --exclude="-swap-"
    normal_check_interval   60
    retry_check_interval    15
    max_check_attempts  2
}

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Sun 12 Oct, 2008 5:02 pm 
Offline
User

Joined: Sun 12 Oct, 2008 5:00 pm
Posts: 1
First let me say thank you for working on this plugin. I have been struggling to find a good solution to chart performance of ESX 3i hosts. I have currently been experimenting with unnoc and that is working ok but not quite how I want it to. I have one quick question on this plugin. Will it work with MRTG for windows?

Again many thanks.


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Mon 13 Oct, 2008 11:34 am 
Offline
User

Joined: Mon 13 Oct, 2008 11:30 am
Posts: 1
Hey Steve & elwappo,

Fair play on the work with this plugin.
I'm trying to configure it to query my ESX 3.5 hosts via my VC, but I keep getting a login failed error.

:/var/local/nagios/libexec# ./check_vmware.pl --guest guestname --password=mypasswd --username=myuser --debug --server=myserverip --verbose
Connecting
Login to VirtualCentre server failed.
UNKNOWN: Login to VirtualCentre server failed.

any quick pointers for me?
- I've already tested my connectivity and I do have sufficient privileges on the box in question.
- Nagios box has sufficient network routes/fw rules in place to talk to the VC.

Really appreciate it.
D.


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Mon 13 Oct, 2008 3:50 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
This plugin should work the same with MRTG for windows; of course you'll need to get the Windows version of the VI API files.

The login failure may be due to specifying the username. If your username has a backstroke in it then you'll need to escape it. Maybe use a vmconfig file, specified with --config=filename and put the username and password in there, as in the example above? This can solve problems with unusual characters in the username and password.

Also, try using different usernames just in case it is a permissions issue (use one you know works via the virtualcentre client)

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Thu 16 Oct, 2008 4:25 am 
Offline
User

Joined: Thu 16 Oct, 2008 4:19 am
Posts: 1
Hello,

First, thank you for this plugin.

I configure your plugin but i have an error :

[libexec]# ./check_vmware.pl --username=****** --password=****** --server=10.165.13.8 --report=cpu
CPU usage at 12.35%<BR>(Problem retrieving CPU fairness data)

I try on other vmware but i have the same problem, and in NAGIOS I have no result.

Thanks


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Thu 16 Oct, 2008 5:44 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
The 'problem retrieving fairness data' is currently normal - it happens on our VC servers, too. For some reason, although the VC can report this fairness data, and the counter exists in the object definition, it does not appear to be presented when the retrieval is run. I'm looking into this; however the other CPU and Memory checks work fine so lack of Fairness data is not a big issue.

The 'fairness data' is the per-ESX host indicator of what percentage of guest resources requested are actually provided. In a low-usage farm this would normally always be >95% - its the lower of the two DRS graphs. If you don't have DRS enabled, of course, you probably dont have this figure available :)

I'm currently working to get a persistent session established with this - the performance of the VI API sucks and with a lot of servers it puts an unacceptable load of login/logout on the VC.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Mon 20 Oct, 2008 11:27 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
I now have a 'persistent session' versionof this plugin, which stops the constant login/logout on the VC. It is slightly faster, but not by much, as the majority of the time is taken up downloading the initial object tree. You need a nice, fast VC server (don't run your VC in a guest. I know VMware say you can, and it does work, but it is stupidly slow, not to mention the chicken-and-egg situation you get if all your ESX hosts go down)

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Thu 30 Oct, 2008 6:21 am 
Offline
User

Joined: Wed 29 Oct, 2008 10:46 am
Posts: 7
Hi!

I'm trying to run the check_vmware.pl that is attached to the first post and a config generated ny check_vmware.pl. I am getting good results for Datastores and Status, but for CPU and Memory I get an error stating " UNKNOWN: Perf stats not available at required interval (300s) or invalid instance.".

When running the checks manually I sometimes get valid results for memory, but most of the time I get the same error.

I'm running check_vmware.pl on an Ubuntu 8.04 server with a single ESX 3.5 host to monitor.

My config files look like this:

Code:
define command {
       command_name check_vmware
       command_line $USER1$/check_vmware.pl --mode=nagios --server=10.114.60.240 --username=username --password=secret $ARG1$
}


Code:
# Dummy Host object for the datacenter/cluster, or ESX server host object
define host {
    use                  linux-server
    host_name            VMWARE
        alias
    address              10.114.60.240
}
# Check host/cluster/datacenter status
define service {
    use                  generic-service
    host_name            VMWARE
    service_description  VMWare: Status
    check_command        check_vmware! --report=status
}
# Check host/cluster/datacenter memory
define service {
    use                  generic-service
    host_name            VMWARE
    service_description  VMWare: Memory
    check_command        check_vmware! --report=memory
}
# Check host/cluster/datacenter CPU
define service {
    use                  generic-service
    host_name            VMWARE
    service_description  VMWare: CPU
    check_command        check_vmware! --report=cpu
}
# Check host/cluster/datacenter disk space
define service {
    use                  generic-service
    host_name            VMWARE
    service_description  VMWare: Datastores
    check_command        check_vmware! --report=disk
}


Any help / ideas are greatly appreciated.


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Thu 30 Oct, 2008 9:28 am 
Offline
User

Joined: Thu 30 Oct, 2008 9:17 am
Posts: 3
Hello

I'm trying to implement the NRPE Plugins for Windows (downloaded from first post in this thread).

If I execute check_vmem.exe or check_vcpu.exe, I get "UNKNOWN: Failed to load vmware-tools library. Are you sure that this is host is an ESX3 Guest and vmware-tools is installed?"

OS: Windows 2003 R2 English, all current patches and sp's installed
ESX is Version 3.5 Build 113339
VMware Tools is Version 3.5.0 Build 110268, installed with default settings (so GuestSDK API is enabled per default according documentation)

The linux version of the plugin works on virtual machine with centos 5.2 with same VMware Tools Build as above.

Do I need an additional software component for windows or do I overlook a fault?

Regards
Patrick


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Thu 30 Oct, 2008 5:17 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
(thedude001)
This message means that the VI API has told us that it does not have the required statistics available.
You should check your VirtualCentre config, and make sure that the logging is set to at least level 2 for the 300s interval, with retention of at least a day. This should solve the problem.

(meineimer)
The plugin attempts to access the VMware Tools DLL, and this message appears if it fails to load.
In this case, I would guess it is because it can't find the appropriate DLLs for some reason - maybe they are not in the windows/system directory?
I have tested this, but only against a couple of the Windows guests here (hence the 'beta' label at the top of the page). It is possible that it no longer works with slightly different versions of Windows or VMware tools; I will check it again and compare the exact versions and locations of the required DLLs.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Fri 31 Oct, 2008 6:26 am 
Offline
User

Joined: Wed 29 Oct, 2008 10:46 am
Posts: 7
Thanks. The problem is that this is a standalone ESX host, no Virtual Center is being used.

I'm using this ESX server as a test environment to evaluate nagios for production use on a cluster of 2 ESX hosts. If we are actually going to use it we will have VC availbla in the production environment. I'm not that much of an expert in VMWare (and especially ESX), these are my first steps in this direction. I'm doing this whole thing as a project during my job training...


Top
 Profile  
 
 Post subject: Re: check_vmware: Nagios/MRTG plugin for VMware ESX
PostPosted: Sat 01 Nov, 2008 2:11 am 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3001
Location: Auckland, New Zealand
This plugin really needs a virtualcentre to work, as the virtualcentre provides the full range of API stats functions. A standalone ESX host only gives a limited API and so the plugin is not able to retrieve all the data it is looking for.

Some things may work, but I've not really tested it without a virtualcentre so I cant say exactly what is supported without one.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 107 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group