Upload
yuyingmai
View
35
Download
1
Embed Size (px)
Citation preview
VirtualCenter Database
Bouke GroenescheijJumé [email protected], www.jume.nl
“When I say VirtualCenter: Sorry – Should be vCenter!!!”
VirtualCenter Database
Bouke GroenescheijJumé [email protected], www.jume.nl
vCenter Database
Introduction
• Why this presentation?– To get a better overview of your vCenter Database
and its data!– Write your own tools to gather information from the
vCenter Database.
• For who?– Administrators, consultants, developers who want to
create reporting and do analysis from the database.
Agenda
• vCenter Architectuur• Setup (the installation)• Database Architecture• SQL• Some applications
vCenter Architecture
Requirements
• Microsoft SQL Server 2000 Standard• Microsoft SQL Server 2000 Enterprise• Microsoft SQL Server 2005 Standard • Microsoft SQL Server 2005 Enterprise • Microsoft SQL Server 2005 Express SP2
• Oracle 9i release 2 Standard*• Oracle 9i release 2 Enterprise*• Oracle 10g Standard Release 1 (10.1.0.3.0)• Oracle 10g Enterprise Release 1 (10.1.0.3.0)• Oracle 10g Standard Release 2 (10.2.0.1.0)*• Oracle 10g Enterprise Release 2 (10.2.0.1.0)*
*Be aware: patches needed! See p. 19 in “ESX Server 3 and VirtualCenter Installation Guide”
Database Size (upfront)
• Use the“vc_db_calculator.xls” for Microsoft SQL Server or the “vc_db_calculator_oracle.xls” for Oracle.
• http://www.vmware.com/support/pubs/vi_pages/vi_pubs_35u2.html
Database Size (afterwards)
• Use vCenter Server: “Administration, VirtualCenter Management Server Configuration..., Statistics”
Database Maintenance
• Monitoring the growth of the log file and compactingthe database log file, as needed.
• Scheduling regular backups of the database.�• Backing up the database before any vCenter�
upgrade.Moni
tor
Compact
Backup
Setup
• Oracle local• Oracle remote• SQL local• SQL remote
Database Details
• 1 relational database• 88 tables
select *
from information_schema.tableswhere table_type='BASE TABLE'
• 23 viewsselect *
from information_schema.tableswhere table_type='VIEW'
• 3 jobs• 8 stored procedures
Messages during installation
Jobs & Stored Procedures
• 3 jobs, for RollUp stats– These starts the stored procedures
• 8 stored procedures
SQL (Structured Query Language)
• Simple (yet very powerfull) language, 5 commands– USE– SELECT– UPDATE– INSERT– DELETE
• A query can also contain functions, conditions, joins, operators and a lot more!
SQL Rules
• Number should not be between quotes:– SELECT *
FROM VPX_ENTITYWHERE (TYPE_ID = 1)
• Text MUST be between quotes:– SELECT NAME, VALUE
FROM VPX_PARAMETERWHERE (NAME = 'log.level')
Working with aliases
• Usage of AS for an alias– Simplifies your query and can provide a better
overview
– Example (CPU Features from ESX servers)SELECT HCCF.HOST_ID, HCCF.CPU_EAXFROM VPX_HOST_CPU_CPUID_FEATURE AS HCCF
SQL Join (1/2)
• Query data from 2 or more tables• Joins types:
– INNER JOIN• Only shows the matching records
– OUTER JOIN• LEFT OUTER JOIN
– All values from the left table, including the non-matching records• RIGHT OUTER JOIN
– All values from the right table, including the non-matching records• FULL OUTER JOIN
– All values from both tables, including the non-matching records
– CROSS JOIN• All values from both tables, creates matches, but also records without
matches (10 rows from 1 table and 7 rows from the other will result in 70 rows). Be aware: Cartesian product.
SQL Join (2/2)
• With a JOIN use the ON• And an operator: =, <>, <=, >=, <, >, ! (not)• Example (List of WWNs with servernames):
SELECT E.NAME, W.NODE_WWN, W.PORT_WWNFROM VPX_WWN AS W INNER JOIN VPX_ENTITY AS E ON W.ENTITY_ID = E.ID
IMPORTANT!!!
CREATE BACKUPS!!!
What is possible?!?
• Historical overview of the amount of VMs in VI over time• Total VMotions• Performance graphics in a webinterface• List with all VMFS partitions with free-space• Properties of the objects• All WWNs of HBAs• Etc., etc.
No clue about which table?
• Use the: “SQL Server Profiler”– Be aware: could have a high performance impact!!!
When something goes wrong (and no backup?)
• Stop vCenter services• Go to:
C:\Program Files\VMware\Infrastructure\VirtualCenter Server
• Start the vCenter Server with option –b:vpxd.exe –b
• But be carefull: database = completely empty (all ESX servers, VMs, settings, alarms, counters, etc. are erased!!!)
More useful options
• vpxd –p (of –P = scriptable)– For resetting vCenter DB password
• vpxd –s– For vCenter Service standalone startup
• Check eventvwr for hints
Few demos
• SQL Server Profiler• Total VMotions• Performance stats in webinterface• Free Diskspace
Links
• Basis SQL Querys?– http://www.w3schools.com/sql/sql_intro.asp– http://en.wikipedia.org/wiki/Join_(SQL)
• VMware vCenter DB Application development– http://www.vmguru.com/files/VCDBApps.pdf
• Examples– http://ict-freak.nl/2008/06/12/vmware-vmotion-info
-in-excel-2007/– http://www.jume.nl
Questions?!?
vCenter Database
Bouke GroenescheijJumé [email protected], www.jume.nlFollow me on twitter: boukeg