Name

mcsysinfoperl — MagniCompSysInfo™ Perl API to obtain detailed system information in a platform neutral manner

Synopsis

use lib ('/opt/sysinfo/lib/mcSysInfo');
use mcSysInfo;

$mcSysInfo = mcSysInfo->New;
# REQUIRED: Specify pathname to sysinfo(1)
$mcSysInfo->Program($SysInfoPath);
# Optional: Use $InFile in place of sysinfo(1)
$mcSysInfo->InputFile($InFile);
# Optional: Limit data to class List
$mcSysInfo->Class(@List);

# Retrieve data and populate $mcSysInfo
$mcSysInfo->Retrieve(%Options);

# Raw report interface
$mcSysInfo->ReportSet($Options);
for ( ; ; ) {
    my $Line = $SysInfo->ReportLine;
    if (!defined($Line)) {
        last;
    }
    printf "%s\n", $Line;
}
$mcSysInfo->ReportEnd;
      

DESCRIPTION

The mcSysInfo perl(1) interface is part of the MagniComp SysInfo software. (See mcsysinfo(1) for an overview.) It provides a perl(1) object API for obtaining detailed data about the local or remote system's configuration via a platform neutral interface.

Please see mcsysinfoc(3) if a C API is required.

When mcSysInfo->Retrieve is called it obtains the requested data from a source determined as follows:

mcSysInfo->InputFile

If this member is set, the data is read from this file. The file should be in mcsysinforeport(5) format.

Remote host via SSP

If mcSysInfo->Host is set, then data is retrieved via the SSP protocol from the specified host.

Local File Cache

If a local file cache of the requested data is available, the data is read from the cache.

Local via SIE

The SysInfo Engine (SIE) is run locally to obtain data. As the data is read from SIE it is saved to a local file cache (see FILE CACHE for more details).

In all cases, the data is parsed into perl(1) objects and made available as members of mcSysInfo (see below for details).

If you wish to retrieve raw "report" format data one line at a time, first call mcSysInfo->ReportSet and then call mcSysInfo->ReportLine to retrieve one line of "report" format data. This function returns undef when all data has been read. The mcSysInfo->ReportEnd function will close any open file descriptors.

FILE CACHE

When data is retrieved via mcSysInfo->Retrieve it is cached in files under the /tmp/mcsysinfo.cache.UID (where UID is the UID of the user calling the API) directory. An alternate directory can be specified by passing the hash value of CacheDir=>Dir to mcSysInfo->Retrieve.

Each class of data requested is stored in its own cache file.

Cache files have a limited lifespan after which they are considered invalid. When a cache file expires, it is replaced with a new cache upon the next request for the same data. By default, cache files expire after 5 minutes. You may specify an expiration time (in seconds) by passing the hash value of ExpireTime=>Seconds to mcSysInfo->Retrieve.

OBJECT DEFINETIONS

OBJECT mcSysInfo

The following is a list of object members available for the mcSysInfo object:

Class(@List)

Limit the class of information retrieved and returned to @List. The contents of @List should be valid class names as returned by sysinfo --list class. The default is to return all class types.

Destroy

This function should be called when the object is no longer needed. It will gracefully destroy the object including shutting down any remote connections which were established.

Host(Name)

Retrieve all information from server host Name which can either be a hostname or IP address. The host must be running mcsysinfod(1).

InputFile(Path)

Use the file specified by Path as input instead of running the mcsysinfo(1) program. The file must be in mcsysinforeport(5) format. The default is to run the mcsysinfo(1) program.

Password(String)

Use String as the plain text password to authenticate as (when required) when connecting to a mcsysinfod(8) server. You must set Password in conjunction with Username.

Port(Number)

Connect to mcsysinfod(8) on port Number on the host specified by the Host member. Defaults to the standard SSP port.

Program(Path)

Use Path as the pathname to the mcsysinfo(1) program. The default is /opt/sysinfo/bin/sysinfo.

ProgramArgs(@Array)

Specify @Array as a list of arguments (options) to be passed to Program.

Retrieve(%Options)

Perform retrieval of requested data. It accepts a hash argument of options and understands the following:

Cache=>1|0

If Cache is set to 1 or no Cache value is specified (the default), caching will be enabled. If Cache is set to 0 caching will be disabled.

CacheDir=>Dir

Cache directory.

ExpireTime=>Seconds

Number of seconds before cached data expires.

Refresh=>1

Refresh all requested data in the cache. Data is retreived directly from authorative sources and the cache files are updated.

Username(Name)

