KeyServer Tables Description


This document describes each table, as well as each field of each table, and how to use them. See Export Configuration for a description of how to configure KeyServer to export these tables to an external database. Following all the table descriptions, there are some Example Queries.


List of Tables

KSAudits
  • Audit data which tracks what programs are on each machine.
KSComputerDivisions
  • Computer Divisions which have been configured in KeyConfigure.
  • These are the divisions which appear on the left side of the computers window.
  • There is no entry for the Uncategorized division.
KSComputerGroupMembers
  • KSComputerGroupMembers is a cross table to associate computers and groups.
  • This table only contains entries for computers which have been explicitly added to Computer Groups. If a group has a location defined, but no computers listed explicitly, this table will not have any entries referring to that group.
KSComputerGroups
  • Computer Groups which have been configured in KeyConfigure.
  • This table does not contain entries for groups which are defined by external authorization methods.
KSComputers
  • Computers which have connected to the KeyServer at some point.
KSInUse (new in KeyServer 6.1)
  • This table tracks what controlled programs and licenses are currently in use on each computer, by each user.
  • Note that it is probably not too useful for reports, since it changes so quickly.
  • This table is not exported, since it changes so quickly.
KSLicensedComputers
  • KSLicensedComputers is a cross table to associate computers and licenses.
  • It keeps track of each computer which has used a license.
  • Note that if the license is node locked, the number of entries for this license will be less than or equal to the license total.
  • If the license is a site wide or concurrent use license, there can be any number of entries for the license in this table, since it shows everywhere it has been used.
KSLicenses
  • Licenses. Each license is a policy controlling use of one or more programs.
KSLocations (new in KeyServer 6.1)
  • Locations. This table has entries corresponding to items in the Locations window in KeyConfigure.
KSPools
  • All licenses have at least one pool
  • This is where the group restriction is stored, if there is one
  • For custom licenses, the rows in this table correspond to the pools in the License Details window.
KSPortablesInUse (new in KeyServer 6.1.3)
  • Shows what portable licenses are currently checked out.
KSProgramFolders
  • This table holds entries for the program folders which can be defined in KeyConfigure.
  • Note that a program can only belong to a single folder.
KSProgramLicenses
  • Associates licenses with the programs they control.
KSPrograms
  • All known programs.
KSServers
  • Table containing one entry for every KeyServer.
  • When connecting directly to a KeyServer, this table will have only one entry.
  • When exporting data from multiple KeyServers to a single SQL server, this table will have multiple entries.
KSTermAction
  • Provides long and short string representations of the KSPrograms.programAction constants.
KSTermAllowed (new in KeyServer 6.1)
  • Provides long and short string representations of the KSComputers.computerAllowed constants.
KSTermCPUType
  • Provides long and short string representations of the KSComputers.computerCPUType constants.
KSTermEvent
  • Provides long and short string representations of the KSUsage.usageEvent constants.
KSTermLicType
  • Provides long and short string representations of the KSLicenses.licenseType constants.
KSTermOSType
  • Provides long and short string representations of the KSComputers.computerOSType constants.
KSTermPlatform
  • Provides long and short string representations of the KSComputers.computerPlatform constants.
KSTermProtocol
  • Provides long and short string representations of the KSComputers.computerProtocol constants.
KSTermReason
  • Provides long and short string representations of the KSUsage.usageReason constants.
KSUsage
  • Usage records which track both program and license usage, as well as client logins, logouts, audits, etc.
KSUsers
  • This table holds the current users of KeyServer (The same ones that are shown in the users window of KeyConfigure).
  • Note that it is probably not too useful for reports, since it changes so quickly.
  • This table is not exported, since it changes so quickly.
KSDbex
  • This table does not exist internally in KeyServer.
  • It is only used in exported databases.
  • It keeps track of the last time that each table was exported, so that exports can be incremental.


The following tables describe the columns contained in each table. KeyServer's internal databases (accessible through ksODBC) contain the same columns as exported data. However, the data types might be slightly different. The types listed below are correct for exported data. If you need to create the tables by hand before exporting data from KeyServer, you should use the types contained in the tables below.


