# OSvms.def: VMS Specific Code
# $Id: OSvms.def,v 1.22 2008/02/25 17:32:55 mschenke Exp $
# ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/modules/OSvms.def,v 1.22 2008/02/25 17:32:55 mschenke Exp $
#
# Change History
# 20080225 MSC Change the copyright notice.
=head1 NAME
OSvms - Sub Module Specific to the VMS Operating System
=cut
# Make the module persistent
keep $KEEP_BLOCK,@SHARE_MACROS
var @SHARE_MACROS = ('ping_command')
# Get the calling module
var $MODULE = $arg[0]
import $TOC,$TOP
=head1 DESCRIPTION
This module determines the 'ps' command format.
=cut
if !$OS
{keep $OS,$OSA,$OSP
var $OS = true
# Determine the ps command format
var $OSP = 'show system'
var $OSA = undef
}
#------------------------------------------------------------------------------
=head1 CONTRIBUTION TO THE INI MODULE
Nothing required yet.
=cut
if compare('eq',$MODULE,'INI')
{# Nothing required yet
}
#------------------------------------------------------------------------------
=head1 CONTRIBUTION TO THE END MODULE
=head2 report - Report Settings
Determines the operating system version and its bit size.
=cut
elsif compare('eq',$MODULE,'END_report')
{#Determine for the end report the operating system version and its bit size.
debug ' Inside END module, determining OS characteristics'
write '|Platform|64-bit ',uname('s'),'|'
write '|O/S Version|',uname('v'),'|'
}
=head2 system - System Information
Extracts the system information such as CPU, memory, and swap information.
=cut
elsif compare('eq',$MODULE,'END_system')
{prefix
write '|*Item*|*Value*|'
debug ' Inside END module, getting CPU information (vms)'
var $cnt = 0
var ($cpu) = command('write sys$output f$getsyi("ARCH_NAME")')
loop $lin (grepCommand('show cpu/full','^\s+Speed\.+:\s'))
{incr $cnt
var $mhz[$cnt] = field('Speed\.+:\s*',1,$lin)
}
if $cnt
{var ($off,$str) = (0,concat($cnt,' Processor(s) Installed'))
while expr('<',$off,$cnt)
{incr $off
var $str = sprintf('%s%%BR%%[%02d]: %s %d MHz',$str,$off,\
$cpu,$mhz[$off])
}
write '|Processor(s)|',$str,'|'
}
write '|Active Processors|',\
command('write sys$output f$getsyi("ACTIVECPU_CNT")'),'|'
debug ' Inside END module, getting system model (vms)'
write '|System Model|',command('write sys$output f$getsyi("HW_NAME")'),'|'
debug ' Inside END module, getting memory information (vms)'
var $mem = 0
loop $lin (grepCommand('show mem/physical/unit=byte','Main Memory'))
{if match($lin,'\s\((\w+)\)\s+([\d\.]+)\s+([\d\.]+)\s')
{var ($unt,$tot,$fre) = (last)
write sprintf('|Total Physical Memory|%s %s|',$tot,$unt)
write sprintf('|Available Physical Memory|%s %s|',$fre,$unt)
}
}
debug ' Inside END module, getting swap and page information (vms)'
if loadCommand('show mem/files/unit=byte')
{macro dsp_usage
{var ($typ,$unt,$tot,$fre) = @arg
if $unt
{write sprintf('|%s: Max size|%s %s|',$typ,$tot,$unt)
write sprintf('|%s: Available|%s %s|',$typ,$fre,$unt)
}
}
var ($tot,$fre,$typ,$unt) = (0,0)
loop $lin (getLines())
{if match($lin,'^\s+\((\w+)\)\s+[\d\.]+\s+([\d\.]+)\s+([\d\.]+)')
{var ($unt,$nb1,$nb2) = (last)
incr $tot,$nb1
incr $fre,$nb2
}
elsif match($lin,'^Swap File Usage ')
{call dsp_usage($typ,$unt,$tot,$fre)
var ($typ,$cnt,$tot,$fre,$unt) = ('Swap',0,0)
}
elsif match($lin,'^Paging File Usage ')
{call dsp_usage($typ,$unt,$tot,$fre)
var ($typ,$cnt,$tot,$fre,$unt) = ('Paging',0,0)
}
}
call dsp_usage($typ,$unt,$tot,$fre)
}
if !hasOutput(true)
write 'Information not available'
}
#------------------------------------------------------------------------------
=head1 CONTRIBUTION TO THE OS MODULE
=cut
elsif compare('eq',$MODULE,'OS')
{
=head2 cpu_info - CPUs
Gets CPU information.
=cut
debug ' Inside OS module, getting CPU information (vms)'
report cpu_info
var $cmd = 'show cpu/ful'
write '---+ CPU Information'
write '---## Using: ',$cmd
call writeCommand($cmd)
toc '2:[[',getFile(),'][rda_report][CPUs]]'
=head2 memory_info - Memory
Gets information about the physical memory.
=cut
debug ' Inside OS module, about physical memory (vms)'
report memory_info
var $cmd = 'show mem/physical'
write '---+ Physical Memory Installed'
write '---## Using: ',$cmd
call writeCommand($cmd)
toc '2:[[',getFile(),'][rda_report][Memory]]'
=head2 disk_info - Disk Drives
Gets information about the disks.
=cut
debug ' Inside OS module, about disks (vms)'
report disk_info
write '---+!! Disk Information'
write $TOC
write '---+ Disk Mounts / Disk Free'
call writeCommand('show dev d/mount/unit=byte')
write $TOP
write '---+ Swap'
call writeCommand('show mem/files/unit=byte')
write $TOP
toc '2:[[',getFile(),'][rda_report][Disk Drives]]'
=head2 patches - Operating System Patches
Lists the operating system patches installed.
=cut
debug ' Inside OS module, getting operating system patches'
report patches
var $cmd = 'product show history'
write '---+ Operating System Patches Information'
write '---## Using: ',$cmd
call writeCommand($cmd)
toc '2:[[',getFile(),'][rda_report][Operating System Patches]]'
=head2 sysdef - System/Kernel Settings
Gets the system/kernel settings.
=cut
debug ' Inside OS module, getting system/kernel settings'
report sysdef
write '---+!! System/Kernel Settings'
write $TOC
loop $cmd ('mc sysman parameter show /all',\
'mc sysman parameter show /special',\
'type sys$system:modparams.dat')
{write '---+ Using: ',$cmd
call writeCommand($cmd)
write $TOP
}
toc '2:[[',getFile(),'][rda_report][System/Kernel Settings]]'
=head2 system_error_log - System Error Log
Collects system error log data.
=cut
debug ' Inside OS module, getting system error log data'
report system_error_log
write '---+!! System Error Log Data'
write $TOC
var $cmd = 'type/tail=1000 SYS$MANAGER:OPERATOR.LOG'
write '---++ Using: ',$cmd
call writeCommand($cmd)
write $TOP
toc '2:[[',getFile(),'][rda_report][System Error Log]]'
=head2 cluster - Cluster
Collects VMS cluster details.
=cut
debug ' Inside OS module, getting cluster details'
report cluster
write '---+ Cluster Details'
var ($flg) = command('write sys$output f$getsyi("CLUSTER_MEMBER")')
if match($flg,'TRUE',true)
{if createTemp('VMS','.com')
{var $pgm = last
call writeTemp('VMS','$ context=""')
call writeTemp('VMS','$loop_start:')
call writeTemp('VMS','$ cluster_id = f$csid(CONTEXT)')
call writeTemp('VMS','$ if cluster_id .eqs. "" then goto loop_end')
call writeTemp('VMS',"$ write sys$output \042\
|''f$getsyi(\042NODENAME\042,,cluster_id)'\
| ''f$getsyi(\042NODE_NUMBER\042,,cluster_id)'\
| ''f$getsyi(\042NODE_QUORUM\042,,cluster_id)'\
| ''f$getsyi(\042NODE_VOTES\042,,cluster_id)'|")
call writeTemp('VMS','$ goto loop_start')
call writeTemp('VMS','$loop_end:')
call closeTemp('VMS')
prefix
write '|*Node Name*| *Node Number*| *Node Quorum*| *Node Votes*|'
if loadCommand(concat('@',$pgm))
{loop $lin (getLines())
write $lin
}
if !hasOutput(true)
write '**Cluster script error**'
call unlinkTemp('COM')
}
}
else
write '**Not a member of a cluster**'
toc '2:[[',getFile(),'][rda_report][Cluster]]'
=pod
Identifies useful platform-related links.
=cut
var \@LINKS = $arg[1]
var @LINKS = ('http://h71000.www7.hp.com/',\
'http://h71000.www7.hp.com/serv_support.html',\
'http://h71000.www7.hp.com/doc/')
}
#------------------------------------------------------------------------------
=head1 CONTRIBUTION TO THE PERF MODULE
=cut
elsif compare('eq',$MODULE,'PERF')
{# Produce the performance report
report perf_over
write '---+!! Performance Overview'
write $TOC
macro write_page
{var ($cmd) = @arg
if loadCommand($cmd)
{var $flg = false
prefix
{write ''
var $flg = true
}
loop $lin (getLines())
{if replace($lin,'\s+$')
write last
elsif hasOutput()
{prefix
write
}
}
if or(hasOutput(true),$flg)
write ''
}
}
=pod
Gets system uptime.
=cut
debug ' Inside PERF module, about to execute uptime command'
prefix
write '---+ Uptime'
call writeCommand('write sys$output f$getsyi("BOOTTIME")')
if hasOutput(true)
write $TOP
=pod
Gets a process overview in terms of running databases, users logged on, and top
CPU users.
=cut
write '---+ Process Overview'
debug ' Inside PERF module, about to determine running databases'
prefix
write '---++ Running Databases'
call writeCommand('show system/process=*PMON*')
if hasOutput(true)
write $TOP
debug ' Inside PERF module, about to determine users logged on'
write '---++ Who is Logged On?'
call writeCommand('show user/full')
write $TOP
debug ' Inside PERF module, about to determine top CPU users'
write '---++ Top CPU Users'
call write_page('monitor process/topcpu/interval=3/end="+00:00:10"')
write $TOP
=pod
Gets a disk overview in terms of free space, disk I/O, queue length, and paging
files.
=cut
write '---+ Disk Overview'
debug ' Inside PERF module, about to gather disk free space'
write '---++ Disk Devices Free Space in 512Kb blocks'
call writeCommand('show device d')
write $TOP
debug ' Inside PERF module, about to gather disk I/O and queue length'
write '---++ Disk I/O and Queue Length'
call write_page('monitor disk/item=all/interval=3/end="+00:00:10"')
write $TOP
debug ' Inside PERF module, about to gather memory paging files'
write '---++ Memory Paging Files'
call writeCommand('show memory/file')
write $TOP
=pod
Gets a memory overview in terms of paging and resources.
=cut
write '---+Memory Overview'
debug ' Inside PERF module, about to gather memory paging'
write '---++Memory Paging'
call write_page('monitor page/interval=3/end="+00:00:10"')
write $TOP
debug ' Inside PERF module, about to gather memory resources'
write '---++Memory Resources'
call writeCommand('show memory')
write $TOP
toc '2:[[',getFile(),'][rda_report][Overview]]'
}
#------------------------------------------------------------------------------
=head1 CONTRIBUTION TO THE NET MODULE
Determines the 'ping' command format.
=cut
elsif compare('eq',$MODULE,'NET')
{var (undef,\$PING,\$NETSTAT,\$PS_ARG,\$PS_EF) = @arg
var $PING = 'tcpip ping /number=10 /packet_size=%d %s'
var $NETSTAT = 'tcpip netstat'
var $PS_ARG = $OSA
var $PS_EF = $OSP
=head2 ifconfig - Interface Configuration
Gets the network interface configuration and lists TCP/IP hosts.
=cut
debug ' Inside NET module, getting network interface configuration (vms)'
report ifconfig
write '---+!! Interface Configuration Information',
write $TOC
var $cmd = 'tcpip ifconfig "-a"'
write '---+ Interface Configuration',
write '---## Using: ',$cmd
call writeCommand($cmd)
write $TOP
var $cmd = "tcpip show host /local"
write '---+ TCP/IP Hosts',
write '---## Using: ',$cmd
call writeCommand($cmd)
write $TOP
toc '2:[[',getFile(),'][rda_report][Interface Configuration]]'
=head2 tcpip_settings - Local TCP/IP Settings
Gets the local TCP/IP settings.
=cut
debug ' Inside NET module, getting local tcp/ip settings (vms)'
report tcpip_settings
write '---+!! Local TCP/IP Settings'
write $TOC
loop $cmd ('tcpip show version',\
'tcpip show device',\
'tcpip show interface',\
'tcpip show service')
{prefix
write '---++ Using: ',$cmd
call writeCommand($cmd)
if hasOutput(true)
write $TOP
}
toc '2:[[',getFile(),'][rda_report][Local TCP/IP Settings]]'
=head2 cluster_settings - Cluster Settings
Gets the cluster settings.
=cut
debug ' Inside NET module, getting cluster settings (vms)'
report cluster_settings
write '---+!! Cluster TCP/IP Settings'
write $TOC
var @TTL = ('---++ Sysman Environment',\
'---++ Using: tcpip show version',\
'---++ Using: tcpip show protocol tcp /parameters',\
'---++ Using: tcpip show interface',\
'---++ Using: mcr lancp show device /parameters',\
'---++ Using: mcr lancp show device /counters',\
'---++ Using: tcpip show protocol udp',\
'---++ Using: tcpip show protocol udp /parameters',\
'---++ Using: netstat')
var $tmp = createTemp('VMS','.dat')
call writeTemp('VMS','SET ENVIRONMENT /CLUSTER')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO TCPIP SHOW VERSION')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO TCPIP SHOW PROTOCOL TCP /PARAMETERS')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO TCPIP SHOW INTERFACE')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO MCR LANCP SHOW DEVICE /PARAMETERS')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO MCR LANCP SHOW DEVICE /COUNTERS')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO TCPIP SHOW PROTOCOL UDP')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO TCPIP SHOW PROTOCOL UDP /PARAMETERS')
call writeTemp('VMS','SHOW ENVIRONMENT')
call writeTemp('VMS','DO MCR tcpip$netstat')
call writeTemp('VMS','EXIT')
call closeTemp('VMS')
if loadCommand(concat('PIPE MCR SYSMAN <',$tmp))
{var $cnt = 0
prefix
write
loop $lin (getLines())
{if match($lin,'^%SYSMAN-I-ENV')
{if hasOutput(true)
{write ''
write $TOP
}
write $TTL[$cnt]
var $flg = not($cnt)
prefix
write ''
incr $cnt
}
elsif match($lin,'^%SYSMAN-I-OUTPUT,\s+(.*)$')
{var ($flg,$src) = (true,last)
if hasOutput(true)
{write ''
write $TOP
}
prefix
{write '---### ',$src
write ''
}
}
elsif $flg
write $lin
}
if hasOutput(true)
{write ''
write $TOP
}
}
call unlinkTemp('VMS')
toc '2:[[',getFile(),'][rda_report][Cluster Settings]]'
=head2 beqstatus - Bequeath Listener
Gets Bequeath listener status and process.
=cut
debug ' Inside NET module, getting Bequeath listener status and process'
report beqstatus
write '---+!!Bequeath Listener (VMS Local Connections)'
write $TOC
write '---+ Bequeath Listener Processes'
var @tbl = (getEnv('ORA_BEQ'))
prefix
write ''
var $sid = field(':',-1,getSetting('ORACLE_SID',''))
loop $lin (grepCommand('pipe show system',\
concat('ORA_(',join('|',getEnv('ORA_BEQ'),$sid),')0')))
write $lin
if hasOutput(true)
write ''
else
write '**No Bequeath Listener processes found.**%BR%'
write $TOP
write '---+ Bequeath Listener Status'
call writeCommand('beqlsnr status')
write $TOP
prefix
{write '---+ Quota Logicals in ORA_NETWORK:BEQLSNR.COM'
write ''
}
loop $lin (grepFile('ORA_NETWORK:BEQLSNR.COM','define\s+ORA_LSNR_','i'))
write $lin
if hasOutput(true)
{write ''
write $TOP
}
toc '2:[[',getFile(),'][rda_report][Bequeath Listener]]'
=head2 vmsmbx - VMS Mailboxes
Lists known TCP/IP hosts.
=cut
debug ' Inside NET module, getting VMS Mailboxes'
report vmsmbx
write '---+!! Oracle on OpenVMS Mailbox Information'
write $TOC
var $cmd = 'show logical ORA*MBX*'
write '---+ Oracle Mailbox Logicals'
write '---## Using: ',$cmd
call writeCommand($cmd)
write $TOP
var $cmd = 'show device m'
write '---+ VMS Mailboxes'
write '---## Using: ',$cmd
call writeCommand($cmd)
write $TOP
toc '2:[[',getFile(),'][rda_report][VMS Mailboxes]]'
}
#------------------------------------------------------------------------------
=head1 CONTRIBUTION TO THE DEV MODULE
Sets up the shared library path for Oracle Forms and Reports.
=cut
elsif compare('eq',$MODULE,'DEV')
{# Setup the shared library path for Forms and Reports
var (undef,\%ENV,\$PS_EF) = @arg
var $ora = getSetting('ORACLE_HOME')
var $key = getSetting('RDA_SHLIB')
if and($ora,$key)
{var $lib = getEnv($key,undef,true)
call setEnv($key,\
join(':',concat($ora,'/network/jre11/lib/alpha/native_threads'),\
$lib))
var $ENV{$key} = $lib
}
var $PS_EF = $OSP
}
#------------------------------------------------------------------------------
elsif compare('eq',$MODULE,'PS')
{# Pass the command format of the ps variants
import $PS_ARG,$PS_EF
var $PS_ARG = $OSA
var $PS_EF = $OSP
}
#------------------------------------------------------------------------------
# Return a ping command
macro ping_command
return concat('tcpip ping /number=10 /packet_size=',\
nvl($arg[1],56),' ',$arg[0])
=head1 OPERATING SYSTEM COMMANDS USED
The main operating system commands used in the data collection include the
following:
=over 16
=item o F
=item o F
=item o F
=item o F
=item o F
=item o F
=item o F
=item o F
=item o F
=back
=begin credits
=over 10
=item RDA 4.2: Satyanarayana Garaga.
=item RDA 4.6: Grant Hayden.
=back
=end credits
=head1 COPYRIGHT NOTICE
Copyright (c) 2002-2008, Oracle. All rights reserved.
=head1 TRADEMARK NOTICE
Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle
Corporation and/or its affiliates. Other names may be trademarks of their
respective owners.
=cut