Use Name as the username to authenticate as (when required) when connecting to a mcsysinfod(8) server. You must set Username in conjunction with Password.

Version

Returns a hash of version information. The following hash members may be returned:

PRODUCT

The overall product version.

SIE

The version of the SysInfo Engine (SIE).

SERVER

The version of mcsysinfod(8). This is only returned if the Host object member is set and access to Host succeeded.

SSP

The version of the SysInfo Service Protocol (SSP) that Host speaks. This is only available if we can talk to mcsysinfod(8) on Host.

The following mcSysInfo object members contain the system configuration data after mcSysInfo->Retrieve is called:

Table 32. Data Members of mcSysInfo

MemberContentMore Info
BiosBIOS hardware data.OBJECT mcBios
FileSysFilesystem configuration data.OBJECT mcFileSys
GeneralGeneral system configuration data.OBJECT mcGeneral
HardwareHardware (device) configuration data.OBJECT mcHardware
KernelKernel configuration data.OBJECT mcKernel
MagniCompLicMagniComp License information.OBJECT mcMagniCompLic
NetIfNetwork Interface information.OBJECT mcNetIf
NetworkNetwork configuration information.OBJECT mcNetwork
LicenseLicense information.OBJECT mcLicense
SiteInfoSite specific information.OBJECT mcSiteInfo
SoftwareInstalled software data.OBJECT mcSoftware
SysConfSystem configuration data.OBJECT mcSysConf
PartitionDisk partition data.OBJECT mcPartition
PrinterPrinter queue data.OBJECT mcPrinter

OBJECT mcBios

The mcBios object contains data on BIOS hardware found in the system. The following are valid members:

Entries

Returns a hash of mcBiosInfo objects each of which details a BIOS. The hash key is a unique BIOS name. The value is an mcBiosInfo object. See OBJECT mcBiosInfo for details.

OBJECT mcBiosInfo

The table below specifies the valid members of the mcBiosInfo object and describes their usage.

MEMBERDESCRIPTIONRETURNS
NameBIOS NameScalar
DescriptDescription of BIOSScalar
VendorPrinter VendorScalar
ModelPrinter ModelScalar
VersionVersion of BIOSScalar
RevisionRevision of BIOSScalar
ReleaseDateDate this version of BIOS was released.Scalar
ReleaseDateNumDate this version of BIOS was released in UNIX numeric format (seconds since epoch).Integer

OBJECT mcFileSys

The mcFileSys object contains data on all filesystems on a system. The following are valid members:

Entries

Returns a hash of mcFileSysInfo objects each of which details a specific filesystem. The hash key is a unique filesystem name. The value is an mcFilesysInfo object. See OBJECT mcFileSysInfo for details.

OBJECT mcFileSysInfo

The table below specifies the valid members of the mcFileSysInfo object and describes their usage.

MEMBERDESCRIPTIONRETURNS
NameFilesystem NameScalar
DevNameDevice NameScalar
DevPathDevice PathScalar
DevPathRawDevice Path RawScalar
ServerServer of FilesystemScalar
TypeFilesystem TypeScalar
MntOptsMount OptionsArray
SizeTotal size of filesystemScalar
AmtUsedAmount of space usedScalar
AmtAvailAmount of space availableScalar

OBJECT mcHardware

The mcHardware object contains data on what hardware (devices) is installed on the system. The following are valid members:

Entries

Returns a hash of mcDevInfo objects each of which details an installed device. The hash key is a unique device name. The value is an mcDevInfo object. See OBJECT mcDevInfo for details.

A special device entry with a key of TOTAL DISK contains the total amount of disk space on the system.

OBJECT mcDevInfo

The table below specifies the valid members of the mcDevInfo object and describes their usage.

MEMBERDESCRIPTIONRETURNS
AliasesAliasesArray
AltNameAKA NameScalar
BusBus no. of deviceScalar
CapacityCapacity (size) of deviceScalar
ClassTypeClass TypeScalar
DescListList of misc descriptionsArray
DevNumDevice no. on BusScalar
DevSpecDevice type specific datavaries
DriverDriver nameScalar
FilesFilesArray
IdentIdentifierScalar
ModelModelScalar
ModelDescModel DescriptionScalar
NameName of deviceScalar
NextNext peer deviceScalar
NodeIDNode IDScalar
PartPart #Scalar
PortPort no. on BusScalar
RevisionRevisionScalar
SerialSerial #Scalar
SlavesList of child devicesArray
SpeedSpeed of deviceScalar
TypeTypeScalar
UnitUnitScalar
VendorManufacturerScalar