KSAudits

auditID VARCHAR(128) Unique ID for this audit entry.
auditServerID INT (new in KeyServer 6.1)
The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
auditComputerID VARCHAR(64) Part of the auditID. The computer which this audit came from. References the computerID field of KSComputers, and can be used to join the two tables.
auditProgramID VARCHAR(48) Part of the auditID. The ID of the program for this entry. References the programID field of KSPrograms, and can be used to join the two tables.
auditLicenseID VARCHAR(32) If the program is a keyed program, this refers to the licenseID field of KSLicenses.
auditCount INT The number of copies of this program that were found on the computer.
auditFirstSeen DATETIME Date when the program was first seen on this computer.
auditLastSeen DATETIME Date when the program was last seen on this computer, if a more recent audit did not find the program. This is only filled in if auditCount is zero. Otherwise it is null.
auditLastUsed DATETIME Date when the program was last used on this computer.
auditPath VARCHAR(255) Reserved for future use - ignore.

KSComputerDivisions

divisionID INT Unique ID for this division.
divisionServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
divisionName VARCHAR(64) The name of the division.
divisionColor INT The color which KeyConfigure uses to display the division. When displayed as hex, the first two digits are the Blue value, the next two are the Green value, the final two are the Red value.
divisionNotes VARCHAR(255) Notes for the division. Can't be set in KeyConfigure.
divisionFlags INT Ignore.

KSComputerGroupMembers

memberID VARCHAR(96) Unique ID for this association between one computer and one group.
memberServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
memberComputerID VARCHAR(64) Part of the memberID. References the computerID field of KSComputers, and can be used to join the two tables.
memberGroupID VARCHAR(64) Part of the memberID. References the groupID field of KSGroups, and can be used to join the two tables.
memberAcknowledged INT Ignore.
memberLastUsed DATETIME The last time the computer used membership in the group in order to use a license.

KSComputerGroups

groupID VARCHAR(64) Unique ID for this computer group.
groupServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
groupNumMembers INT Number of members currently in the group.
groupMaxMembers INT Ignore.
groupNotes VARCHAR(255) Notes for the group, as defined in KeyConfigure.
groupFlags INT Ignore.

KSComputers

computerID VARCHAR(64) Unique ID for this computer. Note that if the computerID starts with 'W', 'L', 'T', or 'K', the ID is what is shown in KeyConfigure's Computers window, instead of the name.
computerServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
computerName VARCHAR(64) Name of the computer. Note that if the computerID starts with 'W', 'L', 'T', or 'K', the ID is what is shown in KeyConfigure's Computers window, instead of the name.
computerUserName VARCHAR(64) Name of the user most recently logged into the computer.
computerPlatform INT A code which represents the platform type of the computer. Use KSTermPlatform to convert these constants to string representations.
computerProtocol INT Specifies how the computer connects to KeyServer. Use the KSTermProtocol table to look up these constants.
computerAddress VARCHAR(32) The IP address of the computer, as a string.
computerOSType INT Code which specifies the OS type. Use KSTermOSType to convert these constants to string representations.
computerOSVersion INT Number which specifies the OS version. first byte is major version, second is minor version, last two bytes is build number.
  • 10.4.8 would be 0x0a040008 in hex (or 168034312 in decimal)
  • 5.1 build 26000 would be 0x05010A28 in hex (or 83954216 in decimal).
computerOSRelease INT Number which specifies the release number of the OS.
  • On Macintosh, this field stores the revision version of the OS. Usually this field will be either 0 or hex 0x01008000 (decimal 16809984), which means revision 1.
  • On Windows, this field stores the SP number in the third byte. For example, SP2 would be 0x00020000 in hex (or 131072 in decimal).
