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.
-
Member | Description | Returns
|
Aliases | Aliases | Array
|
AltName | AKA Name | Scalar
|
Bus | Bus no. of device | Scalar
|
Capacity | Capacity (size) of device | Scalar
|
ClassType | Class Type | Scalar
|
DescList | List of misc descriptions | Array
|
DevNum | Device no. on Bus | Scalar
|
DevSpec | Device type specific data | varies
|
Driver | Driver name | Scalar
|
Files | Files | Array
|
Ident | Identifier | Scalar
|
Model | Model | Scalar
|
ModelDesc | Model Description | Scalar
|
Name | Name of device | Scalar
|
Next | Next peer device | Scalar
|
NodeID | Node ID | Scalar
|
Part | Part # | Scalar
|
Port | Port no. on Bus | Scalar
|
Revision | Revision | Scalar
|
Serial | Serial # | Scalar
|
Slaves | List of child devices | Array
|
Speed | Speed of device | Scalar
|
Type | Type | Scalar
|
Unit | Unit | Scalar
|
Vendor | Manufacturer | Scalar
|
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.
-
Member | Description | Returns
|
Arch | Architecture | Scalar
|
ArchVer | Architecture Version | Scalar
|
BitSize | Bit Size | Scalar
|
Caches | List of onboard caches | Array
|
HasFPU | Has FPU | Scalar
|
Man | Manufacturer | Scalar
|
Model | Model | Scalar
|
Serial | Serial # | Scalar
|
Speed | Clock Speed | Scalar
|
Stepping | Stepping | Scalar
|
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.
-
Member | Description | Returns
|
Name | Name of the cache | Scalar
|
Device | Name of device cache is on | Scalar
|
Enabled | Is the cache enabled? | Scalar
|
Type | The type of cache | Scalar
|
Size | The size of the cache (KB) | Scalar
|
Speed | Clock Speed | Scalar
|
Assoc | Associativety | Scalar
|
Lines | # of Lines | Scalar
|
LineSize | Line Size | Scalar
|
TLB | # TLB | Scalar
|
TLBAssoc | TLB Associativety | Scalar
|
Socketed | Is cache socketed? | Scalar
|
Location | Location relative to CPU | Scalar
|
SramType | Type of SRAM | Scalar
|
EccType | ECC Type | Scalar
|
Mode | Mode of operation | Scalar
|
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.
-
Member | Description | Returns
|
Hostname | Host Name | Scalar
|
HostAliases | Host Aliases | Array
|
HostAddrs | Host Addresses | Array
|
HostId | Host ID | Scalar
|
Serial | Serial # | Scalar
|
ManShort | Manufacturer (Short) | Scalar
|
ManLong | Manufacturer (Long) | Scalar
|
Man | Manufacturer | Scalar
|
Model | Model | Scalar
|
PhysMem | Physical Memory | Scalar
|
VirtMem | Virtual Memory | Scalar
|
RomVer | ROM Version | Scalar
|
NumCpu | Number of CPU (Physical) | Scalar
|
NumCpuVirt | Number of CPU (Virtual) | Scalar
|
CpuType | CPU Type | Scalar
|
CpuSpeed | CPU Speed | Scalar
|
AppArch | App Architecture | Scalar
|
KernArch | Kernel Architecture | Scalar
|
KernBits | Kernel Bit Size | Scalar
|
OSname | OS Name | Scalar
|
OSver | OS Version | Scalar
|
OSdist | OS Distribution | Scalar
|
OSdistName | OS Distribution Name | Scalar
|
OSdistShName | OS Distribution Short Name | Scalar
|
OSdistVer | OS Distribution Version | Scalar
|
KernVer | Kernel Version | Scalar
|
BootTime | Boot Time | Scalar
|
CurrentTime | Current Time | Scalar
|
LibcName | Libc Name | Scalar
|
LibcVer | Libc Version | Scalar
|
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:
-
Member | Description | Returns
|
SoftName | Software Name | Scalar
|
SoftVer | Software Version | Scalar
|
Type | Type of license | Scalar
|
TypeDesc | Description of Type of license | Scalar
|
Port | Port license server listens on | Scalar
|
File | File containing license | Scalar
|
ServerSoft | Name of license server software | Scalar
|
ServerVer | Version of license server software | Scalar
|
VendorServerSoft | Name of license vendor's server software | Scalar
|
VendorServerVer | Version of license vendor's server software | Scalar
|
Count | # of licenses (RTUs) | Scalar
|
Issuer | Who issued license | Scalar
|
Hostid | Hostid license is tied to | Scalar
|
IssueDate | Date license was issued | Scalar
|
StartDate | Date license starts | Scalar
|
ExpireDate | Date license expires | Scalar
|
DaysLeft | # days before expiration | Scalar
|
Key | License key | Scalar
|
Serial | Serial # of license | Scalar
|
MinCPU | Minimum # of CPUs license is valid for | Scalar
|
MaxCPU | Max # of CPUs license is valid for | Scalar
|
AccountName | Name of customer's account | Scalar
|
AccountNumber | Customer account number | Scalar
|
Comment | Free form comment field | Scalar
|
LicenseURL | URL of license terms | Scalar
|
HomePageURL | URL of product | Scalar
|
Status | Status of license | Scalar
|
HostName | Name of host license is tied to | Scalar
|
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.
-
Member | Description | Returns
|
Name | NIC Name | Scalar
|
Type | NIC Address Type | Scalar
|
IfType | NIC Interface Type | Scalar
|
HostAddr | NIC Host Address | Scalar
|
HostName | NIC Host Name | Scalar
|
MACaddr | NIC MAC Current Address | Scalar
|
MACname | NIC MAC Current Name | Scalar
|
FacMACaddr | NIC MAC Factory Address | Scalar
|
FacMACname | NIC MAC Factory Name | Scalar
|
NetAddr | NIC Network Address | Scalar
|
NetName | NIC Network Name | Scalar
|
NetMask | NIC Network Mask | Scalar
|
BroadAddr | NIC Broadcast Address | Scalar
|
MtuSize | NIC MTU Size | Scalar
|
Speed | NIC Link Speed | Scalar
|
Duplex | NIC Link Duplex | Scalar
|
Flags | NIC flags | Hash
|
MediaType | NIC Media Type | Scalar
|
MediaSubType | NIC Media Sub Type | Scalar
|
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.
-
Member | Description | Returns
|
DefGatewayIP | Default gateway IP address | Scalar
|
DefGatewayName | Default gateway hostname | Scalar
|
DnsDomain | DNS domain name | Scalar
|
DnsServerIPs | DNS server IP addresses | Array
|
DnsServerNames | DNS server hostnames | Array
|
NisDomain | NIS domain name | Scalar
|
NisServerMethod | NIS server selection method | Scalar
|
NisServerIPs | NIS server IP addresses | Array
|
NisServerNames | NIS server hostnames | Array
|
NisServerCurrent | Currently bound NIS server | Scalar
|
NisMaster | NIS master server | Scalar
|
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.
-
Member | Description | Returns
|
Name | Partition Name | Scalar
|
DevName | Device Name | Scalar
|
DevPath | Device Path | Scalar
|
DevPathRaw | Device Path Raw | Scalar
|
BaseName | Base Name | Scalar
|
Slice | Slice | Scalar
|
Num | Partition # | Scalar
|
Type | Type | Scalar
|
TypeDesc | Type Description | Scalar
|
TypeNum | Type Number | Scalar
|
UsageStatus | Usage Status | Scalar
|
MntName | Mount Name | Scalar
|
MntOpts | Mount Options | Array
|
Size | Size (MB) | Scalar
|
AmtUsed | Amount Used (MB) | Scalar
|
SecSize | Sector Size (bytes) | Scalar
|
StartSect | Starting Sector | Scalar
|
EndSect | Ending Sector | Scalar
|
NumSect | Number of Sectors | Scalar
|
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.
-
Member | Description | Returns
|
Name | Queue Name | Scalar
|
Aliases | Queue Aliases | Array
|
Descript | Description of queue | Scalar
|
Vendor | Printer Vendor | Scalar
|
Model | Printer Model | Scalar
|
Proto | Communication Protocol | Scalar
|
Device | Pathname to printer device | Scalar
|
Server | Name of server printer is on | Scalar
|
RemoteQueue | Queue name on Server | Scalar
|
Langs | Supported printer languages | Array
|
SpoolDir | Spool Directory | Scalar
|
MaxJobSize | Max size of each job | Scalar
|
DescList | Misc descriptions | Array
|
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.
-
Member | Description | Returns
|
Name | Name of package | Scalar
|
EntryType | Entry Type | Scalar
|
Version | Version | Scalar
|
Revision | Revision | Scalar
|
Description | Description | Scalar
|
DescVerbose | Description (Verbose) | Scalar
|
URL | URL | Scalar
|
License | License | Scalar
|
Copyright | Copyright | Scalar
|
Category | Category | Scalar
|
SubCategory | Sub-Category | Scalar
|
OSname | Requires OS Name | Scalar
|
OSversion | Requires OS Version | Scalar
|
Arch | Requires Architecture | Scalar
|
ISArch | Requires Inst Set Arch | Scalar
|
InstDate | Installation Date | Scalar
|
BuildDate | Build Date | Scalar
|
ProdStamp | Production Stamp | Scalar
|
BaseDir | Base Directory | Scalar
|
PkgDeps | List of dependant packages | Array
|
DiskUsage | Disk Usage | Scalar
|
FileList | File List | Array
|
VendorName | Vendor Name | Scalar
|
VendorEmail | Vendor Email | Scalar
|
VendorPhone | Vendor Phone # | Scalar
|
VendorStock | Vendor Stock # | Scalar
|
DescList | List of misc description data | Array
|
Master | Name of master package | Scalar
|
MasterVer | Version of master | Scalar
|
MasterRev | Revisionof master | Scalar
|
Slaves | List of child packages | Array
|
Next | Next peer package | Scalar
|
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.
-
Member | Description | Returns
|
Name | Variable name | Scalar
|
Desc | Description of entry | Scalar
|
Value | Value of this variable | Scalar
|
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