OBJECT mcCpuInfo

The table below specifies the valid members of the mcCpuInfo object and describes their usage. A mcCpuInfo object is usually available via mcDevInfo->DevSpec when mcDevInfo->Type is CPU.

MEMBERDESCRIPTIONRETURNS
ArchArchitectureScalar
ArchVerArchitecture VersionScalar
BitSizeBit SizeScalar
CachesList of onboard cachesArray
HasFPUHas FPUScalar
ManManufacturerScalar
ModelModelScalar
SerialSerial #Scalar
SpeedClock SpeedScalar
SteppingSteppingScalar

OBJECT mcCacheInfo

The table below specifies the valid members of the mcCacheInfo object and describes their usage. A mcCacheInfo object is usually available via the mcDevInfo->DevSpec->Caches array when mcDevInfo->Type is processor.

MEMBERDESCRIPTIONRETURNS
NameName of the cacheScalar
DeviceName of device cache is onScalar
EnabledIs the cache enabled?Scalar
TypeThe type of cacheScalar
SizeThe size of the cache (KB)Scalar
SpeedClock SpeedScalar
AssocAssociativetyScalar
Lines# of LinesScalar
LineSizeLine SizeScalar
TLB# TLBScalar
TLBAssocTLB AssociativetyScalar
SocketedIs cache socketed?Scalar
LocationLocation relative to CPUScalar
SramTypeType of SRAMScalar
EccTypeECC TypeScalar
ModeMode of operationScalar

OBJECT mcGeneral

The mcGeneral object contains general system configuration data. The table below specifies the valid members of the mcGeneral object and describes their usage.

MEMBERDESCRIPTIONRETURNS
HostnameHost NameScalar
HostAliasesHost AliasesArray
HostAddrsHost AddressesArray
HostIdHost IDScalar
SerialSerial #Scalar
ManShortManufacturer (Short)Scalar
ManLongManufacturer (Long)Scalar
ManManufacturerScalar
ModelModelScalar
PhysMemPhysical MemoryScalar
VirtMemVirtual MemoryScalar
RomVerROM VersionScalar
NumCpuNumber of CPU (Physical)Scalar
NumCpuVirtNumber of CPU (Virtual)Scalar
CpuTypeCPU TypeScalar
CpuModelCPU ModelScalar
CpuSpeedCPU SpeedScalar
AppArchApp ArchitectureScalar
KernArchKernel ArchitectureScalar
KernBitsKernel Bit SizeScalar
OSnameOS NameScalar
OSverOS VersionScalar
OSdistOS DistributionScalar
OSdistNameOS Distribution NameScalar
OSdistShNameOS Distribution Short NameScalar
OSdistVerOS Distribution VersionScalar
KernVerKernel VersionScalar
BootTimeBoot TimeScalar
CurrentTimeCurrent TimeScalar
LibcNameLibc NameScalar
LibcVerLibc VersionScalar
TimeZoneTime ZoneScalar
PrimaryUserLoginSystem's Primary User LoginScalar
PrimaryUserNameSystem's Primary User (full) NameScalar

OBJECT mcLicense

This object contains information about all licenses which were obtained from license servers or other sources on the system scanned by this API. The following are the valid members for this object:

Entries

A hash table of mcLicenseInfo objects, each of which contains the actual license data.

OBJECT mcLicenseInfo

This object contains information about one license. The members of this object are:

MEMBERDESCRIPTIONRETURNS
SoftNameSoftware NameScalar
SoftVerSoftware VersionScalar
TypeType of licenseScalar
TypeDescDescription of Type of licenseScalar
PortPort license server listens onScalar
FileFile containing licenseScalar
ServerSoftName of license server softwareScalar
ServerVerVersion of license server softwareScalar
VendorServerSoftName of license vendor's server softwareScalar
VendorServerVerVersion of license vendor's server softwareScalar
Count# of licenses (RTUs)Scalar
IssuerWho issued licenseScalar
HostidHostid license is tied toScalar
IssueDateDate license was issuedScalar
StartDateDate license startsScalar
ExpireDateDate license expiresScalar
DaysLeft# days before expirationScalar
KeyLicense keyScalar
SerialSerial # of licenseScalar
MinCPUMinimum # of CPUs license is valid forScalar
MaxCPUMax # of CPUs license is valid forScalar
AccountNameName of customer's accountScalar
AccountNumberCustomer account numberScalar
CommentFree form comment fieldScalar
LicenseURLURL of license termsScalar
HomePageURLURL of productScalar
StatusStatus of licenseScalar
HostNameName of host license is tied toScalar