computerCPUType INT Code which specifies the type of CPU in the computer. Use KSTermCPUType to convert these constants to string representations.
computerCPUCount INT How many CPUs the computer has. Computers with KeyAccess 6.0.2.2 or earlier will always show 1 CPU. Computers with KeyAccess 6.0.2.3 or 6.1.x will show the correct number of CPUs.
computerCPUClock INT Clock speed of the CPU, in Mhz. For machines with multiple CPUs, this is the clock speed of each CPU.
computerRAMSize INT Kilobytes of RAM on the computer.
computerDiskSize INT Size of all local disks combined, in Kilobytes.
computerFreeSpace INT Kilobytes of free space on disk.
computerDisplayWidth INT (new in KeyServer 6.1)
Width in pixels of the primary display.
computerDisplayHeight INT (new in KeyServer 6.1)
Height in pixels of the primary display.
computerDisplayDepth INT (new in KeyServer 6.1)
Bit depth of the primary display.
computerMACAddress VARCHAR(64) MAC address of the primary NIC.
computerSite VARCHAR(64) Reserved for future use - ignore.
computerOEMSerial VARCHAR(64) Manufacturer's serial number.
computerOSSerial VARCHAR(64) Serial number of the OS, if it is available.
computerManufacturer VARCHAR(64) (new in KeyServer 6.1)
Manufacturer of the computer.
computerModel VARCHAR(64) (new in KeyServer 6.1)
Model name of the computer.
computerLastLogin DATETIME Last date and time at which this computer logged in to the KeyServer.
computerLastAudit DATETIME Last date and time at which this computer was audited.
computerBaseAudit DATETIME Date and time of this computer's Baseline Audit.
computerClientVersion VARCHAR(16) Version number of KeyAccess on the computer, as a string.
computerUserSession INT This refers to the user session number on KeyServer. Essentially useless for reports.
computerAcknowledged INT A boolean representing whether or not the computer has been acknowledged (or moved to a different division) in KeyConfigure by an administrator.
computerAllowed INT What type Login this client uses. Use KSTermAllowed to convert these constants to string representations.
computerAudit INT Boolean which indicates whether this computer will audit automatically (which is equivalent to being set to a Full client).
computerDivisionID INT ID of the division associated with this computer. References the divisionID field of KSComputerDivisions, and can be used to join the two tables.
computerAssetID VARCHAR(64) Asset ID, as defined in KeyConfigure in Asset pane of Computer Details window.
computerLocation VARCHAR(64) Location, as defined in KeyConfigure in Asset pane of Computer Details window.
computerConfirmed DATETIME Date when computer was confirmed, as defined in KeyConfigure in Asset pane of Computer Details window.
computerConfirmedBy VARCHAR(64) Who confirmed the computer, as defined in KeyConfigure in Asset pane of Computer Details window.
computerNotes VARCHAR(255) Notes for the computer, as defined in KeyConfigure in Asset pane of Computer Details window.
computerFlags INT Ignore.

KSInUse

inuseID internal only Unique ID for this entry in the KSInUse table.
inuseProgramID internal only The ID of the controlled program which is in use. References the programID field of KSPrograms, and can be used to join the two tables.
inuseLicenseID internal only The ID of the license which is in use. References the licenseID field of KSLicenses, and can be used to join the two tables.
inuseControlID internal only The ID of the control which is in use. References the programControlID field of KSPrograms, and can be used to join the two tables.
inuseComputerID internal only The ID of the computer which is using the license. References the computerID field of KSComputers, and can be used to join the two tables.
inuseUserID internal only The ID of the user who is logged in and using the license. References the userID field of KSUsers, and can be used to join the two tables.
inuseWhen internal only The time at which this program or license started being used.
inuseTime internal only The length of time which this program or license has been in use.
inuseExpiration internal only The date when this license usage will expire (e.g. for a checked out portable license).
inuseInstances internal only The number of copies of a program which are in use simultaneously.
inusePoolID internal only The pool from which this license is being used. References the poolID field of KSPools, and can be used to join the two tables.
inuseWaiting internal only True if this license is not yet in use, but the user is queued for the license.
inuseReserved internal only True if the license is reserved for the user, but the user has not yet obtained the license.
inuseOverdue internal only True if this license expired, but has not yet been returned.
inuseReclaimed internal only True if an administrator has reclaimed the license but it has not yet been returned.
inuseFlags internal only Ignore.

