Archived community.zenoss.org | full text search
Skip navigation
59074 Views 12 Replies Latest reply: Jun 11, 2009 1:10 PM by dbuck RSS
ionut1985 Rank: White Belt 72 posts since
Jun 25, 2008
Currently Being Moderated

Mar 16, 2009 11:27 AM

Virtual Machines CPU pool

Hello,

I am having some issues with the Virtual Machines ZenPack, the memory pool works great, but the cpu one doesnt, i tried running it manually from the command line and it works but in zenoss i receive the following:

Type: KeyError
Value: 'vmDisplayName'

Traceback (innermost last):

* Module ZPublisher.Publish, line 114, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 40, in call_object
* Module Products.ZenModel.BasicDataSource, line 164, in manage_testDataSource
* Module Products.ZenModel.RRDDataSource, line 202, in getCommand
* Module Products.PageTemplates.Expressions, line 224, in __call__
* Module Products.PageTemplates.Expressions, line 185, in __call__
* Module Products.PageTemplates.Expressions, line 173, in _eval
* Module Products.PageTemplates.Expressions, line 127, in _eval
__traceback_info__: here
* Module Products.PageTemplates.Expressions, line 320, in restrictedTraverse
__traceback_info__: {'path': ['vmDisplayName'], 'TraversalRequestNameStack': []}
* Module OFS.ObjectManager, line 713, in __getitem__

KeyError: 'vmDisplayName'



Any input would be appreciated.