OBJECT mcMagniCompLic

The mcMagniCompLic object contains data on MagniComp SysInfo licenses. The following are valid members:

Entries

A hash table of SysInfo licenses each contained in a mcLicenseInfo object.

EntriesReport

A hash table of SysInfo licenses in mcsysinforeport(5) (report) format.

OBJECT mcKernel

The mcKernel object contains data on kernel variables and configuration. The following are valid members:

Entries

Returns a hash of mcName objects each of which details a kernel entry. The hash key is a unique variable name. The value is an mcName object. See OBJECT mcName for details.

OBJECT mcNetIf

This object contains information about all network interfaces found on the scanned system. The following are the valid members for this object:

Entries

A hash table of mcNetIfInfo objects, each of which contains the actual network interface data.

OBJECT mcNetIfInfo

The table below specifies the valid members of the mcNetIfInfo object and describes their usage. A mcNetIfInfo object is usually available via mcDevInfo->DevSpec when mcDevInfo->Type is netif as well as in the Entries hash in the mcNetIf object.

MEMBERDESCRIPTIONRETURNS
NameNIC NameScalar
TypeNIC Address TypeScalar
IfTypeNIC Interface TypeScalar
HostAddrNIC Host AddressScalar
HostNameNIC Host NameScalar
MACaddrNIC MAC Current AddressScalar
MACnameNIC MAC Current NameScalar
FacMACaddrNIC MAC Factory AddressScalar
FacMACnameNIC MAC Factory NameScalar
NetAddrNIC Network AddressScalar
NetNameNIC Network NameScalar
NetMaskNIC Network MaskScalar
BroadAddrNIC Broadcast AddressScalar
MtuSizeNIC MTU SizeScalar
SpeedNIC Link SpeedScalar
DuplexNIC Link DuplexScalar
FlagsNIC flagsHash
MediaTypeNIC Media TypeScalar
MediaSubTypeNIC Media Sub TypeScalar

OBJECT mcNetwork

This object contains information about network configuration. The following are the valid members for this object:

Entries

A hash table of mcNetIfInfo objects, each of which contains the actual network interface data. There is currently only one supported keyword called Network.

OBJECT mcNetworkInfo

The table below specifies the valid members of the mcNetworkInfo object and describes their usage. A mcNetworkInfo object is usually available via the Entries hash in the mcNetwork object.

MEMBERDESCRIPTIONRETURNS
DefGatewayIPDefault gateway IP addressScalar
DefGatewayNameDefault gateway hostnameScalar
DnsDomainDNS domain nameScalar
DnsServerIPsDNS server IP addressesArray
DnsServerNamesDNS server hostnamesArray
NisDomainNIS domain nameScalar
NisServerMethodNIS server selection methodScalar
NisServerIPsNIS server IP addressesArray
NisServerNamesNIS server hostnamesArray
NisServerCurrentCurrently bound NIS serverScalar
NisMasterNIS master serverScalar

OBJECT mcPartition

The mcPartition object contains data on what disk partitions are on the system. The following are valid members:

Entries

Returns a hash of mcPartInfo objects each of which details a partition entry. The hash key is a unique partition name. The value is an mcPartInfo object. See OBJECT mcPartInfo for details.

OBJECT mcPartInfo

The table below specifies the valid members of the mcPartInfo object and describes their usage.

MEMBERDESCRIPTIONRETURNS
NamePartition NameScalar
DevNameDevice NameScalar
DevPathDevice PathScalar
DevPathRawDevice Path RawScalar
BaseNameBase NameScalar
SliceSliceScalar
NumPartition #Scalar
TypeTypeScalar
TypeDescType DescriptionScalar
TypeNumType NumberScalar
UsageStatusUsage StatusScalar
MntNameMount NameScalar
MntOptsMount OptionsArray
SizeSize (MB)Scalar
AmtUsedAmount Used (MB)Scalar
SecSizeSector Size (bytes)Scalar
StartSectStarting SectorScalar
EndSectEnding SectorScalar
NumSectNumber of SectorsScalar

OBJECT mcPrinter

The mcPrinter object contains data on what printer queues are on the system. The following are valid members:

Entries

Returns a hash of mcPrinterInfo objects each of which details a printer queue. The hash key is a unique printer name. The value is an mcPrinterInfo object. See OBJECT mcPrinterInfo for details.

OBJECT mcPrinterInfo

The table below specifies the valid members of the mcPrinterInfo object and describes their usage.