KSLicensedComputers

licenseeID VARCHAR(96) Unique ID for this association between one computer and one group.
licenseeServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
licenseeComputerID VARCHAR(64) Part of the licenseeID. References the computerID field of KSComputers, and can be used to join the two tables.
licenseeLicenseID VARCHAR(32) Part of the licenseeID. References the licenseID field of KSLicenses, and can be used to join the two tables.
licenseeAcknowledged INT A boolean representing whether or not the computer has been acknowledged as a user of the license in KeyConfigure by an administrator. If this value is false, the computer shows up as a pink item in the Computer Node List window for the license.
licenseeLastUsed DATETIME When the computer last used the license.

KSLicenses

licenseID VARCHAR(32) Unique ID for this license.
licenseServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
licenseName VARCHAR(64) Name of the license.
licenseTotal INT Total number of licenses enabled.
licenseType INT License type, as configured in KeyConfigure Use KSTermLicType to see which number refers to each license type.
licenseNodeLock INT True if the license is node locked and not auto-add, false otherwise.
licenseExpiration DATETIME License Expiration Date.
licenseCurrUsers INT Number of clients currently using the license.
internal only
licenseCurrWaiting INT Number of clients currently waiting for the license.
internal only
licenseNotes VARCHAR(255) Notes for the license, as configured in KeyConfigure.

KSLocations

locationID VARCHAR(64) Unique ID for this Location.
locationServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
locationProtocol INT Specifies what type of Location range this is. Use KSTermProtocol to convert these constants to string representations.
locationName VARCHAR(64) Name of this Location.
locationRangeBegin INT Specifies the beginning of the Location range.
locationRangeEnd INT Specifies the end of the Location range.
locationAllowed INT Specifies whether users are allowed to log in from this Location.
locationNotes VARCHAR(255) Notes for this Location.
locationFlags INT Ignore.

KSPools

poolID VARCHAR(32) Unique ID for this pool.
poolServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
poolLicenseID VARCHAR(32) ID of the license which this pool belongs to. References the licenseID field of KSLicenses, and can be used to join the two tables.
poolIndex INT Index of this pool within pools for the license.
poolGroupID VARCHAR(64) ID of the group associated with this pool. References the groupID field of KSGroups, and can be used to join the two tables.
poolLimit INT License limit for this pool.
poolTimeout INT Timeout for this pool.
poolNetwork INT Corresponds to "Can be used on network" checkbox in KeyConfigure.
poolPortable INT Corresponds to "Can be used as Portable Key" checkbox in KeyConfigure.
poolInUse INT Number of licenses in use from this pool.
internal only
poolFlags INT Ignore.

KSPortablesInUse

portID internal only Unique ID for this entry in the KSInUse table.
portLicenseID internal only The ID of the license which is checked out. References the licenseID field of KSLicenses, and can be used to join the two tables.
portUserName internal only The name of the user who checked the portable out.
portComputerID internal only The ID of the computer which has checked out the license. References the computerID field of KSComputers, and can be used to join the two tables.
portWhen internal only The time at which the portable was checked out.
portExpiration internal only The date when this portable will expire.
portFlags internal only Ignore.

KSProgramFolders

folderID INT Unique ID for this program folder.
folderServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
folderAction INT default action for the folder, using the same codes as programAction
folderAudit INT Whether to include programs in this folder in audits.
folderName VARCHAR(64) The name of the folder.
folderColor INT The color which KeyConfigure uses to display the folder. When displayed as hex, the first two digits are the Blue value, the next two are the Green value, the final two are the Red value.
folderNotes VARCHAR(255) Notes for the folder. Can't be set in KeyConfigure.
folderFlags INT Ignore.

KSProgramLicenses

proglicID VARCHAR(32) Unique ID for this entry in KSProgramLicenses.
proglicServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
proglicControlID VARCHAR(32) Part of the proglicID. References the programControlID field of KSPrograms, and can be used to join the two tables.
proglicIndex INT Part of the proglicID. This field makes the ID unique, since more than one entry may have the same control ID and license ID.
proglicLicenseID VARCHAR(32) Part of the proglicID. References the licenseID field of KSLicenses, and can be used to join the two tables.

