2013-10-20 // Display the AIX devices in a tree format
In AIX there is the proctree
(or ps -fT 0
) command to display the currently running processes in a tree format. This is very helpful when one is primaryly interested in the parent and child relationship between the individual processes. Unfortunately a similar command for the parent and child relationship of devices is still missing from the stock AIX. There are already several script implementations out on the net to fill that particular gap. As a scripting exercise i wanted to do my own version of a devtree
command. It was included in the aaa_base RPM package. The output for e.g. an LPAR with virtual ethernet and virtual SCSI devices looks like this:
| |-- inet0 | |-- en1 | |-- et1 | |-- lo0 |-- iocp0 |-- lvdd |-- pty0 |-- rootvg | |-- hd1 | |-- hd2 | |-- hd3 | |-- hd4 | |-- hd5 | |-- hd6 | |-- hd8 | |-- hd10opt | |-- hd9var | |-- lv_srv |-- sfw0 |-- sys0 | |-- sysplanar0 | | |-- L2cache0 | | |-- mem0 | | |-- pci0 | | | |-- pci4 | | | |-- pci5 | | | |-- pci6 | | |-- pci1 | | | |-- pci7 | | | |-- pci8 | | |-- pci2 | | | |-- pci9 | | | |-- pci10 | | | |-- pci11 | | |-- pci3 | | | |-- pci12 | | | |-- pci13 | | |-- pci14 | | |-- proc0 | | |-- proc4 | | |-- vio0 | | | |-- ent1 | | | |-- vsa0 | | | | |-- vty0 | | | |-- vscsi0 | | | | |-- hdisk0 | | | |-- vscsi1 | `-- End of the device tree
in the regular mode, or like this:
| |-- inet0 Available Internet Network Extension | |-- en1 Available Standard Ethernet Network Interface | |-- et1 Defined IEEE 802.3 Ethernet Network Interface | |-- lo0 Available Loopback Network Interface |-- iocp0 Defined I/O Completion Ports |-- lvdd Available LVM Device Driver |-- pty0 Available Asynchronous Pseudo-Terminal |-- rootvg Defined Volume group | |-- hd1 Defined Logical volume | |-- hd2 Defined Logical volume | |-- hd3 Defined Logical volume | |-- hd4 Defined Logical volume | |-- hd5 Defined Logical volume | |-- hd6 Defined Logical volume | |-- hd8 Defined Logical volume | |-- hd10opt Defined Logical volume | |-- hd9var Defined Logical volume | |-- lv_srv Defined Logical volume |-- sfw0 Available Storage Framework Module |-- sys0 Available System Object | |-- sysplanar0 Available System Planar | | |-- L2cache0 Available L2 Cache | | |-- mem0 Available Memory | | |-- pci0 Defined PCI Bus | | | |-- pci4 Defined 00-10 PCI Bus | | | |-- pci5 Defined 00-12 PCI Bus | | | |-- pci6 Defined 00-16 PCI Bus | | |-- pci1 Defined PCI Bus | | | |-- pci7 Defined 02-10 PCI Bus | | | |-- pci8 Defined 02-12 PCI Bus | | |-- pci2 Defined PCI Bus | | | |-- pci9 Defined 03-10 PCI Bus | | | |-- pci10 Defined 03-12 PCI Bus | | | |-- pci11 Defined 03-16 PCI Bus | | |-- pci3 Defined PCI Bus | | | |-- pci12 Defined 01-10 PCI Bus | | | |-- pci13 Defined 01-12 PCI Bus | | |-- pci14 Defined PCI Bus | | |-- proc0 Available 00-00 Processor | | |-- proc4 Available 00-04 Processor | | |-- vio0 Available Virtual I/O Bus | | | |-- ent1 Available Virtual I/O Ethernet Adapter (l-lan) | | | |-- vsa0 Available LPAR Virtual Serial Adapter | | | | |-- vty0 Available Asynchronous Terminal | | | |-- vscsi0 Available Virtual SCSI Client Adapter | | | | |-- hdisk0 Available Virtual SCSI Disk Drive | | | |-- vscsi1 Available Virtual SCSI Client Adapter | `-- End of the device tree
in the detailed output mode.
2012-09-05 // AIX RPMs: aaa_base, logrotate and run_parts
Like announced earlier, here are the first three AIX RPM packages:
aaa_base: The AFW Package Management base package. This package installs several important configuration files, directories, programs and scripts. Currently there's only a script handling some post-LPM actions via an errnotify ODM method. More features will be added in the future.
logrotate: A slightly modified version of Michael Perzls logrotate package. The
logrotate.d
directory has been moved into/opt/freeware/etc/logrotate/
to avoid cluttering of the/opt/freeware/etc/
directory. An integration with run_parts (see below) with a daily job has been added.run_parts: Like its Linux equivalent run_parts implements a wrapper for the execution of cron jobs. Among its features are:
Sets up a useful environment for the execution of cronjobs.
Guarantees only one instance of a job is active at any time.
Is able to execute jobs in a predictable sequence one by one.
Sends mails with any output of the wrapped script to a configurable mail adress (root by default).
Provides meaningfull mail subject lines, depending on the exit code of the wrapped script.
Clearly indicates reason of exit, exit code and run time.
Upon package installation several cronjobs for hourly, daily, weekly and monthly execution are added. The exact execution times and dates are randomized within different ranges upon package installation in order to avoid a kind of Thundering herd problem that can occur in larger and time synchronized environments. The time ranges are:
Run hourly jobs at a random minute not equal to the full hour.
Run daily jobs every day between 03:01am and 05:59am.
Run weekly jobs on saturday, between 00:01am and 02:59am.
Run monthly jobs on the first day of the month, between 03:01am and 05:59am.
Jobs for hourly, daily, weekly or monthly execution can be added by placing them or symlinking them into the corresponding directories:
/opt/freeware/etc/run_parts/hourly.d/ /opt/freeware/etc/run_parts/daily.d/ /opt/freeware/etc/run_parts/weekly.d/ /opt/freeware/etc/run_parts/monthly.d/
Jobs for other execution intervals need to be sheduled individually via the usual crontab entries, but can be prefixed by the run_parts wrapper (
/opt/freeware/libexec/run_parts/run-parts
) to still gain some of the advantages listed above.