Oracle Linux 8 System Monitoring Guide
Oracle Linux 8 System Monitoring Guide
F24025-18
January 2024
Oracle Linux 8 Monitoring and Tuning the System,
F24025-18
iii
Reviewing Information Gathered by PCP 4-1
Using PCP Monitor Host to Analyze Performance Metrics 4-2
Review Live Performance Metrics in Real Time 4-2
Review Recorded Performance Metrics 4-3
Review Details About Recorded Performance Metrics 4-3
Validate System Status When Performance Metrics Were Captured 4-3
Running dstat With Performance Co-Pilot 4-4
iv
9 Working With Core Dumps
Enabling Core Dumps 9-1
Configuring Core Dumps 9-1
Analyzing Core Dumps 9-2
Exporting Core Dumps 9-2
v
Preface
Preface
Oracle Linux 9: Monitoring and Tuning the System describes the various utilities,
features, and services that you can use to monitor system performance, detect
performance issues, and improve the performance of various system components.
Documentation License
The content in this document is licensed under the Creative Commons Attribution–
Share Alike 4.0 (CC-BY-SA) license. In accordance with CC-BY-SA, if you distribute
this content or an adaptation of it, you must provide attribution to Oracle and retain the
original copyright notices.
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user
interface elements associated with an
action, or terms defined in text or the
glossary.
italic Italic type indicates book titles, emphasis,
or placeholder variables for which you
supply particular values.
monospace Monospace type indicates commands
within a paragraph, URLs, code in
examples, text that appears on the screen,
or text that you enter.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at [Link]
For information about the accessibility of the Oracle Help Center, see the Oracle
Accessibility Conformance Report at [Link]
templates/[Link].
vi
Preface
vii
1
Monitoring the System and Optimizing
Performance
Performance issues can be caused by several system components, including software or
hardware, as well as any related interactions. Many performance diagnostics utilities are
available in Oracle Linux and include tools that monitor and analyze the resource usage of
different hardware components, as well as tracing tools for diagnosing performance issues in
multiple processes and related threads.
Many performance issues are the result of configuration errors. You can avoid these errors by
using a validated configuration that has been pretested for the enabled software, hardware,
storage, drivers, and networking components. A validated configuration incorporates best
practices for an Oracle Linux deployment and has undergone real-world testing of the
complete stack. Oracle publishes many validated configurations, which are freely available
for download. Refer to the release notes for the release that you are running for additional
recommendations on kernel parameter settings.
1-1
Chapter 1
Monitoring the Usage of System Resources
Tip:
To verify if a utility is available in the system, check if the utility's package is
installed. For example, for the dmesg utility, you can type:
Installed Packages
Name : util-linux
Version : version-number
...
You can install the following additional packages to take advantage of additional
utilities.
• sysstat provides these utilities:
– iostat: Reports I/O statistics.
– mpstat: Reports processor-related statistics.
– sar: Reports information about system activity.
• iotop provides iotop that monitors disk and swap I/O on a per-process basis.
• nfs-utils provides nfsiostat that reports I/O statistics for NFS mounts
Many of these utilities provide overlapping functionality. For more information, see the
individual manual page for the utility.
For a hands-on tutorial and associated video content on many of these utilities, see
Monitor system resources on Oracle Linux.
1-2
Chapter 1
Monitoring the Usage of System Resources
That command generates a single-line output that changes information every second, for
example:
Alternatively, many of the commands enable you to specify the sampling interval in seconds,
for example:
sudo mpstat 1
The command displays the same information as the previous command, except that the
information is in a running list where a new line of information is generated every second, for
example:
To display the contents of the sar log of a specific day of the current month, type:
You can also use the sar command to create a customized log that contains a record of
specific information that you want to monitor. Use the following syntax:
In the previous command, datafile is the full path to the customized log where you want to
store the information, while count represents the number of samples to record. With this
command, the sar process runs in the background and collects the data.
1-3
Chapter 1
Monitoring CPU Usage
– mpstat -P ALL
– sar -u -P ALL
The output of these commands include data under the %idle heading, which show
the percentage of time that a CPU is not running system or process code. If the
percentage is near 0% most of the time on all CPU cores, then the system is CPU-
bound for the workload that is running.
1-4
Chapter 1
Monitoring CPU Usage
We recommend that the percentage of time to run system code, which is reported under
the %system or %sys heading, not exceed 30%, especially if %idle is close to 0%.
• Review information about system load average.
– uptime
– sar -q
The system load average consists of the combination of the number of processes that
are currently running on CPU cores, waiting to run, and waiting for disk I/O activity to
complete, all of which are then averaged over time.
The uptime command shows the information in a single line, while the sar syntax
displays the information in columns under ldavg-* headings. Additionally, the sar syntax
also shows the number of processes currently waiting to run as well as the total number
of processes, which are reported under the runq-sz and plist_sz headings.
On a busy system, we recommend that the load average typically not be greater than two
times the number of CPU cores over a period of 5 or 15 minutes. If the load average
exceeds four times the number of CPU cores for long periods, then the system is
overloaded.
For a better assessment of the system load, determine the system's average load under
normal loads where users and applications do not experience problems with system
responsiveness. Then, look for deviations from this benchmark over time. A dramatic rise
in the load average can indicate a serious performance problem.
• Review a real-time listing of CPU activity.
top
1-5
Chapter 1
Monitoring Memory Usage
By default, top lists the most CPU-intensive processes on the system. The
output's upper section displays general information including the load averages
over the past 1, 5 and 15 minutes, the number of running and sleeping processes
or tasks, and total CPU and memory usage.
The second table displays a list of processes, including the process ID number
(PID), the process owner, CPU usage, memory usage, running time, and the
command name. By default, the list is sorted by CPU usage, with the top
consumer of CPU listed first.
To stop the top process, press Ctrl-c.
All the commands can be used together to provide you a picture of the system's CPU
usage. For example, sustained large load average or large run queue size and low
%idle percentages can indicate that the system has insufficient CPU capacity for the
workload. When CPU usage is high, the top command can identify which processes
are likely responsible.
• sar -r: Reports memory usage statistics, such as free (kbmemfree), available
(kbavail), and used (kbmemused) memory. The report also include %memused, which
is the percentage of physical memory in use.
• sar -B: Reports memory paging statistics, such as page in (pgpgin/s) and page
out (pgpgout/s), page faults and major faults, and so on. The report also includes
pgscank/s, which is the number of memory pages scanned by the kswapd daemon
each second, and pgscand/s, which is the number of memory pages scanned
directly each second.
• sar -W: Reports swapping statistics, including pswpin/s and pswpout/s, which
are the numbers of pages each second swapped in and out each second.
If %memused is near 100% and the scan rate is continuously over 200 pages each
second, the system has a memory shortage.
1-6
Chapter 1
Monitoring Block I/O Usage
When a system runs out of real or physical memory and starts using swap space, system
performance deteriorates dramatically. If you run out of swap space, some programs or even
the entire OS are likely to malfunction. If the free or top commands indicate that little swap
space remains available, then the system is running low on memory.
The output from the dmesg command might include notification of any problems with physical
memory that were detected at boot time.
To see the different options that you can use with the adaptivemmd command, type:
sudo adaptivemmd -h
iostat
1-7
Chapter 1
Monitoring File System Usage
iostat -x reports extended statistics about block I/O activity at one second
intervals, including %util, which is the percentage of CPU time spent handling I/O
requests to a device, and avgqu-sz, which is the average queue length of I/O requests
that were issued to that device. If %util approaches 100% or avgqu-sz is greater than
1, device saturation is occurring.
You can also use the sar -d command to report on block I/O activity, including values
for %util and avgqu-sz.
The iotop utility can help you identify which processes are responsible for excessive
disk I/O. iotop has a similar user interface to top. In its upper section, iotop
displays the total disk input and output usage in bytes per second. In its lower section,
iotop displays I/O information for each process, including disk input output usage in
bytes per second, the percentage of time spent swapping in pages from disk or waiting
on I/O, and the command name. The following is a sample command output:
sudo iotop
Total DISK READ : 0.00 B/s | Total DISK WRITE : 0.00 B/s
Actual DISK READ: 0.00 B/s | Actual DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE>
COMMAND
1 be/4 root 0.00 B/s 0.00 B/s systemd --switched-root
--system --deserialize 16
2 be/4 root 0.00 B/s 0.00 B/s [kthreadd]
...
While you review the output, use the arrow keys to change the sort field, and press A
to switch the I/O units between bytes each second and total number of bytes, or O to
switch between displaying all processes or only those processes that are performing
I/O.
sar -v
nfsiostat reports I/O statistics for each NFS file system that is mounted. If this
command is not available install the nfs-utils package.
1-8
Chapter 1
Monitoring Network Usage
ip -s link
The ss -s command displays summary statistics for each protocol, for example:
ss -s
Total: 193
TCP: 9 (estab 2, closed 0, orphaned 0, timewait 0)
gnome-system-monitor
1-9
Chapter 1
Using the Graphical System Monitor
To display the System Monitor Manual, press F1 or select Help, then select Contents.
1-10
2
Working With the sos Command
The sos command collects information about a system such as hardware configuration,
software configuration, and operational state. You can also use the sos report command
to enable diagnostics and analytical functions on the current system.
The generated report is useful in cases where you are being assisted by Oracle support in
troubleshooting a problem in the system. The support representative can use the report to
obtain an accurate picture of the system, its resources, all the applications and processes
that exist in the system, and all other data that can help determine the causes of the issues
you are encountering.
The sos utility requires the installation of the sos package. To install the package, type:
sos report -h
optional arguments:
-h, --help show this help message and exit
Global Options:
--batch Do not prompt interactively
--config-file CONFIG_FILE
specify alternate configuration file
...
2-1
Chapter 2
Running the sos Command
Every time you issue the sos utility, the utility always prompts you whether to continue
or to quit. If you press Enter to continue, you can use an optional prompt to specify a
case ID for the report.
Optionally, please enter the case id that you are generating this
report for []:
If you are generating the report as related to a specific troubleshooting case, you can
enter the case ID at this prompt.
After you have provided information as prompted, the command proceeds to generate
the report, which can take a considerable time to complete. At the end of the process,
the screen displays a message similar to the following:
Size 20.62MiB
Owner root
sha256
428f7b4118acd2d349bb022946877d853aa0eefbb4d340af3839810dc634b8b7
Important:
As previously indicated, the report can be useful in cases where you engage
Oracle support to diagnose and troubleshoot issues that you have observed
in the system. However, the report contains sensitive information specific to
your company. Ensure that you review the contents of the report and identify
sensitive information before sending the report to any third-party.
2-2
Chapter 2
Running the sos Command
To use the sos clean utility on a generated report, type the following command and follow
the prompts that are displayed:
...
Users should review any resulting data and/or archives generated or
processed by
this utility for remaining sensitive content before being passed to a third
party.
At the end of the process, the screen displays a message similar to the following:
Size 3.62MiB
Owner root
Please send the obfuscated archive to your support representative and keep
the mapping file private
The resulting report that has been scrubbed of sensitive information is also stored in /var/
tmp. However, the file name itself is revised. The hostname is generic, and importantly,
obfuscated is added to the file name so you can readily identify the clean version of the
report.
Caution:
Consider the following about the sos clean utility:
2-3
Chapter 2
Reviewing Information Gathered by sosreport
To automatically clean any sos report that you create, use the following command
syntax when generating a report:
For more information, see the sos-report(1) and sos-clean(1) manual pages. See
also [Link]
The plugins that are displayed by the command are grouped according to the following
sections:
• All enabled plugins
• All disabled plugins
• Available options for all of the plugins
• Available plugin options
See the sos-report(1) manual page for information about how to enable or disable
plugins and how to set values for plugin options.
You can also obtain only information specific to a problem area and specify options to
tailor the report that is generated. For example, to record only information about
Apache and Tomcat and to gather all of the Apache logs, type:
To enable all of the Boolean options for all of the loaded plugins (excluding the
[Link] plugin) and verify all packages:
For more information, see the sos-report(1) and sos-clean(1) manual pages. See
also [Link]
2-4
Chapter 2
Reviewing Information Gathered by sosreport
Note:
The module information that is provided in this table relates to sos 3.9. To verify the
modules you have installed, run the sos report command. The output includes
the version of the sos utility that you are currently running.
Disabling modules prevents the sos command from collecting certain details that
might be needed for advanced troubleshooting, such as networking information.
2-5
Chapter 2
Reviewing Information Gathered by sosreport
2-6
Chapter 2
Reviewing Information Gathered by sosreport
2-7
Chapter 2
Reviewing Information Gathered by sosreport
2-8
Chapter 2
Reviewing Information Gathered by sosreport
2-9
Chapter 2
Reviewing Information Gathered by sosreport
2-10
3
Working With OSWatcher Black Box
Oracle OSWatcher Black Box (OSWbb) collects and archives OS and network metrics that
you can use to diagnose performance issues. OSWbb operates as a set of background
processes on the server and gathers data on a regular basis, invoking such UNIX utilities as
vmstat, mpstat, netstat, iostat, and top.
OSWbb is particularly useful for Oracle RAC (Real Application Clusters) and Oracle Grid
Infrastructure configurations. The RAC-DDT (Diagnostic Data Tool) script file includes
OSWbb, but does not install it by default.
Installing OSWbb
To install OSWbb:
1. Sign in to My Oracle Support (MOS) at [Link]
2. Download OSWatcher from the link that is listed by Doc ID 301137.1 at https://
[Link]/epmos/faces/DocumentDisplay?id=301137.1.
3. Copy the file to the directory that you want to install OSWbb, then run the following
command:
In the previous command, VERS represents the version number of OSWatcher, for
example 832 for OSWatcher 8.32.
Extracting the tar file creates a directory named oswbb, which contains all the directories
and files that are associated with OSWbb, including the [Link] script.
4. To enable the collection of iostat information for NFS volumes, edit the
[Link] script in the oswbb directory, and set the value of nfs_collect to 1 as
follows:
nfs_collect=1
Running OSWbb
To start OSWbb, run the [Link] script from the oswbb directory.
The optional frequency and duration arguments specify how often in seconds OSWbb
collects data and the number of hours for which OSWbb runs. The default values are 30
3-1
Chapter 3
Running OSWbb
seconds and 48 hours. The following example starts OSWbb recording data at
intervals of 60 seconds, and has it record data for 12 hours:
sudo ./[Link] 60 12
...
Testing for discovery of OS Utilities...
VMSTAT found on your system.
IOSTAT found on your system.
MPSTAT found on your system.
IFCONFIG found on your system.
NETSTAT found on your system.
TOP found on your system.
Discovery completed.
In the previous output, OSWbba_archive is the path of the archive directory that
contains the OSWbb log files.
To stop OSWbb prematurely, run the [Link] script from the oswbb directory:
sudo ./[Link]
OSWbb collects data in the directories that are under the oswbb/archive directory,
which are described in the following table.
Directory Description
oswifconfig Contains output from ifconfig.
oswiostat Contains output from iostat.
oswmeminfo Contains a listing of the contents of /
proc/meminfo.
3-2
Chapter 3
Analyzing OSWbb Archived Files
Directory Description
oswmpstat Contains output from mpstat.
oswnetstat Contains output from netstat.
oswprvtnet If you have enable private network tracing
for RAC, contains information about the
status of the private networks.
oswps Contains output from ps.
oswslabinfo Contains a listing of the contents of /
proc/slabinfo.
oswtop Contains output from top.
oswvmstat Contains output from vmstat.
In the previous command, OSWbba_archive is the path of the archive directory that contains
the OSWbb log files.
You can use OSWbba to display the following types of performance graph:
• Process run, wait and block queues.
• CPU time spent running in system, user, and idle mode.
• Context switches and interrupts.
• Free memory and available swap.
• Reads each second, writes each second, service time for I/O requests, and percentage
usage of bandwidth for a specified block device.
3-3
Chapter 3
Analyzing OSWbb Archived Files
You can also use OSWbba to save the analysis to a report file, which reports instances
of system slowdown, spikes in run queue length, or memory shortage, describes
probable causes, and offers suggestions of how to improve performance.
For more information about OSWbb and OSWbba, refer to the OSWatcher Black Box
User Guide (Article ID 301137.1) and the OSWatcher Black Box Analyzer User Guide
(Article ID 461053.1) on My Oracle Support (MOS) at [Link]
3-4
4
Working With Performance Co-Pilot
Performance Co-Pilot (PCP) collects OS and network metrics that you can use to diagnose
performance issues. PCP provides a monitor host that you can use to send requests for
metrics and logs to a pair of collector host services that are installed on each Oracle Linux
system that you monitor.
Installing PCP
1. Enable the ol8_appstream and ol8_addons yum repositories on the system.
For more information, see Oracle Linux: Managing Software on Oracle Linux.
2. Install the pcp-oracle-conf, pcp, pcp-system-tools, and pcp-gui packages by using the
dnf command:
3. Enable and start the Performance Metrics Collector Daemon (pmcd) and Performance
Metrics Logger (pmlogger) collector host services:
Stopping PCP
To temporarily halt data collection, stop the Performance Metrics Collector Daemon (pmcd)
and Performance Metrics Logger (pmlogger) collector host services:
To halt data collection for an indefinite period and ensure that that they don't start again
automatically when the system boots, fully disable them:
For more information about masking and unmasking services to prevent scripts from
restarting disabled system services, see Oracle Linux 8: Managing Core System
Configuration.
4-1
Chapter 4
Using PCP Monitor Host to Analyze Performance Metrics
...
# It is safe to make additions from here on ...
#
All of the archives that the pmlogger service generates are stored in
the /var/log/pcp/pmlogger/hostname directory. For more information, see the
pmlogconf(1) manual page.
To verify the PCP configuration at the time that pmlogger collected specific
performance metrics, use the pcp command:
To monitor live hard drive operations for each partition with a two second interval, use
the pmval command:
4-2
Chapter 4
Using PCP Monitor Host to Analyze Performance Metrics
The pmstat command can provide system performance metrics in a format similar to that
produced by the sar command. For example, to review performance metrics averaged over
10 minute interval between 09:00 and 10:00 on a specific date:
To compare the metrics between two time periods, use the pmdiff command. For example, to
compare the metrics between 02:00 and 03:00 on one day to the metrics between 09:00 and
10:00 on a different day:
To review a list of every enabled performance metric, use the pminfo command:
4-3
Chapter 4
Running dstat With Performance Co-Pilot
pcp dstat -h
Dstat options:
-c, --cpu enable cpu stats
-C 0,3,total include cpu0, cpu3 and total
-d, --disk enable disk stats
-D total,sda include sda and total
...
By default, running the command without any other options shows you statistics about
CPU, disk, network, page, and system use.
pcp dstat
As with the previous iteration of the tool, pcp dstat generates a running list of metrics
or statistics in real time. To stop the process, type Ctrl-c.
You can narrow the information output by using different options that are available for
the command. For example, to display the statistics only of CPU 1, you would type:
-----cpu1-usage---------total-usage----
usr sys idl wai stl:usr sys idl wai stl
0 0 100 0 0: 0 0 100 0 0
1 0 100 0 0: 0 0 99 0 0
4-4
Chapter 4
Running dstat With Performance Co-Pilot
0 0 100 0 0: 0 0 100 0 0
...
Similarly, to display only network statistics of a specific interface, such as ens3, and including
totals, you would type:
--net/ens3---net/total-
recv send: recv send
66B 350B: 66B 350B
66B 190B: 66B 190B
66B 198B: 66B 198B
66B 198B: 66B 198B
...
To store any statistics that are being gathered into a file for later review, include the -o
outputfile option in the command.
For example, to collect network statistics and save the information in a log, type:
--net/ens3-----net/lo--
recv send: recv send
66B 358B: 0 0
66B 174B: 0 0
66B 190B: 0 0
341B 419B: 0 0
66B 190B: 0 0
66B 190B: 0 0
66B 190B: 0 0 ^C
cat /tmp/netstat-log
...
"Host:","hostname",,,,"User:","user"
"Cmdline:","pcp-dstat -n -f -o /tmp/netstat-log",,,,"Date:","date"
"net/ens3",,"net/lo",
"net/ens3:recv","net/ens3:send","net/lo:recv","net/lo:send"
65.934,357.641,0,0
66.000,173.999,0,0
66.000,190.001,0,0
340.992,418.991,0,0
66.001,190.004,0,0
4-5
Chapter 4
Running dstat With Performance Co-Pilot
66,190,0,0
66.000,189.999,0,0
For more information about pcp dstat, see the pdp-dstat(1) manual page.
4-6
5
Working With TuneD
The TuneD utility is a tool for monitoring a system so you can optimize its performance under
certain conditions. The utility consists of the following main components:
• TuneD profiles
• The tune-adm command
The basic TuneD feature is provided by the tuned package. Depending on where Oracle
Linux is running, this package might be automatically installed with the OS, such as on an
Oracle Linux instance on Oracle Cloud Infrastructure.
To verify whether TuneD is already in the system, type:
Installed Packages
[Link] version
...
To list other TuneD packages that are available but not installed in the system, type:
If you require other TuneD packages, you would need to install these separately.
tuned-adm list
5-1
Chapter 5
About TuneD Profiles
The output of this command depends on where Oracle Linux is running. On physical
and virtual systems, the available profiles might resemble the following:
Available profiles:
- accelerator-performance - Throughput performance based tuning
with disabled higher latency STOP states
- balanced - General non-specialized tuned profile
- desktop - Optimize for the desktop use-case
- hpc-compute - Optimize for HPC compute workloads
...
On an Oracle Linux instance that is running in Oracle Cloud Infrastructure, the list
would include additional profiles:
...
- oci-busy-polling - Enable Busy Polling conditionally in
OCI
- oci-cpu-power - Set processor power management
parameters in OCI
- oci-nic - Increase combined channels to 16 on
NICs with bnxt_en driver on BM shapes in OCI
- oci-rps-xps - Enable RPS/XPS conditionally in OCI
...
The following are selected profiles that TuneD uses to optimize the system. The list is
not exhaustive.
• balanced: Provides a balance between performance and power consumption. The
profile uses automatic scaling and automatic tuning when possible. A possible
drawback is increased latency.
• powersave: Provides maximum power saving performance. The profile can
minimize actual power consumption by throttling performance.
Note:
In some instances, the balanced profile is more efficient than the
powersave profile and therefore, a better choice.
5-2
Chapter 5
About Configuration Files for TuneD Profiles
Profiles operate by using optimization rules that have been set for the profiles. Each profile's
rules are contained in a corresponding [Link] file. Thus, for the desktop profile, the
rules are defined in /usr/lib/tuned/desktop/[Link], while the rules for the
powersave profile are defined in /usr/lib/tuned/powersave/[Link].
As an example, the following shows the contents of the configuration file for the desktop
profile:
less /usr/lib/tuned/desktop/[Link]
#
# tuned configuration
#
[main]
summary=Optimize for the desktop use-case
include=balanced
[sysctl]
kernel.sched_autogroup_enabled=1
In these configuration files, you can modify the rules for that profile or customize how profiles
optimize specific devices. In addition, you can configure TuneD so that any changes in device
usage triggers an adjustment in the current settings. By adjusting the configuration file
definitions, you can customize and improve optimization in your specific systems.
5-3
Chapter 5
Using the tuned-adm Command
For more information about profile configuration, see the [Link](5) manual page.
The number of profiles that is displayed depends on whether you are using an Oracle
Linux system or an Oracle Linux instance in Oracle Cloud Infrastructure.
The output always ends by displaying the profile that is currently in use. On an Oracle
Linux instance in Oracle Cloud Infrastructure, for example, the final line would be
similar to the following:
...
Current active profile: oci-rps-xps oci-busy-polling oci-cpu-power oci-
nic
On a physical system or a virtual machine, the default active profile might be different.
To directly query which profile is active in the system or instance without listing all
available profiles, type:
5-4
Chapter 5
Using the tuned-adm Command
2. Optionally, examine the contents of the TuneD log for more detailed information.
less /var/log/tuned/[Link]
balanced
balanced
powersave
5-5
Chapter 5
Using the tuned-adm Command
Caution:
TuneD might activate multiple profiles. Where profile rules conflict, TuneD
applies the settings of the last profile that you specified in the command.
When profiles are merged, TuneD can't determine whether the combination
is logical or not. Consequently, parameters in those profiles that are related
to the performance of a common component or resource risk being tuned in
opposite ways. Merging profiles does not always guarantee that better
optimization is obtained.
Oracle Linux instances on Oracle Cloud Infrastructure are an exception,
where multiple oci-* profiles are automatically activated when TuneD is
installed.
Disabling TuneD
To disable TuneD temporarily, switch the TuneD service off. Switching the service off
removes active profiles and effectively stops all tuning operations in the system. To
resume tuning, activate a profile. The following steps illustrate how to halt system
tuning.
1. Optionally, note down the current active profile.
• To select a profile other than the default profile, display the available profiles.
Type:
• To reuse the same profile that was active before TuneD was switched off,
consult notes you have taken based on the previous steps to switch off the
TuneD service.
5-6
Chapter 5
Applying Global Settings to the TuneD Utility
The following are sample cases for which you can configure parameters in /etc/tuned/
[Link]:
5-7
Chapter 5
Applying Global Settings to the TuneD Utility
5-8
6
Automating System Tasks
You can automate tasks to perform periodic backups, monitor the system, run custom scripts,
as well as other administrative tasks. In Oracle Linux, the two utilities that are used for job
scheduling are cron and anacron. Both tools enable you to automate the running of tasks,
also referred to as jobs, but slightly differ in how the tasks are run. Both utilities automatically
run through their respective daemons, and so, you do not need to run these utilities manually.
You can also use systemd timer unit files for scheduling tasks. All of the utilities described in
this document for task automation can work in combination.
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
6-1
Chapter 6
Working With cron
Job definitions consist of information that you specify in the appropriate fields as
follows:
minute
Specify a value of 0-59.
hour
Specify a value of 0-23.
day
Specify a value of 1-31.
month
Specify a value of 1-12 or jan, feb,..., dec.
day-of-week
Specify a value of 0-7 (Sunday is 0 or 7) or sun, mon,...,sat.
user
Specify the user running the command; or, you can specify an asterisk (*), which
indicates the owner of the crontab file.
command
Specify the shell script or command to be run.
For the minute through day-of week fields, you can use the following special
characters:
*
Specify an asterisk (*) for all of the valid values for the field.
-
Specify a dash (-) to indicate a range of integers, for example, 1-5.
,
Specify a list of values, separated by commands (,), for example, 0,2,4.
/
Specify a step value by using the slash (/), for example, /3 in the hour field. This
entry is interpreted as every three hours.
For example, the following entry would run a command every five minutes on
weekdays:
Run a command at one minute past midnight on the first day of the months April, June,
September, and November:
1 0 1 4,6,9,11 * * command
6-2
Chapter 6
Working With cron
Note:
If you add an executable job script to the /etc/[Link] directory, crond
runs the script every hour.
crontab -e
If you want to use a specific text editor to create or edit a cron job, use the following
syntax:
3. When the editor opens, create the cron job by using the format as described in About the
cron Table Fields.
Suppose that you want to define a backup job that you want to run every 15 minutes.
Further, you created a script [Link] for this task in the user home directory. You
would then create the schedule as follows:
15 * * * * /home/jsmith/[Link]
6-3
Chapter 6
Configuring anacron Jobs
crontab -l
15 * * * * /home/jsmith/[Link]
crontab -r
If none of these two files exists, then only root can run cron jobs.
If a scheduled job has not been run because of system downtime, then that job runs
when the system restarts.
6-4
Chapter 6
Configuring anacron Jobs
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22
The top of the file contains definitions for the SHELL, PATH, MAILTO, RANDOM_DELAY, and
START_HOURS_RANGE variables for the environment in which the jobs run, followed by the job
definitions themselves. Comment lines start with a # character.
RANDOM_DELAY is the maximum number of random time in minutes that anacron adds to the
delay parameter for a job. The default minimum delay is 6 minutes. The random offset is
intended to prevent anacron overloading the system with too many jobs at the same time.
START_HOURS_RANGE is the time range of hours during the day when anacron can run
scheduled jobs.
The bottom part of the file contains job definitions. Each job consists of entries that are
spread across 4 columns under the following headings:
period
Frequency of job execution specified in days or as @daily, @weekly, or @monthly for daily,
weekly, or monthly.
delay
Number of minutes to wait before running a job.
job-id
Unique name for the job in log files.
command
The shell script or command to be run.
By default, anacron runs jobs between 03:00 and 22:00 and randomly delays jobs by
between 11 and 50 minutes. The job scripts in /etc/[Link] run between 03:11 and
03:50 every day if the system is running, or after the system is booted and the time is earlier
than 22:00. The run-parts script sequentially runs every program within the directory
specified as its argument.
Scripts in /etc/[Link] run weekly with a delay offset of between 31 and 70 minutes.
6-5
Chapter 6
Running One-Time Tasks
For more information, see the anacron(8) and anacrontab(5) manual pages.
This section describes the use of the at and batch commands for this purpose. Before
you can use these commands, ensure that the at service is running.
• To schedule a task to run one time only at a specified tine, use the at command.
Suppose that you have defined a job in ~/atjob. To schedule that job in 20
minutes time, you would type:
• To schedule a batch job to run when the system load average is light, use the
batch command.
Suppose that you have defined a batch job in ~/batchjob. To schedule this job to
run provided that the system load average is less than 0.8, you would type:
Note:
The system load average threshold under which you can schedule user-
defined batch jobs to run is 0.8, by default. However, that value can vary.
See Changing the Behavior of Batch Jobs.
• To list all the scheduled one-time jobs that are in queue, type:
sudo atq
• To cancel one or more queued jobs, specify their job numbers to the atrm
command, for example:
sudo atrm 2
6-6
Chapter 6
Changing the Behavior of Batch Jobs
If you know that a batch job typically takes more than a minute to run, you can also change
the minimum interval that atd waits between starting batch jobs. The default minimum interval
is 60 seconds.
For more information about monitoring CPU usage and to display the system load average,
see Monitoring CPU Usage.
To change the load-average limit and minimum interval time for batch jobs:
1. Open the /etc/sysconfig/atd configuration file with a text editor.
2. Uncomment the line that defines the OPTS variable.
3. Provide new values for the load average limit and the minimum interval time to the OPTS
variable, for example:
This example sets the minimum interval to 100 seconds and the load-average limit to 3.
4. Restart the atd service:
5. Verify that the atd daemon is running with the new minimum interval and load-average
limit, for example:
For more information, see the systemctl(1) and atd(8) manual pages.
6-7
Chapter 6
Working With Systemd Timers
Note:
The list of timer files might differ depending on where Oracle Linux is
running, such as in an instance in Oracle Cloud Infrastructure, a physical
system, and so on.
Each timer unit file contains parameter settings that manage the schedule of a task.
For example, the schedule for running [Link] is set in the dnf-
[Link] file. The file contains the following settings:
# /usr/lib/systemd/system/[Link]
[Unit]
Description=dnf makecache --timer
ConditionKernelCommandLine=![Link]
# See comment in [Link]
ConditionPathExists=!/run/ostree-booted
Wants=[Link]
[Timer]
OnBootSec=10min
OnUnitInactiveSec=1h
RandomizedDelaySec=60m
Unit=[Link]
[Install]
WantedBy=[Link]
The schedule information is specified under the [Timer] section. In the sample
configuration, the [Link] service is set to automatically run 10
minutes after the system is booted. The service then goes into idle mode for an hour,
as specified by the OnUnitInactiveSec parameter. At the end of the hour, the service
runs again. This cycle continues every hour indefinitely.
6-8
Chapter 6
Working With Systemd Timers
The RandomizedDelaySec setting provides a value limit for how much a run can be delayed
beyond its schedule. In the example, the service is permitted to run one minute later than its
schedule at the very latest. This parameter is useful for preventing too many jobs that start at
the same time on a specified schedule, which would otherwise risk overloading the
resources.
OnCalendar is another useful parameter for task scheduling. Suppose that the parameter is
set as follows:
OnCalendar=*:00/10
The *:00 indicates every hour at the top of the hour, while the /10 setting indicates 10
minutes. Therefore, the job is set to run hourly, at ten minutes past the top of the hour.
For a complete list of systemd timer unit file parameters for scheduling a job, see the
[Link](5) manual pages.
For a tutorial on how to use systemd in Oracle Linux, including how to configure systemd
timer unit files, see Use systemd on Oracle Linux.
6-9
7
Configuring and Using Auditing
Auditing collects data at the kernel level that you can then analyze to identify unauthorized
activity. Auditing collects data in greater detail than system logging does. The process of
examining audit trails to locate events of interest can be significantly challenging. Therefore,
consider automating this process.
Some of the definitions in the audit configuration file, /etc/audit/[Link], include
the following:
• Data retention policy
• Maximum size of the audit volume
• Action to take if the capacity of the audit volume is exceeded
• Locations of local and remote audit trail volumes
The default audit trail volume is /var/log/audit/[Link]. See the [Link](5)
manual page for more information.
By default, auditing captures specific events such as system logins, modifications to
accounts, and sudo actions. You can configure auditing to capture detailed system call
activity or modifications to certain files. The kernel audit daemon (auditd) records the events
that you configure, including the event type, a timestamp, the associated user ID, and
success or failure of the system call.
The entries in the audit rules file, /etc/audit/[Link], determine which events are
audited. Each rule is a command line option that is passed to the auditctl command.
Configure this file to match organization's security policy.
The following are examples of rules that you might set in the /etc/audit/[Link]
file:
• Record all unsuccessful exits from open and truncate system calls for files and store the
information in the /etc directory hierarchy.
• Record all files that have been revised or whose attributes were changed by any user
who originally signed in with a UID of 500 or greater.
• Record requests for write or for file attribute change access. Store the records in
the /etc/sudoers file and tag such a record with the string sudoers-change.
-w /etc/sudoers -p wa -k sudoers-change
7-1
Chapter 7
Working With System Log files
• Record requests for write and for file attribute change access and store records in
the /etc directory hierarchy.
-w /etc/ -p wa
-e 2
Note:
We recommend that you define rules to reboot at the end of the /etc/
audit/[Link] file.
For more examples of audit rules, see also the auditctl(8) and [Link](7)
manual pages.
Stringent auditing requirements generate large amounts of audit data and can impose
a significant performance overhead. Some site security policies stipulate that a system
must shut down if events can't be recorded because the audit volumes have exceeded
their capacity. Generally, we recommend that you direct audit data to separate file
systems in rotation to prevent overspill and to facilitate backups.
If you tag audit records, then searching an audit volume with the ausearch command
becomes easier by referring to those tags. For example, to examine records that are
tagged with the string sudoers-change, you would type:
The aureport command generates summaries of audit data. For example, the
following command generates a report that shows every sign-in event from 1 second
after midnight on the previous day until the current time:
You can set up cron jobs or systemd timers that run aureport periodically to
generate reports of interest. See Use the Crontab Utility to Schedule Tasks on Oracle
Linux and Use systemd on Oracle Linux.
See the ausearch(8) and aureport(8) manual pages for more information.
For a hands-on tutorial on using the auditing tools on Oracle Linux, see Audit Oracle
Linux with Auditd.
7-2
Chapter 7
Working With System Log files
Files in /run are volatile. Thus, the log data is lost after a reboot unless you create the
directory /var/log/journal. You can use the journalctl command to query the journal
logs.
For more information, see the journalctl(1) and [Link](8) manual
pages.
For a hands-on tutorial introducing system logging tools, see System Logging on Oracle
Linux.
Important:
The format to configure parameters in /etc/[Link] has changed. The
following formats are supported which enables backward compatibility with previous
configuration:
• Basic or sysklogd format, which has been used since the beginning of system
logging.
• Legacy format, where directives are defined on their own specific lines in the
file, with each directive being preceded by the dollar ($) sign, such
as $MainMsgQueueSize.
• Advanced format, which uses the RainerScript scripting language for
configuring rsyslog.
For more information about these formats, see the relevant sections in https://
[Link]/doc/.
Modules
Modules contain configuration parameters for processing messages. The processed or
transformed messages can then be transmitted to various targets as required. Modules are
classified into different categories, such as output, input, parser, library, and so on. For a
complete list of these module classes, see the appropriate section in https://
[Link]/doc/. For a list of the modules, see the [Link](5) manual page.
7-3
Chapter 7
Working With System Log files
module(load="module-name")
Note:
The directive uses the advanced format for loading a module and replaces
the $ModLoad module-name legacy format.
Global directives
Global directives specify configuration options that apply to the rsyslogd daemon. A
directive might specify the location of auxiliary files. A directive can also be a
module(load" ") statement that applies global settings, such as the timestamp
format to use for all messages, as shown in the following example:
module(load="builtin:omfile" Template=RSYSLOG_TraditionalFileFormat")
Because the module applies to all messages, the directive is specified under the
Global Directives section.
Rules
Rules or rule sets determine how logged messages are managed.
A rule consists of two fields: a selector field and an action field. The two fields are
separated by one more spaces or tabs.
• The selector field has two parts, separated by a period: a facility keyword and a
priority keyword. Facility keywords include auth, authpriv, cron, daemon, kern,
and so on. Priority keywords include debug, info, notice, warning, and so on.
Thus, kern.* selects kernel messages of all priority levels, while [Link]
selects emergency kernel messages only.
For a list of both facility and priority selectors, see the [Link](5) manual
page.
• The action field typically indicates to which log file the message content is written.
For example, the following rule indicates that cron messages are to be logged
in /var/log/cron:
cron.* /var/log/cron
7-4
Chapter 7
Working With System Log files
Some changes are simple to implement on the /etc/[Link] file, such as changing
the log for a specific selector. For example, to change the log for cron messages to cron_new,
you would enter the following:
cron.* /var/log/cron_new
You then restart the rsyslog service for the change to take effect.
*.* action(type="omfwd"
[Link]="fwdRule1"
[Link]="1g"
[Link]="on"
[Link]="linkedlist"
[Link]="-1"
target="[Link]" port="30514" protocol="tcp"
)
[Link]
Prefix to be attached to the backup files. The prefixed backup files are created in the
location as specified by the workDir global directive, for example,
global(workDirectory="/var/log").
[Link]
Space limit for log files.
[Link]
Saves data in memory if rsyslog shuts down.
[Link]
Enables a LinkedList in-memory queue.
[Link]
A setting of -1 means to retry indefinitely if the host is unavailable.
target
Can be a host name or an IP address.
Based on the sample configuration, rsyslog forwards messages to the remote server
[Link]. The rsyslog service also keeps the message in memory in case the
remote server is unavailable. If rsyslog shuts down or has exhausted allotted memory,
then rsyslog creates files on disk with the appropriate prefix to the file names.
2. Open the /etc/[Link] and verify the following:
7-5
Chapter 7
Working With System Log files
• Ensure that the module for TCP syslog reception is loaded. Verify that the
comment marks are removed from the following lines:
module(load="imtcp")
input(type="imtcp" port="514")
include(file="/etc/rsyslog.d/*.conf" mode="optional")
To manage the rotation and archival of the correct logs, edit /etc/logrotate.d/
syslog so that it references each of the log files that are defined in the RULES section
of /etc/[Link]. You can configure how often the logs are rotated and how
many past copies of the logs are archived by editing /etc/[Link].
Configuring Logwatch
Logwatch is a monitoring system that you can configure to report on areas of interest
in the system logs. After you install the logwatch package, the /etc/[Link]/
0logwatch script runs every night and sends an email report to root. You can set
local configuration options in /etc/logwatch/conf/[Link] that override
the main configuration file /usr/share/logwatch/[Link]/
[Link], including the following:
• Log files to monitor, including log files that are stored for other hosts.
• Names of services to monitor, or to be excluded from monitoring.
• Level of detail to report.
• User to be sent an emailed report.
As best practice, configure Logwatch on your log server to monitor the logs for
suspicious messages, and disable Logwatch on log clients. However, if you do use
Logwatch, disable high precision timestamps by adding the following entry to the
GLOBAL DIRECTIVES section of /etc/[Link] on each system:
module(load="builtin:omfile" Template=RSYSLOG_TraditionalFileFormat")
You can also run logwatch directly from the command line.
7-6
Chapter 7
Using Process Accounting
ac
Displays connection times in hours for a user as recorded in the wtmp file (by
default, /var/log/wtmp).
accton
Turns on process accounting to the specified file. If you do not specify a file name argument,
process accounting is stopped. The default system accounting file is /var/account/
pacct.
lastcomm
Displays information about previously rund commands as recorded in the system accounting
file.
sa
Summarizes information about previously rund commands as recorded in the system
accounting file.
Note:
As for any logging activity, ensure that the file system has enough space to store
the system accounting and wtmp files. Monitor the size of the files and truncate them
as needed.
For more information, see the ac(1), accton(8), lastcomm(1), and sa(8) manual pages.
7-7
8
Working With Kernel Dumps
The Kdump feature provides a kernel crash information dumping mechanism in Oracle Linux.
The kdump service saves the contents of the system’s memory for later analysis. The second
kernel resides in a reserved part of the system memory.
Kdump uses the kexec system call to boot into the second kernel, called a capture kernel,
without the need to reboot the system, and then captures the contents of the stopped kernel’s
memory as a crash dump (vmcore) and saves it. The vmcore crash dump can help with
determining the cause of the malfunction.
Enabling the Kdump feature is highly recommended because a crash dump might be the only
information source that is available if a system failure occurs. Kdump is vital in many mission-
critical environments.
Before enabling Kdump, ensure that the system meets all of the memory requirements for
using Kdump. To capture a kernel crash dump and save it for further analysis, reserve part of
the system's memory permanently for that purpose. When you do so, that part of the
system's memory is no longer be available to the main kernel.
The following table lists the minimum amount of reserved memory that is required to use
Kdump, based on the system's architecture and the amount of available memory.
For information about configuring Kdump by using the Cockpit web console, see Oracle
Linux: Using the Cockpit Web Console
Note:
Kdump can also be used for troubleshooting in a cluster setup that uses the OCFS2
file system. For more information, see Configuring the Behavior of Fenced Nodes
With Kdump in Oracle Linux 8: Managing Shared File Systems.
Installing Kdump
During an Oracle Linux interactive installation with the graphical installer, you have the option
to enable Kdump and specify how much system memory is reserved for Kdump. The installer
8-1
Chapter 8
Configuring Kdump
screen is titled Kdump and is available from the main Installation Summary screen of
the installer.
If you don't enable Kdump at installation time, or it is not enabled by default during an
installation, as in the case of a custom kickstart installation, you can install and enable
the feature by using the command line.
Before you install and configure Kdump by using the command line, ensure that the
system meets all of the necessary memory specifications. For details, see Table 8-1.
1. Install the kdump package:
2. With the proper administrative privileges, edit the /etc/default/grub file and
set the crashkernel= option to the required value.
For example, you would reserve 64 MB of memory as follows:
crashkernel=64M
You can also set the amount of reserved memory as a variable by using the
following syntax: crashkernel=range1:size1,range2:size2.
For example, you might set the memory as a variable as follows:
crashkernel=512M-2G:64M,2G-:128M
crashkernel=128M@16M
Configuring Kdump
When you install and configure Kdump, the following files are modified:
8-2
Chapter 8
Configuring Kdump
default dump_to_rootfs
The dump_to_rootfs option attempts to save the result to a local directory, which can be
particularly useful if a network share is unreachable. You can use shell instead to copy the
data manually from the command line.
Note:
The poweroff, restart, and haltoptions are also valid for the default kdump failure
state. However, performing these actions causes you to lose the collected data if
those actions are performed.
To save the result to other locations, such as NFS mounts, externally mounted drives, and
remote file servers, edit the /etc/[Link] file and remove the # comment character at
the beginning of each line that you want to enable.
For example, to add a new directory location, prefix it with the path keyword:
path /usr/local/cores
Use raw to output directly to a specific device in the /dev directory. You can also manually
specify the output file system for a particular device by using its label, name or UUID, for
example:
ext4 UUID=5b065be6-9ce0-4154-8bf3-b7c4c7dc7365
8-3
Chapter 8
Analyzing Kdump Output
Kdump files can also be transferred over a secure shell connection, as shown in the
following example:
ssh user@[Link]
sshkey /root/.ssh/mykey
You can also set the Kdump files to be exported to a compatible network share:
nfs [Link]:/output
When you have finished configuring the output location for Kdump, enable the kdump
service.
uname -r
4.18.0-80.el8.x86_64
3. Provide the location of the kernel debuginfo module and the location of the core
dump as parameters to the crash utility, for example:
8-4
Chapter 8
Using Early Kdump
Alternatively, you can use drgn to analyze core dumps. For more information, see Working
With the drgn Kernel Debugging Utility.
Because the kdump service starts too late, early malfunctions don't trigger the kdump kernel to
boot, which prevents the capture of diagnostic information. To address that problem, you can
enable early Kdump by adding a dracut module so that the crash kernel and initramfs are
loaded as early as possible.
Note:
The following limitations apply for early Kdump:
• The feature does not support Fadump.
• Early Kdump becomes active the moment the system's initramfs begins to be
processed. Any malfunction that occurs before that moment isn't captured even
if early Kdump is enabled.
For more information about configuring early Kdump, see the step-by-step instructions in
the /usr/share/doc/kexec-tools/[Link] file.
8-5
9
Working With Core Dumps
Core dumps contain crash information for userspace applications and services running on
Oracle Linux. They can be generated on demand by using a debugger, or the systemd-
coredump service can be configured to generate them automatically in the event of a process
stopping prematurely.
Core dumps contain a log summary of the crash event that typically includes the process ID,
owner, termination signal, and a stack trace. For more information, see the systemd-
coredump(8) manual pages.
The coredumpctl command can be used to review core dumps that have been written to the
system journal or saved as a file. For more information, see the coredumpctl(1) manual
pages.
To learn more about Systemd, the daemon that initializes the system and manages running
services in Oracle Linux, see Oracle Linux 8: Managing Core System Configuration.
DumpCore=yes
DefaultLimitCORE=infinity
2. Restart the systemd daemon to apply the change without restarting Oracle Linux:
Before running the coredumpctl command, remove any core dump size limits that apply to
the current shell session:
For more information about the ulimit command, see the ulimit(1) manual pages.
9-1
Chapter 9
Analyzing Core Dumps
coredumpctl list
• To review more information about the core dumps stored for a particular
application, specify the executable as an option:
• To review all the core dumps that are stored for a failed process on the system,
specify the process ID instead:
2. Optionally, you can export an SOS report with extra information about the system.
For more information, see Working With the sos Command.
3. On the same system or a different one, install the gdb package and then step
through a core dump with the GNU Debugger by using the coredumpctl debug
command:
For more information about the coredumpctl command, see the coredumpctl(1)
manual pages.
9-2
10
Working With the drgn Kernel Debugging
Utility
Drgn is a tool and a programming library that can be used to extract debug information from
both the live kernel of the running machine, and memory crash dumps from halted systems
(vmcore).
To configure an Oracle Linux system to generate vmcore crash dumps, follow the instructions
in Working With Kernel Dumps.
Drgn can be used as part of a root cause analysis to provide extra metrics that aren't already
exposed through existing dashboards and interfaces.
For more information, see [Link]
[debuginfo]
name=Oracle Linux 8 Debuginfo Packages
baseurl=[Link]
gpgkey=[Link]
gpgcheck=1
enabled=1
Installing drgn
1. If you're running Oracle Linux with the Unbreakable Enterprise Kernel (UEK), install the
kernel-uek-debuginfo package by using the dnf command:
If you're running Oracle Linux with the Red Hat Compatible Kernel (RHCK), install the
kernel-debuginfo package instead:
10-1
Chapter 10
Using the drgn Command
For more information, see Oracle Linux: Managing Software on Oracle Linux.
3. Install the drgn package:
sudo drgn
To debug a running kernel or vmcore crash dump, specify the dump file by using the -c
option. Optionally, specify the vmlinux and module symbols by also using the -s
option:
For example, to debug /proc/kcore for a live kernel and specify kernel drivers, run
the following command:
For more information about how to use the drgn command, use the -h option:
sudo drgn -h
10-2
Chapter 10
Using the drgn Library With Python
Before you can start using drgn with Python scripts, ensure that Python is correctly installed
on the system. For more information, see Oracle Linux 8: Installing and Managing Python.
The prog array variable contains the information about the kernel that you are debugging. For
example, to return the data collected for slab_caches, run the following statements in the
drgn shell:
prog["slab_caches"]
(struct list_head){
.next = (struct list_head *)0xffff8b831d972260,
.prev = (struct list_head *)0xffff8b8007c02060,
}
Standard python structures can also be used to iterate through debug information:
slab_caches = prog["slab_caches"]
slab_caches.next
For more information about the drgn API and script syntax, see [Link]
10-3