KSPrograms

programID VARCHAR(48) Unique ID for this row of KSPrograms. Note this is different for every version. If there is a single entry in the programs window of KeyConfigure, but there are 3 versions in the expandable name in the Actions pane of the program details window, there are then 3 rows in KSPrograms, each with a different programID, but the same programVariant.
programServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
programVariant VARCHAR(48) This is the programID, masked to some degree. A single value of programVariant corresponds to a single item in KeyConfigure's programs window.
programCharStamp VARCHAR(16) The character stamp of the program.
programName VARCHAR(64) The name of the program.
programVariantName VARCHAR(64) The name of the item in KeyConfigure's programs window under which this specific version of the program appears.
programVariantVersion VARCHAR(64) A string representation of the common part of the version, for all versions which KeyConfigure considers a single "program" (i.e. entry in the programs window).
programAIVersion VARCHAR(64) Alternative format of programVariantVersion.
programVersionMask INT A number representation of the version mask, which has been set in KeyConfigure. This is used to compute the programVariant from the programID.
programVersion VARCHAR(32) The version number of the program, as text.
programPlatform INT What platform the program runs on. Use KSTermPlatform to convert these constants to string representations.
programPublisher VARCHAR(64) The publisher of the program, if that information is known.
programPath VARCHAR(255) The path of the first copy of the program which was ever seen.
programFileName VARCHAR(64) The file name of the first copy of the program which was ever seen.
programAction INT This corresponds to the action which can be set in KeyConfigure. Use KSTermAction to convert these constants to string representations.
programAcknowledged INT A boolean representing whether or not the program has been acknowledged in KeyConfigure by an administrator. If this value is false, the program shows up as a pink item in the KeyConfigure programs window.
programAllowLaunch INT Corresponds to the "Allow launch when KeyServer not available" checkbox in the program details window of KeyConfigure.
programLogOffline INT Whether usage of this program is logged when KeyServer is unavailable.
programAudit INT Whether to include this program in software audits.
programControlID VARCHAR(32) The "Control" which is associated with this program. Only set for controlled programs. This attribute is internal to KeyServer. For reports, this field can be linked from KSProgramlicenses.proglicControlID to determine which licenses control which programs.
programFolderID INT Indicates which folder the program belongs to, if any. References the folderID field of KSProgramFolders, and can be used to join the two tables.
programDiscovered DATETIME The date on which this program was discovered, either by an audit, or by a launch of the program.
programCreateDate DATETIME The creation date of the program.
programUserName VARCHAR(64) The name of the KeyServer user of the machine on which the program was first seen.
programComputerID VARCHAR(64) The ID of the computer on which this program was first seen. References the computerID field of KSComputers, and can be used to join the two tables.
programNotes VARCHAR(255) Notes for the program, if they have been typed in the Notes pane of the program details window of KeyConfigure.
programFlags INT Ignore.

KSServers

serverID INT Unique ID for this entry in KSServers. When connected directly to a KeyServer, the one entry in this table will have serverID 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
serverType INT 0 for a server, 1 for a shadow.
serverName VARCHAR(64) The AppleTalk/IPX name of the server.
serverComputer VARCHAR(64) The name of the computer on which the KeyServer is running.
serverSerialNumber VARCHAR(24) The displayable serial number.
serverVersion VARCHAR(16) The version of the server.
serverStartTime DATETIME (new in KeyServer 6.1)
Date and time when the server was started up.
serverGMTOffset INT Offset from GMT in seconds.
serverTimeZone VARCHAR(15) (new in KeyServer 6.1)
Name of the timezone where the server is.
serverSeats INT Number of clients supported.
serverFullClients INT (new in KeyServer 6.1)
Current number of Full clients.
serverActiveSessions INT (new in KeyServer 6.1)
Current number of Active sessions.
serverFloatingSessions INT (new in KeyServer 6.1)
Current number of Floating sessions.
serverFloatingRatio INT (new in KeyServer 6.1)
Floating Ratio.
serverLicensesInUse INT (new in KeyServer 6.1)
Current number of Licenses in use by KeyServer clients.
serverLicensesInQueue INT (new in KeyServer 6.1)
Current number of Licenses Queued for KeyServer clients.

