Content-type: text/html Manpage of mcsysinfoperl

mcsysinfoperl

Section: C Library Functions (3)
Updated: 12 April 2003
Index Return to Main Contents
 

NAME

mcsysinfoperl - MagniComp(tm) SysInfo(tm) Perl API to obtain detailed system information in a platform neutral manner  

SYNOPSIS

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

$mcSysInfo = mcSysInfo->New;

# Optional: 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 SysInfo(tm) from MagniComp(tm) (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(tm) (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 sysinfo(1) program. The file must be the output from sysinfo -repsep '|' -format report The default is to run the sysinfo(1) program.
Password(String)
Use String as the plain text password to authenticate as (when required) when connecting to a mcsysinfod(1) server. You must set Password in conjunction with Username.
Port(Number)
Connect to mcsysinfod(1) 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 sysinfo(1) program. The default is /opt/sysinfo/bin/sysinfo
ProgramArgs(@Array)
Specify @Array as a list of options to be passed to Program.
Retrieve(%Options)
This member retrieves the requested data as documented in DESCRIPTION. 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(1) 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(1). 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(1) on Host.

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

General
General system configuration data. See OBJECT mcGeneral below.
Hardware
Hardware (device) configuration data. See OBJECT mcHardware below.
MagniCompLic
MagniComp License information. See OBJECT mcMagniCompLic below.
NetIf
Network Interface information. See OBJECT mcNetIf below.
Network
Network configuration information. See OBJECT mcNetwork below.
License
License information. See OBJECT mcLicense below.
Software
Installed software data. See OBJECT mcSoftware below.
Partition
Disk partition data. See OBJECT mcPartition below.
Printer
Printer queue data. See OBJECT mcPrinter below.
SysConf
System configuration data. See OBJECT mcSysConf below.
Kernel
Kernel configuration data. See OBJECT mcKernel below.

 

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. See mcsysinfo(3) for more details describing each member.

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. See mcsysinfo(3) for more details describing each member.

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. See mcsysinfo(3) for more details describing each member.

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. See mcsysinfo(3) for more details describing each member.

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
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

 

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. See mcsysinfoc(3) for more details describing each member.

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. See mcsysinfoc(3) for more details describing each member.

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. See mcsysinfo(3) for more details describing each member.

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. See mcsysinfo(3) for more details describing each member.

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 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. See mcsysinfo(3) for more details describing each member.

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. See mcsysinfo(3) for more details describing each member.

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 model which implements the GUI for sysinfo(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/mcsysinfo     - Path to sysinfo program
 

SEE ALSO

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

URL

http://www.MagniComp.com/sysinfo


 

Index

NAME
SYNOPSIS
DESCRIPTION
FILE CACHE
OBJECT DEFINETIONS
OBJECT mcSysInfo
OBJECT mcHardware
OBJECT mcDevInfo
OBJECT mcCpuInfo
OBJECT mcCacheInfo
OBJECT mcGeneral
OBJECT mcLicense
OBJECT mcLicenseInfo
OBJECT mcMagniCompLic
OBJECT mcKernel
OBJECT mcNetIf
OBJECT mcNetIfInfo
OBJECT mcNetwork
OBJECT mcNetworkInfo
OBJECT mcPartition
OBJECT mcPartInfo
OBJECT mcPrinter
OBJECT mcPrinterInfo
OBJECT mcSoftware
OBJECT mcSoftInfo
OBJECT mcSysConf
OBJECT mcName
EXAMPLES
FILES
SEE ALSO
URL

This document was created by man2html, using the manual pages.
Time: 16:24:16 GMT, May 20, 2003