Thank you
  • dbuck Rank: Green Belt 119 posts since
    Jul 22, 2008
    Currently Being Moderated
    2. Apr 24, 2009 6:50 AM (in response to ionut1985)
    same issue
    hello inut1985,

    I have the same issue, installed the Zenpack, add collector plugin etc. all work fine, but the cpu utilization will not show.

    In Zenoss I received exakt the same error.

    First I saw, that the path in the template-command for "check_esx2"-command was incorrect (I use Zenoss VM).
    I correct it, but get the same error in Zenoss.

    When I try it on command-line i get the following error:

    Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/lib/perl5/5.8.7/i386-linux-thread-multi /usr/lib/perl5/5.8.7 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.7/i386-linux-thread-multi /usr/lib/perl5/5.8.7 .) at /home/zenoss/ZenPacks/ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg/ZenPacks/vmware/VirtualMachines/libexec/check_esx2 line 26.
    BEGIN failed--compilation aborted at /home/zenoss/ZenPacks/ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg/ZenPacks/vmware/VirtualMachines/libexec/check_esx2 line 26.
    


    What is wrong here?

    Regards

    dbuck
  • cynfewl Newbie 3 posts since
    Jun 2, 2009
    Currently Being Moderated
    4. Jun 2, 2009 12:10 AM (in response to ionut1985)
    RE: same issue
    dbuck,

    You need to install the net-snmp perl module for your particular distribution, as the check_esx2 script uses this module to poll the ESX host.

    Once I installed this, some of the functionallity was available, but the CPU graphing still doesn't work for me.

    cynfewl.
  • dbuck Rank: Green Belt 119 posts since
    Jul 22, 2008
    Currently Being Moderated
    5. Jun 2, 2009 5:23 AM (in response to cynfewl)
    RE: same issue
    Hello cynfewl,

    sorry, your answer is not very helpful, because the Zenpack works, except the CPU-drawing.

    When I try to install the SNMP-Modules, the following Message occurs:

    cpan> install SNMP
    SNMP is up to date.
    
    cpan> install NetSNMP
    Warning: Cannot install NetSNMP, don't know what it is.
    Try the command
    
        i /NetSNMP/
    
    to find objects with matching identifiers.
    


    Is it right, that the SNMP-Modules are installed?

    Regards dbuck
  • cynfewl Newbie 3 posts since
    Jun 2, 2009
    Currently Being Moderated
    6. Jun 2, 2009 10:05 AM (in response to dbuck)
    RE: same issue
    Sorry dbuck, maybe I am off the mark.

    Nothing worked for me until I installed the libnet-snmp-perl package from the canonical repos. Searching for it in my system now (Ubuntu) shows it is at /usr/share/perl5/Net/SNMP.pm. That error message you posted was what I saw until I installed this component.

    Once this was installed, the errors about missing SNMP.pm went away and I could get memory utilisation figures. The CPU usage script also works correctly from the command line when I give it static entries for all the variables.

    Unfortunately, the CPU graphing in Zenoss still doesn't seem to work as the vmDisplayName variable doesn't seem to be passed correctly. The memory relies on OIDs, but this variable is essential for CPU usage.

    From some of the other threads, I'm not entirely sure this feature ever worked, and it appears to be more of a work in progress.

    cynfewl.
  • dbuck Rank: Green Belt 119 posts since
    Jul 22, 2008
    Currently Being Moderated
    7. Jun 2, 2009 3:38 PM (in response to cynfewl)
    error message solved
    Hello cynfewl,

    thank you for assist and bring me in the right direction. I installed the module NET::SNMP and now the above described error message wouldn't be shown again. Now on the command-line as user zenoss the command:

    /home/zenoss/ZenPacks/ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg/ZenPacks/vmware/VirtualMachines/libexec/check_esx2 -N -H fqdn.host.name -C snmpcommunity -v Zenoss-Appliance -l CPU -w 90 -c 95 |sed -e 's/.*CPU\susage\sis\s/cpuUtil=/;s#%##;s/on.*(/cpuSec=/;s#s##;s/average.*$$//'


    displays:
    cpuUtil=16.98 cpuSec=106 average)


    So I delete one of the two "$$" at the end of the command.

    Now it displays:
    cpuUtil=15.9 cpuSec=132


    I correct it in the Template, but it shows no Graph. Is this the right output-format for the datapoint?

    Regards dbuck
  • dbuck Rank: Green Belt 119 posts since
    Jul 22, 2008
    Currently Being Moderated
    8. Jun 2, 2009 4:10 PM (in response to dbuck)
    RE: error message solved
    Hello cynfewl,

    I think, the Value vmDisplayName is only presented when the command is executed by zenoss, because when you test it against a Device by using the Template shown at the "Templates"-Tab at one choosen Virtual Machine, the path change from "/Devices/Server/ESX/fqdn.esx.server/VirtualMachine" to "/Devices/Server/ESX/fqdn.esx.server". When now Insert a Value in the Field "Test Against Device" and klick "Test" the error described below by ionut1985 occurs. I think there is now no Virtual Machine choosen so that there is no Value for vmDisplayName.

    Another strange fact is, that I don't see any log-entry in the zenoss-logs, so it looks like that the command never executed.

    :?

    Regards

    dbuck
  • cynfewl Newbie 3 posts since
    Jun 2, 2009
    Currently Being Moderated
    9. Jun 3, 2009 2:20 AM (in response to dbuck)
    RE: error message solved
    Ok, I think I have this going.

    dbuck, I noticed the same thing as you about the double $$, but I got errors running the command through Zenoss with a single $.

    I've had a look at the code in the check_esx2 perl script, and it seemed like since this was only doing an SNMP poll, it should be possible to pull CPU usage without an external command.

    I've created a new datapoint, and have some screenshots, but I don't know how to make this a zenpack or post pictures.

    Basically, to get CPU monitoring going, do the following:

    1. Delete the existing CPU_Utilization Data Source.
    2. Create a new CPU_Utilization Data Source of type Derive that polls the OID 1.3.6.1.4.1.6876.3.1.2.1.3 with RRD Min value of 0.
    3. Add the Data Source to the graph CPU_Utilization.
    4. Delete the existing missing Graph Point with sequence number 0.
    5. Change the units to Percent, the Min Y to 0 and Max Y to 100.
    6. Click the remaining Graph Point and change the name to Utilization_cpuUtil, RPN to "100,*" (without quotes), format to %5.1lf%% and legend to Utilization.

    Delete any existing RRD graphs for the virtual hosts called CPU_Utilization_CPU_Utilization.rrd (I do this from the command line with a find).

    In about 15 minutes, you should have CPU usage for the individual virtuals.

    I'm not sure if this is 100%, but it appears to work for me...

    cynfewl.
  • dbuck Rank: Green Belt 119 posts since
    Jul 22, 2008
    Currently Being Moderated
    10. Jun 3, 2009 6:35 AM (in response to cynfewl)
    RE: error message solved
    Hello cynfewl,

    it woudn't work for me, because in the OID there is mising the VM-Machine-ID. It will output a Table of in my Case seven OIDs depending to the VM-Guests, running on the ESX-Host.

    Example: Test the OID 1.3.6.1.4.1.6876.3.1.2.1.3 against ESX-Server give back

    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.336 = INTEGER: 24413
    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.337 = INTEGER: 4297
    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.352 = INTEGER: 19916
    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.353 = INTEGER: 10146
    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.384 = INTEGER: 6469
    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.385 = INTEGER: 4939
    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.400 = INTEGER: 82937
    SNMPv2-SMI::enterprises.6876.3.1.2.1.3.401 = INTEGER: 380


    where the last number for example in the first Line it is ".337" is the VM-ID. This ID can change, when V-Motion place the VM to another ESX-Server or restart the VM's, so that the OID doesn't work anymore. This is what the perl-script reading from the ESX-Host before polling the right OID.

    The OID must be something like 1.3.6.1.4.1.6876.3.1.2.1.3.{here/VMID}.

    Where is the Developer of the Zenpack? Maybe he knows a solution.

    Regards

    dbuck
  • dompie Newbie 5 posts since
    Jun 9, 2009
    Currently Being Moderated
    11. Jun 11, 2009 11:14 AM (in response to dbuck)
    How to make the zenpack vmware.VirtualMachines work
    I managed to make the VirtualMachines zenpack running.
    1) install the zenpack and restart zopectl
    2) Before you add a server to the class /Devices/Server/ESX you have to go to the zProperties of that class en fill in at the zPythonClass this rule of text
    /usr/local/zenoss/zenoss/ZenPacks/ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg/ZenPacks/vmware/VirtualMachines/libexec/check_esx2

    This add's the Virtual machines tab to every new device you add to /Devices/Server/ESX
    I found this on http://forums.zenoss.com/viewtopic.php?p=29512

    If you already have a device in the class ESX you have to move it to another class and move it back to the ESX class.
    3) add a esx server to /Devices/Server/ESX
    4) Now you see the tab Virtual machines.

    To make the CPU_Utilization graph work you have to make a change in the template.

    1) Navigate to you esx server and go to Virtual Machines. Click on a virutal machine.

    2) Click on the tab templates

    3) Click on the VirtualMachine template

    4) Click on the Data source CPU_Utilization

    5) Check if the path for the check_esx2 command is set correctly, test it thru your terminal

    I get when I put this in a terminal
    No ESX server hostname specified with -H

    you have to get this
    DEBUG:zen.zencommand:The result of "/usr/local/zenoss/common/libexec/check_ping -H esx-cr01.iconos.be -w 180,100% -c 300,100% | sed -e 's# - Packet loss#|LOSS#;s#%,##;s#ms##;s# = #=#g'" was "'PING OK|LOSS=28 RTA=1.03 |rta=1.031000ms;180.000000;300.000000;0.000000 pl=28%;100;100;0\n'"
    DEBUG:zen.zencommand:Queueing event {'severity': 0, 'performanceData': 'LOSS=28 RTA=1.03 |rta=1.031000ms;180.000000;300.000000;0.000000 pl=28%;100;100;0', 'component': '', 'agent': 'zencommand', 'summary': 'PING OK', 'manager': 'localhost', 'eventKey': 'ipcheck', 'device': 'esx-cr01.iconos.be', 'message': 'PING OK', 'eventClass': '/Status/Ping'}

    This means the path is set correct.
    Now the fault is in the sed command. I think that the result of the check_esx2 command wasn't correctly parsed. I found this thru the command zencommand run --device=devicename.domain.local -v10
    I saw that the check_ping command has parsed the output to
    /usr/local/zenoss/zenoss/ZenPacks/ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg/ZenPacks/vmware/VirtualMachines/libexec/check_esx2 -N -H ${dev/id} -C ${here/zSnmpCommunity} -v  ${here/vmDisplayName} -l  CPU -w 90 -c 95 |sed -e 's/.*CPU\susage\sis\s/cpuUtil=/;s#%##;s/on.*(/cpuSec=/;s#s##;s/average.*$$//'

    You see that the result is devided in vertical bars. But with the esx_check2 is wasn't. So...

    6) on the Datasource CPU_utilization you edit the command from
    /usr/local/zenoss/zenoss/ZenPacks/ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg/ZenPacks/vmware/VirtualMachines/libexec/check_esx2 -N -H ${dev/id} -C ${here/zSnmpCommunity} -v  ${here/vmDisplayName} -l  CPU -w 90 -c 95 |sed -e 's/.*CPU\susage\sis\s/|cpuUtil=/;s#%##;s/on.*(/cpuSec=/;s#s##;s/average.*//'


    TO

    /usr/local/zenoss/zenoss/ZenPacks/ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg/ZenPacks/vmware/VirtualMachines/libexec/check_esx2 -N -H esx-server.local.be -C public -v virutalMachineName.local.be -l  CPU -w 90 -c 95 |sed -e 's/.*CPU\susage\sis\s/|cpuUtil=/;s#%##;s/on.*(/cpuSec=/;s#s##;s/average.*//'


    So delete the two $$ on the end and add a vertical bar | before cpuUtil

    Now the command should be parsed correctly.
    You can test this in you terminal. It is not possible to test the command via the webgui. Because ${here/vmDisplayName} isn't there. Just replace the TALES expressions
    eg:
    |cpuUtil=5.88 cpuSec=68


    and if you get something like this
    ZenPacks.vmware.VirtualMachines.VMDevice

    Than it works :lol:

    I have Zenoss Core 2.4.1 on a Ubunut 8.04.2 and installed the ZenPack: ZenPacks.vmware.VirtualMachines-1.2-py2.4.egg

    Sorry for my bad English. If you have a question I'm glad to help you.
  • dbuck Rank: Green Belt 119 posts since
    Jul 22, 2008
    Currently Being Moderated
    12. Jun 11, 2009 1:10 PM (in response to dompie)
    Graph now shows CPU-Utilization
    Hello dompie,

    thanks a lot. Greatful job. Deleting the "$$" and inserting the "|" make it all work. No it shows the CPU-Utilization-Graph for each running virtual machine. :P

    I hope, it would be corrected in the next version of the ZenPack.

    I thought before that it must be a small error with the output-format. I try something on my own, but I didn't have the idea with the "|". I remember a forums-thread long time ago I find for another search, where someone tell about the general output-format, but I didn't find it again.

    Regards

    dbuck

More Like This

  • Retrieving data ...