KSTerm*

Every term table has the following three fields:

termID INT The unique ID for this term entry. This is the field to link to from whatever field needs to be interpreted.
termValue VARCHAR(255) A long string describing the code.
termAbbreviation VARCHAR(32) A short string describing the code.

KSUsage

usageID VARCHAR(128) Unique ID for this entry in KSUsage.
usageWhen DATETIME Date and time when this usage event occured. This value is part of the usageID.
usageEnum INT This distinguishes between two or more usage events during the same second. This value is part of the usageID.
usageServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database.
usageServerType INT Whether this event was logged by the KeyServer (value is 0), or by a shadow (value is 1).
usageProgramID VARCHAR(48) If this event involved a program, the ID for the program. References the programID field of KSPrograms, and can be used to join the two tables.
usageLicenseID VARCHAR(32) If this event involved a license, the ID of the license. References the licenseID field of KSLicenses, and can be used to join the two tables.
usageComputerID VARCHAR(64) The ID of the computer which generated this usage event. References the computerID field of KSComputers, and can be used to join the two tables.
usageExpansion VARCHAR(64) Reserved for future use - ignore.
usageUser VARCHAR(64) The name of the user on the computer which generated this usage event.
usageAddress VARCHAR(32) The IP address of the machine at the time of this usage action. Note this could change from event to event for the same computer if you use DHCP.
usageGroup VARCHAR(64) Name of the group which allowed the license to be used. This may be equal to a value of KSComputerGroups.groupID, but it may not.
usageEvent INT What type of event occured. Use KSTermEvent to convert these constants to string representations.
usageReason INT Extra information on what caused the event. Use KSTermReason to convert these constants to string representations.
usageTime INT How long a certain state was in affect for. Only meaningful for "end" events, like license return, program quit, user removed from wait queue, etc.
usageOtherTime DATETIME For "end" type events (program quit, license return, user logoff, server shutdown), this field contains the date and time when the corresponding "start" event occured. Equal to usageWhen - usageTime for these events.
usageGMTOffset INT (new in KeyServer 6.1)
GMT Offset in seconds of timezone where this usage event occured.
usageCount INT (new in KeyServer 6.1)
Reserved for future use - ignore.

KSUsers

userID internal only Unique ID for this user. (unique forever, only valid as long as user is logged in)
userSession internal only Attribute which is used internally by KeyServer. It is essentially useless for reports.
userName internal only The name of the user.
userComputerID internal only The computer that the user is logged in on. References the computerID field of KSComputers, and can be used to join the two tables.
userComputerName internal only The name of the computer that the user is logged in on.
userClientVersion internal only The KeyAccess client version which the user is connected with.
userProtocol internal only Specifies how the user is connected to KeyServer. Use KSTermProtocol to convert these constants to string representations.
userAddress internal only TCP address of the computer that the user is logged in on.
userZone internal only If connected through AppleTalk, the zone the user is in.
userLicenseCount internal only The number of licenses that the user has out.
userReservationCount internal only The number of licenses that the user is waiting for.
userWaitingID internal only Attribute which is used internally by KeyServer. It is essentially useless for reports.

KSDbex (external only)

dbexTable VARCHAR(32) Name of one of the other tables (e.g. "KSPrograms"). This is part of the key for this table.
dbexServerID INT The ID of the server which created this entry. If you are querying data directly from KeyServer, this will be 0. The "feature.server" attribute from the KeyServer's license certificate is filled in when tables are exported to an external database. This is part of the key for this table.
dbexLast INT Number which represents the last time the table specified by dbexTable was exported by the server of ID dbexServerID. This number is updated after each export.


Example Queries