MEMBERDESCRIPTIONRETURNS
NameQueue NameScalar
AliasesQueue AliasesArray
DescriptDescription of queueScalar
VendorPrinter VendorScalar
ModelPrinter ModelScalar
ProtoCommunication ProtocolScalar
DevicePathname to printer deviceScalar
ServerName of server printer is onScalar
RemoteQueueQueue name on ServerScalar
LangsSupported printer languagesArray
SpoolDirSpool DirectoryScalar
MaxJobSizeMax size of each jobScalar
DescListMisc descriptionsArray

OBJECT mcSiteInfo

The mcSiteInfo object contains site defined information customized by each site. The following are valid members:

Entries

Returns a hash of mcSiteInfoEntry objects each of which details a specific site defined data entry. The hash key is a unique SiteInfo variable name defined by the site. The value is an mcSiteInfoEntry object. See OBJECT mcSiteInfoEntry for details.

OBJECT mcSiteInfoEntry

The table below specifies the valid members of the mcSiteInfoEntry object and describes their usage.

MEMBERDESCRIPTIONRETURNS
VarVariable NameScalar
DescriptionDescription of what Variable meansScalar
ValueValue for this entryScalar

OBJECT mcSoftware

The mcSoftware object contains data on what software is installed on the system. The following are valid members:

Entries

Returns a hash of mcSoftInfo objects each of which details an installed software package. The hash key is a unique package name. The value is an mcSoftInfo object. See OBJECT mcSoftInfo for details.

OBJECT mcSoftInfo

The table below specifies the valid members of the mcSoftInfo object and describes their usage.

MEMBERDESCRIPTIONRETURNS
NameName of packageScalar
EntryTypeEntry TypeScalar
VersionVersionScalar
RevisionRevisionScalar
DescriptionDescriptionScalar
DescVerboseDescription (Verbose)Scalar
URLURLScalar
LicenseLicenseScalar
CopyrightCopyrightScalar
CategoryCategoryScalar
SubCategorySub-CategoryScalar
OSnameRequires OS NameScalar
OSversionRequires OS VersionScalar
ArchRequires ArchitectureScalar
ISArchRequires Inst Set ArchScalar
InstDateInstallation DateScalar
BuildDateBuild DateScalar
ProdStampProduction StampScalar
BaseDirBase DirectoryScalar
PkgDepsList of dependant packagesArray
DiskUsageDisk UsageScalar
FileListFile ListArray
VendorNameVendor NameScalar
VendorEmailVendor EmailScalar
VendorPhoneVendor Phone #Scalar
VendorStockVendor Stock #Scalar
DescListList of misc description dataArray
MasterName of master packageScalar
MasterVerVersion of masterScalar
MasterRevRevisionof masterScalar
SlavesList of child packagesArray
NextNext peer packageScalar

OBJECT mcSysConf

The mcSysConf object contains data on system configuration data obtained via sysconf(3). The following are valid members:

Entries

Returns a hash of mcName objects each of which details a SysConf entry. The hash key is a unique SysConf variable name. The value is an mcName object. See OBJECT mcName for details.

OBJECT mcName

The table below specifies the valid members of the mcName object and describes their usage.

MEMBERDESCRIPTIONRETURNS
NameVariable nameScalar
DescDescription of entryScalar
ValueValue of this variableScalar

EXAMPLES

For detailed examples please take a look at /opt/sysinfo/lib/ui/uiGUI.pm This is the main module which implements the GUI for mcsysinfo(1) which utilizes the mcSysInfo interface.

The following example displays the hostname and system model:

use lib ('/opt/sysinfo/lib/mcSysInfo');
use mcSysInfo;

$si = mcSysInfo->New;
# Only retrieve the info we need
$si->Class('General');
$si->Retrieve();

printf ("System hostname is %s\n", $si->General->Hostname);
printf ("System model is %s\n", $si->General->Model);

The following example displays a list of all device names and their model (if known):

use lib ('/opt/sysinfo/lib/mcSysInfo');

use mcSysInfo;

$si = mcSysInfo->New;
# Only retrieve the info we need
$si->Class('Hardware');
$si->Retrieve();

foreach my $Key (keys %{ $si->Hardware->Entries }) {
	my $di = $si->Hardware->Entries->{$Key};
	printf ("Device %s is a %s\n", $Key, $di->Model);
}

FILES

/opt/sysinfo/bin/mcsysinfoPath to sysinfo program

SEE ALSO

mcsysinfo(1), perl(1), mcsysinfoc(3)

URL

http://www.MagniComp.com/sysinfo