To give a better idea of how these tables can be used, here are some example queries. First, let's look at how one of the Online Reports in KeyReporter generates results. The query for showing an overview of all Divisions is:

	SELECT MAX(divisionName),MAX(divisionID),COUNT(computerUserSession),
				COUNT(computerID)-COUNT(computerUserSession),COUNT(computerID),
				(100*COUNT(computerUserSession))/COUNT(computerID),
				100-((100*COUNT(computerUserSession))/COUNT(computerID))
			FROM
				{oj KSComputers LEFT OUTER JOIN KSComputerDivisions ON computerDivisionID=divisionID
					AND computerServerID=divisionServerID}
			WHERE
				(divisionName IS NOT NULL)
			GROUP BY
				divisionName,divisionID

Because of the GROUP BY, this query returns one row for each Division. It selects the division name, division id (which can then be used to restrict a query to just that division), number of computers in the division with someone logged in, number of computers in the division without someone logged in, total number of computers, percent logged in, and percent not logged in. KeyReporter does not display the division ID, but uses it if one of the divisions is clicked on. It uses the last two columns to generate the graphical representation of how full the division is. Next let's look at the query it uses once a specific division is clicked:

	SELECT computerName,computerUserSession,computerUserName
			FROM
				KSComputers
			WHERE
				computerDivisionID=1234234
			ORDER BY
				computerName

1234234 gets replaced with the appropriate divisionID, which was selected in the summary query above. The first column is the name of each computer within the division (this may not quite match what KeyConfigure displays in the Computers window - see the notes about the KSComputer fields for more). The second column is NULL if no one is currently logged in to the computer, and non NULL if someone is logged in to the computer. The third column is the name of the last user who logged in to the computer (which is the currently logged in user if there is someone logged in).

Next, here is an example that is somewhat like what the Usage (PROG x user) report might do:

	SELECT MAX(programVariantName),MAX(programVariantVersion),MAX(usageUser),
				COUNT(*),SUM(usageTime),MAX(usageWhen)
			FROM
				{oj KSUsage INNER JOIN KSPrograms ON KSUsage.usageProgramID=KSPrograms.programID
					AND KSUsage.usageServerID=KSPrograms.programServerID }
			WHERE
				(usageEvent=4 OR usageEvent=9 OR usageEvent=11 OR usageEvent=13) AND programAction > 1
				AND usageWhen >= '2007-12-01 00:00:00' AND usageOtherTime < '2008-01-01 00:00:00'
			GROUP BY
				programVariantName,programVariant,usageUser

First of all, notice the join between KSUsage and KSPrograms. Technically, the usageServerID to programServerID should be included as a condition, but it is really only important if you have multiple KeyServers exporting to the same database. This is very similar to how you would do joins between KSUsage and KSComputers or KSLicenses. Next, look at the WHERE clause. First of all, it selects all the various types of program quit events (you can find the event codes by looking at the KSTermEvent table). Additionally, it only selects events for programs which are currently set to logged or controlled (look at KSTermAction). Finally, it selects events for which at least part of the usage was in December of 2007 - the quit was after December 1 and the corresponding launch was before January 1. With these various events, it groups by programVariantName and programVariant (since multiple programs may have the same Variant name), then by user. Finally, the fields it displays show summarization of usage. The first three fields identify which program and user this line is for. Next, the total number of quits, duration of usage, and most recent quit are selected. The actual KeyConfigure report is quite a bit more complicated than this. Most importantly, it selects every event and then processes and summarizes them within the report module, instead of having the SQL query doing the grouping and summarization. This allows it only count usage time that overlaps the selected time range. For example, if a program were launched on November 25 and left running until Dec 1, the SQL query above would count a whole week of usage, but the internal report would calculate the overlap and only count 1 day of usage. The internal report is also able to show a line summarizing usage for each program as a whole, as well as the details of each program/user combination. It also has a few more fields than what is shown above, and formats usage durations as hours:minutes instead of a raw number of seconds.

Note also that the syntax for the join and for date stamps has to be adjusted depending on what ODBC driver is being used.


Help Index 2009.08.04

Related Topics

Exporting
Online Reports

Help Index
?