|
|
f43afa |
From f19a1ef476349c42861cfecf6dc5afdbedc9191f Mon Sep 17 00:00:00 2001
|
|
|
f43afa |
From: Jonathan Lebon <jlebon@redhat.com>
|
|
|
f43afa |
Date: Mon, 10 Feb 2014 10:20:56 -0500
|
|
|
f43afa |
Subject: [PATCH] man/systemtap.8.in: new man page to replace README
|
|
|
f43afa |
|
|
|
f43afa |
This man page replaces the README.systemtap text file. The content is
|
|
|
f43afa |
almost the same. A lot of rephrasing, some restructuring, and some
|
|
|
f43afa |
clarifications that weren't present in the original document.
|
|
|
f43afa |
|
|
|
f43afa |
- man/systemtap.8.in: new man page
|
|
|
f43afa |
- initscript/README.systemtap: remove it
|
|
|
f43afa |
- initscript/systemtap.in: add hint to man page
|
|
|
f43afa |
|
|
|
f43afa |
- configure.ac: add man/systemtap.8.in in AC_CONFIG_FILES macro
|
|
|
f43afa |
- man/Makefile.am: add systemtap.8 to man_MANS
|
|
|
f43afa |
- systemtap.spec: replace README by man page in systemtap-initscript pkg
|
|
|
f43afa |
$files list
|
|
|
f43afa |
---
|
|
|
f43afa |
configure.ac | 2 +-
|
|
|
f43afa |
initscript/README.systemtap | 447 --------------------------------------------
|
|
|
f43afa |
initscript/systemtap.in | 4 +-
|
|
|
f43afa |
man/Makefile.am | 2 +-
|
|
|
f43afa |
man/systemtap.8.in | 439 +++++++++++++++++++++++++++++++++++++++++++
|
|
|
f43afa |
systemtap.spec | 2 +-
|
|
|
f43afa |
6 files changed, 445 insertions(+), 451 deletions(-)
|
|
|
f43afa |
delete mode 100644 initscript/README.systemtap
|
|
|
f43afa |
create mode 100644 man/systemtap.8.in
|
|
|
f43afa |
|
|
|
f43afa |
diff --git a/configure.ac b/configure.ac
|
|
|
f43afa |
index 3f22549..9cc1e50 100644
|
|
|
f43afa |
--- a/configure.ac
|
|
|
f43afa |
+++ b/configure.ac
|
|
|
f43afa |
@@ -682,7 +682,7 @@ AC_SUBST(STAP_PREFIX, "$stap_prefix")
|
|
|
f43afa |
AC_CONFIG_HEADERS([config.h:config.in])
|
|
|
f43afa |
AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile \
|
|
|
f43afa |
doc/beginners/Makefile doc/SystemTap_Tapset_Reference/Makefile \
|
|
|
f43afa |
-man/stappaths.7 \
|
|
|
f43afa |
+man/stappaths.7 man/systemtap.8 \
|
|
|
f43afa |
initscript/config.systemtap initscript/config.stap-server \
|
|
|
f43afa |
initscript/systemtap initscript/stap-server \
|
|
|
f43afa |
initscript/99stap/module-setup.sh ])
|
|
|
f43afa |
diff --git a/initscript/README.systemtap b/initscript/README.systemtap
|
|
|
f43afa |
deleted file mode 100644
|
|
|
f43afa |
index 9dd1ee6..0000000
|
|
|
f43afa |
--- a/initscript/README.systemtap
|
|
|
f43afa |
+++ /dev/null
|
|
|
f43afa |
@@ -1,447 +0,0 @@
|
|
|
f43afa |
-Systemtap initscript
|
|
|
f43afa |
-Version 0.2.1
|
|
|
f43afa |
-Author: Masami Hiramatsu <mhiramat@redhat.com>
|
|
|
f43afa |
-
|
|
|
f43afa |
-INDEX
|
|
|
f43afa |
-=====
|
|
|
f43afa |
-1. Introduction
|
|
|
f43afa |
-2. Usage
|
|
|
f43afa |
-3. Files
|
|
|
f43afa |
-4. Configuration Format
|
|
|
f43afa |
-5. How to use
|
|
|
f43afa |
-
|
|
|
f43afa |
-1. Introduction
|
|
|
f43afa |
-===============
|
|
|
f43afa |
-Systemtap initscript aims to provide
|
|
|
f43afa |
-- running systemtap script as a service with dependency.
|
|
|
f43afa |
-- easy way to control(start/stop) those scripts individually.
|
|
|
f43afa |
-The dependency means that which user-defined systemtap script is required by
|
|
|
f43afa |
-other script (Here the scripts don't include tapsets). This dependency
|
|
|
f43afa |
-will be useful for users who use -DRELAY_HOST and -DRELAY_GUEST.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2. Usage
|
|
|
f43afa |
-========
|
|
|
f43afa |
-2.1 Synopsis
|
|
|
f43afa |
-
|
|
|
f43afa |
-/sbin/service systemtap {start|stop|restart|status|compile|onboot|cleanup} \
|
|
|
f43afa |
- [-r kernelrelease] [-o path.img] [-b] [-c config] [-R] [-y] [script(s)]
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2 Commands
|
|
|
f43afa |
- You have to specify one of the below commands.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2.1 start
|
|
|
f43afa |
- Run script(s). If the script(s) is already started, the command will be
|
|
|
f43afa |
- ignored. If it fails to start, return FAIL. If AUTOCOMPILE option is 'yes'
|
|
|
f43afa |
- (see 4.1.9), this will try to compile or update the specified script when
|
|
|
f43afa |
- one of the below condition is true.
|
|
|
f43afa |
- - compiled cache file does not exist.
|
|
|
f43afa |
- - mtime (modified time stamp) of original script file is newer than compiled
|
|
|
f43afa |
- script cache.
|
|
|
f43afa |
- - script options which is used when compiling(see 4.2.1) has been changed.
|
|
|
f43afa |
- - result of `uname -a` has been changed.
|
|
|
f43afa |
- If no scripts specified from command line, it starts all scripts in the script
|
|
|
f43afa |
- directory or the scripts specified by DEFAULT_START in config (see 4.1.10).
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2.2 stop
|
|
|
f43afa |
- Stop script(s). If the script(s) is already stopped, this will be ignored.
|
|
|
f43afa |
- If it fails to stop, return FAIL.
|
|
|
f43afa |
- If no scripts specified from command line, it stops all running scripts.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2.3 restart
|
|
|
f43afa |
- Stop and start script(s) again.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2.4 status
|
|
|
f43afa |
- Show running script(s) status and dependency.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2.5 compile
|
|
|
f43afa |
- Compile script(s) on the specified kernel. This command takes '-r' option
|
|
|
f43afa |
- which specifies the release of the kernel(see 2.3.4) on which you would
|
|
|
f43afa |
- like to compile script(s). This command asks user whether it can overwrite
|
|
|
f43afa |
- existing caches.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2.6 onboot
|
|
|
f43afa |
- Make script(s) part of the initramfs so that they are started earlier during
|
|
|
f43afa |
- the boot process. Only works on dracut-based systems. This command also takes
|
|
|
f43afa |
- the '-r' option. If '-r' is omitted, the initramfs is created for the running
|
|
|
f43afa |
- kernel. If '-o path.img' is given, the initramfs is created at 'path.img' (must
|
|
|
f43afa |
- be an absolute path). Otherwise, defaults to '/boot/initramfs-KVER.img', where
|
|
|
f43afa |
- KVER is `uname -r` if the '-r' option is omitted, or the given kernel version
|
|
|
f43afa |
- otherwise.
|
|
|
f43afa |
-
|
|
|
f43afa |
- If the output file already exists, it is overwritten, unless the -b switch is
|
|
|
f43afa |
- given, in which case the file is appended '.bak' rather than overwritten. Note
|
|
|
f43afa |
- however that if a '.bak' version already exists, it will not be overwritten.
|
|
|
f43afa |
-
|
|
|
f43afa |
- If no scripts are specified on the command-line, the initramfs will be created
|
|
|
f43afa |
- without including any scripts at all (i.e. no extra systemtap files added).
|
|
|
f43afa |
-
|
|
|
f43afa |
- Warning: do not use the stap -o option with onboot scripts because the
|
|
|
f43afa |
- script is started before the root filesystem is even mounted. Increase the
|
|
|
f43afa |
- buffer size if more space is needed.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.2.7 cleanup
|
|
|
f43afa |
- Cleanup compiled script(s) from cache directory(see 3.4). This command also
|
|
|
f43afa |
- takes '-r' option. If '-r' option is omitted, cleanup all caches for running
|
|
|
f43afa |
- kernel. This command asks user whether it can remove caches.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3 Options
|
|
|
f43afa |
- Systemtap initscript can have some options. However, since user can't pass
|
|
|
f43afa |
- these options on boot, these options are only for testing or managing scripts
|
|
|
f43afa |
- after booting.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3.1 -c config_path
|
|
|
f43afa |
- You can specify configuration path of this initscript.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3.2 script(s)
|
|
|
f43afa |
- You can specify individual scripts to the commands. If you omit to specify
|
|
|
f43afa |
- any script, systemtap initscript will execute the command with all scripts
|
|
|
f43afa |
- in the script directory (except 'start', 'stop', and 'onboot' commands, see
|
|
|
f43afa |
- 2.2.1, 2.2.2, and 2.2.6).
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3.3 -R
|
|
|
f43afa |
- If this option is specified, systemtap initscript will try to solve
|
|
|
f43afa |
- dependency of specified script(s). This option is always set if you don't
|
|
|
f43afa |
- specify any script(s) from command line.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3.4 -r kernelrelease
|
|
|
f43afa |
- You can specify release version of the kernel(e.g. 2.6.26.1). This option
|
|
|
f43afa |
- is valid only with compile, onboot, and cleanup commands.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3.5 -y
|
|
|
f43afa |
- Answer yes for all questions.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3.6 -o path.img
|
|
|
f43afa |
- Specify the path of the initramfs image. Otherwise, the default is
|
|
|
f43afa |
- '/boot/initramfs-KVER.img', where KVER is `uname -r` if the '-r' option is
|
|
|
f43afa |
- omitted, or the given kernel version otherwise. This option is only valid with
|
|
|
f43afa |
- the onboot command.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.3.7 -b
|
|
|
f43afa |
- If present, will backup an existing initramfs image by renaming it with a
|
|
|
f43afa |
- '.bak' extension. Otherwise, the initramfs is overwritten without backing up.
|
|
|
f43afa |
- This option is only valid with the onboot command.
|
|
|
f43afa |
-
|
|
|
f43afa |
-2.4 Misc
|
|
|
f43afa |
-2.4.1 Service Priority
|
|
|
f43afa |
- Each initscript has execution priority. Since user would like to trace
|
|
|
f43afa |
- other services by using systemtap, systemtap initscript should have the
|
|
|
f43afa |
- highest priority.
|
|
|
f43afa |
-
|
|
|
f43afa |
-3. Files
|
|
|
f43afa |
-========
|
|
|
f43afa |
-3.1 initscript
|
|
|
f43afa |
- /etc/init.d/systemtap
|
|
|
f43afa |
-
|
|
|
f43afa |
- This file is an executable bash script.
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.2 Configurations
|
|
|
f43afa |
- Configuration files are written in bash script.
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.2.1 Global config file
|
|
|
f43afa |
- /etc/systemtap/config
|
|
|
f43afa |
-
|
|
|
f43afa |
- This config file is for global parameters(see 4.1).
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.2.2 Script config files
|
|
|
f43afa |
- /etc/systemtap/conf.d/*.conf
|
|
|
f43afa |
-
|
|
|
f43afa |
- The config files under this directory are for each scripts or script groups
|
|
|
f43afa |
- (see 4.2).
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.3 Script directory
|
|
|
f43afa |
- /etc/systemtap/script.d/
|
|
|
f43afa |
-
|
|
|
f43afa |
- Systemtap initscript finds systemtap scripts from this directory.
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.3.1 Scripts in the directory
|
|
|
f43afa |
- /etc/systemtap/script.d/<script-name>.stp
|
|
|
f43afa |
-
|
|
|
f43afa |
- Systemtap scripts stored in the script directory must have ".stp" suffix.
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.4 Cache directory
|
|
|
f43afa |
- /var/cache/systemtap/<kernel-version>/
|
|
|
f43afa |
-
|
|
|
f43afa |
- Systemtap initscript stores compiled scripts in this directory.
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.4.1 Compiled scripts (or script caches)
|
|
|
f43afa |
- /var/cache/systemtap/<kernel-version>/<script-name>.ko
|
|
|
f43afa |
- /var/cache/systemtap/<kernel-version>/<script-name>.opts
|
|
|
f43afa |
-
|
|
|
f43afa |
- *.ko file is the compiled script, and *.opts is the file which stores
|
|
|
f43afa |
- stap options and uname -a.
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.5 Message Log
|
|
|
f43afa |
- /var/log/systemtap.log
|
|
|
f43afa |
-
|
|
|
f43afa |
- All messages including compilation errors and detailed messages are sent
|
|
|
f43afa |
- to this file.
|
|
|
f43afa |
- Some error and warning messages are also sent to console and syslogd (syslog
|
|
|
f43afa |
- output is optional, because this service will start before syslog).
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.6 Status files
|
|
|
f43afa |
- /var/run/systemtap/<script-name>
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.7 Dracut
|
|
|
f43afa |
- Files related to dracut/initramfs creation
|
|
|
f43afa |
-
|
|
|
f43afa |
-3.7.1 Dracut stap module directory
|
|
|
f43afa |
- /usr/lib/dracut/modules.d/99stap
|
|
|
f43afa |
-
|
|
|
f43afa |
- These files permit SystemTap modules to be included in the initramfs.
|
|
|
f43afa |
-
|
|
|
f43afa |
-4. Configuration Format
|
|
|
f43afa |
-=======================
|
|
|
f43afa |
-Configuration file allows us
|
|
|
f43afa |
-- specifying options for each script
|
|
|
f43afa |
-- supporting flight recorder mode (on file or memory)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1 Global Parameters
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.1 SCRIPT_PATH
|
|
|
f43afa |
- Specify the absolute path of the script directory.
|
|
|
f43afa |
- (default: /etc/systemtap/script.d)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.2 CONFIG_PATH
|
|
|
f43afa |
- Specify the absolute path of the script config directory.
|
|
|
f43afa |
- (default: /etc/systemtap/conf.d)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.3 CACHE_PATH
|
|
|
f43afa |
- Specify the absolute path of the parent directory of the cache directory.
|
|
|
f43afa |
- (default: /var/cache/systemtap)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.4 TEMP_PATH
|
|
|
f43afa |
- Specify the absolute path of the temporary directory on which systemtap
|
|
|
f43afa |
- initscript make temporary directories to compile scripts.
|
|
|
f43afa |
- (default: /tmp)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.5 STAT_PATH
|
|
|
f43afa |
- Specify the absolute path of the running status directory.
|
|
|
f43afa |
- (default: /var/run/systemtap)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.6 LOG_FILE
|
|
|
f43afa |
- Specify the absolute path of the log file
|
|
|
f43afa |
- (default: /var/log/systemtap.log)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.7 PASSALL
|
|
|
f43afa |
- If this is set 'yes', systemtap initscript will fail when it fails
|
|
|
f43afa |
- to run one of the scripts. If not, systemtap initscript will not
|
|
|
f43afa |
- fail(just warn).
|
|
|
f43afa |
- (default: yes)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.8 RECURSIVE
|
|
|
f43afa |
- If this is set 'yes', systemtap initscript will always follow script
|
|
|
f43afa |
- dependencies. This means, you don't need to specify '-R' option. This flag is
|
|
|
f43afa |
- effective only if you specify script(s) from command line.
|
|
|
f43afa |
- (default: no)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.9 AUTOCOMPILE
|
|
|
f43afa |
- If this is set 'yes', systemtap initscript automatically tries to compile
|
|
|
f43afa |
- specified script if there is no valid cache. Otherwise, it just fails to
|
|
|
f43afa |
- run script(s).
|
|
|
f43afa |
- (default: yes)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.10 DEFAULT_START
|
|
|
f43afa |
- Specify scripts which will be started by default. If omitted (or empty),
|
|
|
f43afa |
- all scripts in the script directory will be started.
|
|
|
f43afa |
- (default: "")
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.11 ALLOW_CACHEONLY
|
|
|
f43afa |
- If this is set 'yes', systemtap initscript list up cache-only scripts too.
|
|
|
f43afa |
- *NOTE*: systemtap initscript will load unexpected obsolete caches with this
|
|
|
f43afa |
- option. You should check cache directory before enabling this option.
|
|
|
f43afa |
- (default: no)
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.1.12 LOG_BOOT_ERR
|
|
|
f43afa |
- Because boot-time scripts are run before the root filesystem is mounted,
|
|
|
f43afa |
- staprun's stderr cannot be logged to the LOG_FILE as usual (see 4.1.6).
|
|
|
f43afa |
- However, the log can instead be output to /var/run/systemtap/$script.log (which
|
|
|
f43afa |
- is accessible at boot-time) by setting LOG_BOOT_ERR to 'yes'. If STAT_PATH is
|
|
|
f43afa |
- different from the default, the log files will be moved there upon executing
|
|
|
f43afa |
- any of the initscript commands.
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.2 Script Parameters
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.2.1 <script-name>_OPT
|
|
|
f43afa |
- Specify options passed to stap command for each script. "script-name" is the
|
|
|
f43afa |
- name of the script file without the suffix extension(.stp).
|
|
|
f43afa |
- Some options are just ignored. And even if you don't specify -F option,
|
|
|
f43afa |
- systemtap initscript always add it for flight recorder mode.
|
|
|
f43afa |
- - Below options are ignored when compiling script.
|
|
|
f43afa |
- -p,-m,-r,-c,-x,-e,-s,-o,-h,-V,-k
|
|
|
f43afa |
- - Below options are ignored when starting script.
|
|
|
f43afa |
- -h,-V,-v,-t,-p,-I,-e,-R,-r,-m,-k,-g,-P,-D,-b,-u,-q,-w,-l,-d,-L,-F, and
|
|
|
f43afa |
- other long options.
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.2.2 <script-name>_REQ
|
|
|
f43afa |
- Specify script dependency(which script this script requires).
|
|
|
f43afa |
- For example, "foo.stp" script requires(or run after) "bar.stp" script, set
|
|
|
f43afa |
-
|
|
|
f43afa |
- foo_REQ="bar"
|
|
|
f43afa |
-
|
|
|
f43afa |
- If the script requires many scripts, set all scripts separated by spaces.
|
|
|
f43afa |
-
|
|
|
f43afa |
- foo_REQ="bar baz"
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.3 Configuration Example
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.3.1 Global Config Example
|
|
|
f43afa |
----
|
|
|
f43afa |
-SCRIPT_PATH=/var/systemtap/script.d/
|
|
|
f43afa |
-PASSALL=yes
|
|
|
f43afa |
-RECURSIVE=no
|
|
|
f43afa |
----
|
|
|
f43afa |
-
|
|
|
f43afa |
-4.3.2 Script Config Example
|
|
|
f43afa |
----
|
|
|
f43afa |
-script1_OPT="-o /var/log/script1.out -DRELAYHOST=group1"
|
|
|
f43afa |
-script2_OPT="-DRELAYGUEST=group1"
|
|
|
f43afa |
-script2_REQ=script1
|
|
|
f43afa |
----
|
|
|
f43afa |
-
|
|
|
f43afa |
-5. How to use
|
|
|
f43afa |
-=============
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.1 Package Installation
|
|
|
f43afa |
- After installing systemtap package, install systemtap-initscript package.
|
|
|
f43afa |
- # yum install systemtap-initscript
|
|
|
f43afa |
- This package will include initscript and default configuration file and
|
|
|
f43afa |
- other files.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.2 Script installation
|
|
|
f43afa |
-5.2.1 Installing script files
|
|
|
f43afa |
- Copy a systemtap script ("script1.stp") into script directory.
|
|
|
f43afa |
- # cp script1.stp /etc/systemtap/script.d/
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.2.2 Configuration script options
|
|
|
f43afa |
- Add configuration file to specify options.
|
|
|
f43afa |
- # vi /etc/systemtap/conf.d/group1
|
|
|
f43afa |
- script1_OPT="-o /var/log/group1.log -DRELAYHOST=group1"
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.2.3 Installing script file with dependency
|
|
|
f43afa |
- For example, a script("script2.stp") which shares buffer with another
|
|
|
f43afa |
- script("script1.stp"), there is a dependency. In this case, you just do
|
|
|
f43afa |
- as following.
|
|
|
f43afa |
-
|
|
|
f43afa |
- # cp script2.stp /etc/systemtap/script.d/
|
|
|
f43afa |
- # vi /etc/systemtap/conf.d/group1
|
|
|
f43afa |
- script2_OPT="-DRELAYGUEST=group1"
|
|
|
f43afa |
- script2_REQ=script1
|
|
|
f43afa |
-
|
|
|
f43afa |
- In this case, if stap fails to run script1.stp, systemtap initscript will
|
|
|
f43afa |
- not run script2.stp.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.3 Testing
|
|
|
f43afa |
- After installing all scripts, please make sure to run service successfully.
|
|
|
f43afa |
- # service systemtap start
|
|
|
f43afa |
- # service systemtap stop
|
|
|
f43afa |
- If there is no error, we are ready to use it.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.4 Service Enabling
|
|
|
f43afa |
- After all test passed, enable systemtap initscript.
|
|
|
f43afa |
- # chkconfig systemtap on
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.5 Adding script
|
|
|
f43afa |
-5.5.1 Installing and configuring new scripts
|
|
|
f43afa |
- Copy new systemtap script("script3.stp") into script directory.
|
|
|
f43afa |
- # cp script3.stp /etc/systemtap/script.d/
|
|
|
f43afa |
- and configure it.
|
|
|
f43afa |
- # vi /etc/systemtap/conf.d/group1
|
|
|
f43afa |
- script3_OPT="-DRELAYGUEST=group1"
|
|
|
f43afa |
- script3_REQ="script1"
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.5.2 Start new script
|
|
|
f43afa |
- If you've already started systemtap initscript, just start new script.
|
|
|
f43afa |
- # service systemtap start script3
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.6 Deleting script
|
|
|
f43afa |
-5.6.1 Deleting old script
|
|
|
f43afa |
- Remove old script ("script2.stp") and remove configure lines
|
|
|
f43afa |
- # rm /etc/systemtap/script.d/script2.stp
|
|
|
f43afa |
- # vi /etc/systemtap/conf.d/group1
|
|
|
f43afa |
- (delete script2_OPT and script2_REQ)
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.6.2 Stopping old script and cleanup
|
|
|
f43afa |
- Stop old script.
|
|
|
f43afa |
- # service systemtap stop script2
|
|
|
f43afa |
- And cleanup the script caches.
|
|
|
f43afa |
- # service systemtap cleanup script2
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.7 Updating kernel
|
|
|
f43afa |
- Usually, you don't need to do anything. Systemtap initscript checks the
|
|
|
f43afa |
- kernel version when starting the service, and compile scripts.
|
|
|
f43afa |
- (If you would like to use compiled scripts due to lack of compiler or
|
|
|
f43afa |
- debuginfo on the system, see 5.8)
|
|
|
f43afa |
- However, if you want to avoid compiling when booting system, you can prepare
|
|
|
f43afa |
- script caches for new kernel.
|
|
|
f43afa |
- # service systemtap compile -r <new kernel version>
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.8 Using with compiled scripts
|
|
|
f43afa |
- Sometimes, production systems don't have any compilation environment. Even
|
|
|
f43afa |
- though, you can use systemtap initscript with compiled scripts as script
|
|
|
f43afa |
- caches, which are compiled on other machine (but same software environment).
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.8.1 Preparing compiled scripts
|
|
|
f43afa |
- As described in 5.2, installing scripts and configure it on the compiling
|
|
|
f43afa |
- machine (which has compilation environment).
|
|
|
f43afa |
- After that, compile those scripts.
|
|
|
f43afa |
- # service systemtap compile -r <kernel-version>
|
|
|
f43afa |
- And package the compiled scripts and configuration file.
|
|
|
f43afa |
- # tar czf stap-scripts-<kernel-version>.tar.gz \
|
|
|
f43afa |
- /var/cache/systemtap/<kernel-version> /etc/systemtap/conf.d/<config>
|
|
|
f43afa |
- And copy this package to the target machine.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.8.2 Installing pre-compiled scripts
|
|
|
f43afa |
- On the target machine, unpackage the compiled scripts into cache
|
|
|
f43afa |
- directory.
|
|
|
f43afa |
- # tar xzf stap-scripts-<kernel-version>.tar.gz -C /var/cache/systemtap/
|
|
|
f43afa |
- # mv /var/cache/systemtap/<config> /etc/systemtap/conf.d/
|
|
|
f43afa |
- At last, set AUTOCOMPILE=no and ALLOW_CACHEONLY=yes in config file.
|
|
|
f43afa |
- # vi /etc/systemtap/config
|
|
|
f43afa |
- AUTOCOMPILE=no
|
|
|
f43afa |
- ALLOW_CACHEONLY=yes
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.9 Starting scripts during early-boot
|
|
|
f43afa |
- The initscript also allows you to start scripts earlier during the boot
|
|
|
f43afa |
- process by creating an initramfs containing the script's module. Your system
|
|
|
f43afa |
- must be dracut-based for this to work. Starting at this stage gives access to
|
|
|
f43afa |
- information otherwise very hard to obtain.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.9.1 Preparing the script
|
|
|
f43afa |
- As usual, place the script in /etc/systemtap/script.d and any configuration
|
|
|
f43afa |
- settings in /etc/systemtap/conf.d. (Note however that -o and -c are not
|
|
|
f43afa |
- supported).
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.9.2 Adding to initramfs
|
|
|
f43afa |
- Simply run the command:
|
|
|
f43afa |
- # service systemtap onboot my_script
|
|
|
f43afa |
- If the script is not already compiled and cached, it will be done at this
|
|
|
f43afa |
- point. A new initramfs will then be created at the default location. You can
|
|
|
f43afa |
- specify the '-b' option to make sure that your current initramfs is backed up.
|
|
|
f43afa |
- You can then restart your system. See 2.2.6 for more information regarding the
|
|
|
f43afa |
- onboot command.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.9.3 Adding to a different initramfs
|
|
|
f43afa |
- Rather than taking the spot of the default initramfs, you may want to create a
|
|
|
f43afa |
- different initramfs for a one-time boot. You can do this using the -o option:
|
|
|
f43afa |
- # service systemtap onboot -o /boot/special_initramfs.img
|
|
|
f43afa |
- Once the initramfs is created, you can change the command-line options at
|
|
|
f43afa |
- boot-time so that the new image is used rather than the usual one.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.9.4 Creating an initramfs for a different kernel
|
|
|
f43afa |
- Just like the compile command, you can use the -r option to specify the kernel
|
|
|
f43afa |
- for which you would like to create the initramfs. This is useful when you are
|
|
|
f43afa |
- about to upgrade and would like to prepare in advance. For example:
|
|
|
f43afa |
- # service systemtap onboot -r 3.12.6-200.fc19.x86_64 my_script
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.9.5 Removing from initramfs
|
|
|
f43afa |
- To remove all scripts from the initramfs, you can run:
|
|
|
f43afa |
- # service systemtap onboot
|
|
|
f43afa |
- (That is, without any scripts explicitly mentioned). This will simply create
|
|
|
f43afa |
- a standard initramfs without any SystemTap modules inserted.
|
|
|
f43afa |
-
|
|
|
f43afa |
-5.9.6 Troubleshooting
|
|
|
f43afa |
- There can be many reasons for which the module didn't insert or did not work as
|
|
|
f43afa |
- expected. It may be useful to turn on dracut debugging by adding 'rdinitdebug' to
|
|
|
f43afa |
- the kernel command-line and checking dmesg/journalctl -ae. Also, you can
|
|
|
f43afa |
- capture the stderr output of staprun by setting LOG_BOOT_ERR to 'yes' (see
|
|
|
f43afa |
- 4.1.12).
|
|
|
f43afa |
diff --git a/initscript/systemtap.in b/initscript/systemtap.in
|
|
|
f43afa |
index 5290f56..21f9018 100755
|
|
|
f43afa |
--- a/initscript/systemtap.in
|
|
|
f43afa |
+++ b/initscript/systemtap.in
|
|
|
f43afa |
@@ -83,7 +83,7 @@ INITRAMFS=
|
|
|
f43afa |
BACKUP_INITRAMFS=
|
|
|
f43afa |
|
|
|
f43afa |
echo_usage () {
|
|
|
f43afa |
- echo $"Usage: $prog {start|stop|status|restart|compile|onboot|cleanup|condrestart|try-restart|reload|force-reload} [option]"
|
|
|
f43afa |
+ echo $"Usage: $prog {start|stop|status|restart|compile|onboot|cleanup|condrestart|try-restart|reload|force-reload} [OPTIONS] [SCRIPTS]"
|
|
|
f43afa |
echo $"Options:"
|
|
|
f43afa |
echo $" -b : backup initramfs before overwriting"
|
|
|
f43afa |
echo $" -c configfile : specify config file"
|
|
|
f43afa |
@@ -92,6 +92,8 @@ echo_usage () {
|
|
|
f43afa |
echo $" -R : recursively dependency checking"
|
|
|
f43afa |
echo $" -y : answer yes for all questions"
|
|
|
f43afa |
echo $" script(s) : specify systemtap scripts"
|
|
|
f43afa |
+ echo $""
|
|
|
f43afa |
+ echo $"See systemtap(8) for full documentation"
|
|
|
f43afa |
}
|
|
|
f43afa |
|
|
|
f43afa |
#-----------------------------------------------------------------
|
|
|
f43afa |
diff --git a/man/Makefile.am b/man/Makefile.am
|
|
|
f43afa |
index b626481..ef0892e 100644
|
|
|
f43afa |
--- a/man/Makefile.am
|
|
|
f43afa |
+++ b/man/Makefile.am
|
|
|
f43afa |
@@ -4,7 +4,7 @@
|
|
|
f43afa |
AUTOMAKE_OPTIONS = no-dist foreign
|
|
|
f43afa |
|
|
|
f43afa |
man_MANS = stapprobes.3stap stapfuncs.3stap stapvars.3stap stapex.3stap \
|
|
|
f43afa |
- dtrace.1 stap-merge.1 stappaths.7 stapsh.8
|
|
|
f43afa |
+ dtrace.1 stap-merge.1 stappaths.7 stapsh.8 systemtap.8
|
|
|
f43afa |
|
|
|
f43afa |
# NB: this doesn't work, apparently because make doesn't like
|
|
|
f43afa |
# file names with :: in them, misinterpreting them as some kind
|
|
|
f43afa |
diff --git a/man/systemtap.8.in b/man/systemtap.8.in
|
|
|
f43afa |
new file mode 100644
|
|
|
f43afa |
index 0000000..cea3868
|
|
|
f43afa |
--- /dev/null
|
|
|
f43afa |
+++ b/man/systemtap.8.in
|
|
|
f43afa |
@@ -0,0 +1,439 @@
|
|
|
f43afa |
+.\" -*- nroff -*-
|
|
|
f43afa |
+.TH SYSTEMTAP 8
|
|
|
f43afa |
+.SH NAME
|
|
|
f43afa |
+systemtap \- SystemTap initscript service
|
|
|
f43afa |
+
|
|
|
f43afa |
+.\" macros
|
|
|
f43afa |
+.de SAMPLE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.nr oldin \\n(.i
|
|
|
f43afa |
+.br
|
|
|
f43afa |
+.RS
|
|
|
f43afa |
+.nf
|
|
|
f43afa |
+.nh
|
|
|
f43afa |
+..
|
|
|
f43afa |
+.de ESAMPLE
|
|
|
f43afa |
+.hy
|
|
|
f43afa |
+.fi
|
|
|
f43afa |
+.RE
|
|
|
f43afa |
+.in \\n[oldin]u
|
|
|
f43afa |
+
|
|
|
f43afa |
+..
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH SYNOPSIS
|
|
|
f43afa |
+.B service systemtap
|
|
|
f43afa |
+.IR COMMAND " [" OPTIONS "] [" SCRIPT ...]
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH DESCRIPTION
|
|
|
f43afa |
+The SystemTap initscript aims to provide a way to run scripts as a service and
|
|
|
f43afa |
+easily control them individually. Scripts can be configured to start upon manual
|
|
|
f43afa |
+request, or during system startup. On dracut-based systems, it is also possible
|
|
|
f43afa |
+to integrate scripts in the initramfs and have them start during early-boot.
|
|
|
f43afa |
+
|
|
|
f43afa |
+There are various parameters and options available to modify global behaviour,
|
|
|
f43afa |
+as well as script behaviour. Dependencies between scripts can be established so
|
|
|
f43afa |
+that starting one starts others (especially convenient when using the
|
|
|
f43afa |
+-DRELAY_HOST and -DRELAY_GUEST options of \fIstap\fR(1)).
|
|
|
f43afa |
+
|
|
|
f43afa |
+The configuration file of the initscript is located at
|
|
|
f43afa |
+\fB@sysconfdir@/systemtap/config\fR. Acceptable parameters are detailed in the
|
|
|
f43afa |
+GLOBAL PARAMETERS section.
|
|
|
f43afa |
+
|
|
|
f43afa |
+Scripts must be placed in the \fB@sysconfdir@/systemtap/script.d\fR directory
|
|
|
f43afa |
+and must have a \fB.stp\fR extension. When referring to them on the command-line
|
|
|
f43afa |
+however, there in no need to include the \fB.stp\fR extension. The scripts
|
|
|
f43afa |
+directory may be changed by setting the SCRIPT_PATH parameter in the
|
|
|
f43afa |
+configuration file.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH COMMANDS
|
|
|
f43afa |
+One of the commands below must be specified:
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B start
|
|
|
f43afa |
+Start \fISCRIPT\fRs. If no scripts are specified, start the scripts specified by
|
|
|
f43afa |
+the DEFAULT_START configuration. If DEFAULT_START is not set, start all scripts
|
|
|
f43afa |
+in the script directory. For scripts already started, the command is ignored.
|
|
|
f43afa |
+The command will fail if the scripts fail to start (see also the PASSALL
|
|
|
f43afa |
+configuration).
|
|
|
f43afa |
+
|
|
|
f43afa |
+If the AUTOCOMPILE configuration is on, the command will try to compile or
|
|
|
f43afa |
+update the specified scripts when one of the below conditions is true:
|
|
|
f43afa |
+.RS
|
|
|
f43afa |
+.IP - 2
|
|
|
f43afa |
+The compiled cache file does not exist.
|
|
|
f43afa |
+.IP -
|
|
|
f43afa |
+The mtime (modified timestamp) of the original script file is newer than the
|
|
|
f43afa |
+time of the compiled script cache.
|
|
|
f43afa |
+.IP -
|
|
|
f43afa |
+The specified stap options used to compile the script has been changed (see
|
|
|
f43afa |
+also the SCRIPT PARAMETERS section).
|
|
|
f43afa |
+.IP -
|
|
|
f43afa |
+The result of `uname -a` has been changed.
|
|
|
f43afa |
+.RE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B stop
|
|
|
f43afa |
+Stop \fISCRIPT\fRs. If no scripts are specified, stop all running scripts. For
|
|
|
f43afa |
+scripts already stopped, the command is ignored. The command will fail if the
|
|
|
f43afa |
+scripts fail to stop (see also the PASSALL configuration).
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B restart
|
|
|
f43afa |
+Stop and start \fISCRIPT\fRs.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B status
|
|
|
f43afa |
+Show the state of \fISCRIPT\fRs and their dependencies.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B compile
|
|
|
f43afa |
+Compile \fISCRIPT\fRs but do not start them. If the scripts have already been
|
|
|
f43afa |
+compiled, prompt for confirmation before overwriting cache. Compile for the
|
|
|
f43afa |
+current kernel, or the kernel release specified by the \fB-r\fR option.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B onboot
|
|
|
f43afa |
+Make \fISCRIPT\fRs part of the initramfs so that they are started earlier during
|
|
|
f43afa |
+the boot process. This command is only available on dracut-based systems. If no
|
|
|
f43afa |
+scripts are specified, create a normal initramfs devoid of any SystemTap files.
|
|
|
f43afa |
+
|
|
|
f43afa |
+The initramfs is created for the current kernel, or the kernel release specified
|
|
|
f43afa |
+by the \fB-r\fR option. The path of the created initramfs defaults
|
|
|
f43afa |
+to \fB/boot/initramfs-KVER.img\fR, where KVER is the output of `uname -r`. Use
|
|
|
f43afa |
+the \fB-o\fR option to specify a different path.
|
|
|
f43afa |
+
|
|
|
f43afa |
+If the output file already exists, it is overwritten, unless the \fB-b\fR switch
|
|
|
f43afa |
+is given, in which case the file is appended \fB.bak\fR rather than overwritten.
|
|
|
f43afa |
+However, if there is already a \fB.bak\fR version of the file, the backup will
|
|
|
f43afa |
+not be overwritten.
|
|
|
f43afa |
+
|
|
|
f43afa |
+WARNING: do not use the \fB-o\fR option of \fIstap\fR(1) with onboot scripts
|
|
|
f43afa |
+because the script is started before the root filesystem is even mounted.
|
|
|
f43afa |
+Increase the buffer size if more space is needed.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B cleanup
|
|
|
f43afa |
+Delete the compiled \fISCRIPT\fRs from cache. If no scripts are specified, then
|
|
|
f43afa |
+all compiled scripts are deleted. Only the cache for the current kernel is
|
|
|
f43afa |
+deleted, or the kernel release specified by the \fB-r\fR option. Prompt for
|
|
|
f43afa |
+confirmation before deleting.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH OPTIONS
|
|
|
f43afa |
+Many of the commands can also take options. However, since users can't pass
|
|
|
f43afa |
+these options on boot, they are only meant for managing scripts after boot and
|
|
|
f43afa |
+for testing. Available options are:
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.BI "-c " CONFIG_FILE
|
|
|
f43afa |
+Specify a different configuration file in place of the default one.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B -R
|
|
|
f43afa |
+When using the \fBstart\fR and \fBstop\fR commands, also include the scripts'
|
|
|
f43afa |
+dependencies (recursively).
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.BI "-r " KERNEL_RELEASE
|
|
|
f43afa |
+When using the \fBcompile\fR, \fBonboot\fR, and \fBcleanup\fR commands, specify
|
|
|
f43afa |
+the target kernel version rather than using the current one. Must be in the same
|
|
|
f43afa |
+format as `uname -r`.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B -y
|
|
|
f43afa |
+Answer yes for all prompts.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.BI "-o " PATH.IMG
|
|
|
f43afa |
+When using the \fBonboot\fR command, specify the output path of the created
|
|
|
f43afa |
+initramfs.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B -b
|
|
|
f43afa |
+When using the \fBonboot\fR command, backup an existing initramfs image by
|
|
|
f43afa |
+adding a \fB.bak\fR extension rather than overwriting it. Without this option,
|
|
|
f43afa |
+the initramfs is overwritten.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH GLOBAL PARAMETERS
|
|
|
f43afa |
+These parameters affect the general behaviour of the SystemTap initscript
|
|
|
f43afa |
+service. They can be specified in the configuration file.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B SCRIPT_PATH
|
|
|
f43afa |
+Specify the absolute path of the script directory. These are the scripts on
|
|
|
f43afa |
+which the initscript can operate. Scripts must have the \fB.stp\fR extension.
|
|
|
f43afa |
+The default path is \fB@sysconfdir@/systemtap/script.d\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B CONFIG_PATH
|
|
|
f43afa |
+Specify the absolute path of the script configuration directory. These
|
|
|
f43afa |
+configuration files contain options for specific scripts. They must have the
|
|
|
f43afa |
+\fB.conf\fR extension. The default path is \fB@sysconfdir@/systemtap/conf.d\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B CACHE_PATH
|
|
|
f43afa |
+Specify the absolute path of the cache directory. The default path is
|
|
|
f43afa |
+\fB@localstatedir@/cache/systemtap\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B TEMP_PATH
|
|
|
f43afa |
+Specify the absolute path of the temporary directory in which SystemTap
|
|
|
f43afa |
+makes temporary directories to compile scripts. The default path is \fB/tmp\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B STAT_PATH
|
|
|
f43afa |
+Specify the absolute path of the directory containing PID files used to track
|
|
|
f43afa |
+the status of SystemTap scripts. The default path is
|
|
|
f43afa |
+\fB@localstatedir@/run/systemtap\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B LOG_FILE
|
|
|
f43afa |
+Specify the absolute path of the log file. All messages are sent to this file,
|
|
|
f43afa |
+including compilation and runtime errors. The default path is
|
|
|
f43afa |
+\fB@localstatedir@/log/systemtap.log\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B PASSALL
|
|
|
f43afa |
+If this is set \fByes\fR, initscript commands that operate on multiple scripts
|
|
|
f43afa |
+will report as failed when the action could not be performed on at least one
|
|
|
f43afa |
+script. If set to \fBno\fR, only a warning is emitted. The default is \fByes\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B RECURSIVE
|
|
|
f43afa |
+If this is set \fByes\fR, the initscript will always follow script dependencies
|
|
|
f43afa |
+recursively. This means that there is no need to specify the \fB-R\fR option.
|
|
|
f43afa |
+This flag is effective only if you specify script(s) from the command-line. The
|
|
|
f43afa |
+default is \fBno\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B AUTOCOMPILE
|
|
|
f43afa |
+If this is set \fByes\fR, the initscript automatically tries to compile
|
|
|
f43afa |
+specified scripts when needed if there is no valid cache. Otherwise, the related
|
|
|
f43afa |
+command simply fails. The default is \fByes\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B DEFAULT_START
|
|
|
f43afa |
+Specify scripts which will be started by default. If omitted (or empty), all
|
|
|
f43afa |
+scripts in the script directory will be started. The default is \fB""\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B ALLOW_CACHEONLY
|
|
|
f43afa |
+If this is set \fByes\fR, the initscript will also allow operating on scripts
|
|
|
f43afa |
+that are located in the cache directory, but not in the script directory. The
|
|
|
f43afa |
+default is \fBno\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+WARNING: the initscript may load unexpected obsolete caches with this option.
|
|
|
f43afa |
+The cache directory should be checked before enabling this option.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B LOG_BOOT_ERR
|
|
|
f43afa |
+Because boot-time scripts are run before the root filesystem is mounted,
|
|
|
f43afa |
+staprun's stderr cannot be logged to the LOG_FILE as usual. However, the log
|
|
|
f43afa |
+can instead be output to /var/run/systemtap/$script.log by setting LOG_BOOT_ERR
|
|
|
f43afa |
+to \fByes\fR. If STAT_PATH is different from the default, the log files will be
|
|
|
f43afa |
+moved there upon executing any of the initscript commands. The default is
|
|
|
f43afa |
+\fBno\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.PP
|
|
|
f43afa |
+Here is a global configuration file example:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+SCRIPT_PATH=/var/systemtap/script.d/
|
|
|
f43afa |
+PASSALL=yes
|
|
|
f43afa |
+RECURSIVE=no
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH SCRIPT PARAMETERS
|
|
|
f43afa |
+These parameters affect the compilation or runtime behaviour of specific
|
|
|
f43afa |
+SystemTap scripts. They must be placed in config files located in the
|
|
|
f43afa |
+CONFIG_PATH directory.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B <SCRIPT>_OPT
|
|
|
f43afa |
+Specify options passed to the \fIstap\fR(1) command for the SCRIPT. Here, SCRIPT
|
|
|
f43afa |
+is the name of the script file without the \fB.stp\fR extension. Note that the
|
|
|
f43afa |
+\fB-F\fR option is always added.
|
|
|
f43afa |
+
|
|
|
f43afa |
+The following options are ignored when compiling scripts: -p, -m, -r, -c, -x,
|
|
|
f43afa |
+-e, -s, -o, -h, -V, -k.
|
|
|
f43afa |
+
|
|
|
f43afa |
+The following options are ignored when running starting scripts: -h, -V, -v, -t,
|
|
|
f43afa |
+-p, -I, -e, -R, -r, -m, -k, -g, -P, -D, -b, -u, -q, -w, -l, -d, -L, -F, and all
|
|
|
f43afa |
+long options.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B <SCRIPT>_REQ
|
|
|
f43afa |
+Specify script dependencies (i.e. which script this script requires). For
|
|
|
f43afa |
+example, if foo.stp requires (or needs to run after) bar.stp, set
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+foo_REQ="bar"
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+Specify multiple scripts by separating their names by spaces.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.PP
|
|
|
f43afa |
+Here is a script configuration file example:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+script1_OPT="-o /var/log/script1.out -DRELAY_HOST=group1"
|
|
|
f43afa |
+script2_OPT="-DRELAY_GUEST=group1"
|
|
|
f43afa |
+script2_REQ="script1"
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH EXAMPLES
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B INSTALLING SCRIPTS
|
|
|
f43afa |
+We first copy a SystemTap script (e.g. "script1.stp") into the script directory:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR cp script1.stp /etc/systemtap/script.d/
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+We can then set any script options, for example:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR vi /etc/systemtap/conf.d/group1
|
|
|
f43afa |
+script1_OPT="-o /var/log/group1.out -DRELAY_HOST=group1"
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+If we then install a script (e.g. "script2.stp") which shares a buffer with
|
|
|
f43afa |
+script1, there is a dependency. In this case, we can do the following:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR cp script2.stp /etc/systemtap/script.d/
|
|
|
f43afa |
+\fB#\fR vi /etc/systemtap/conf.d/group1
|
|
|
f43afa |
+script2_OPT="-DRELAY_GUEST=group1"
|
|
|
f43afa |
+script2_REQ="script1"
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+This way, if \fIstap\fR(1) fails to run script1, the initscript will not even
|
|
|
f43afa |
+try to run script2.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B TESTING
|
|
|
f43afa |
+After installing scripts, we can test that they work by simply doing:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap start
|
|
|
f43afa |
+\fB#\fR service systemtap stop
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+We could be more specific as well, for example:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap start script1
|
|
|
f43afa |
+\fB#\fR service systemtap stop script1
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+If there were no errors, we are ready to use it.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B ENABLING SERVICE
|
|
|
f43afa |
+After we're satisfied with the scripts and their tests, we can enable the
|
|
|
f43afa |
+SystemTap initscript service:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR chkconfig systemtap on
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B DELETING SCRIPTS
|
|
|
f43afa |
+Scripts are deleted by simply removing them from the script directory and
|
|
|
f43afa |
+removing any configuration lines specific to them:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR rm /etc/systemtap/script.d/script2.stp
|
|
|
f43afa |
+\fB#\fR vi /etc/systemtap/conf.d/group1
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+If the script is still running, we also need to stop it:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap stop script2
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+We can then also remove the cache associated with the script:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap cleanup script2
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B PREPARING FOR KERNEL UPDATES
|
|
|
f43afa |
+Usually, there is nothing to do when booting into a new kernel. The initscript
|
|
|
f43afa |
+will see that the kernel version is different and will compile the scripts. The
|
|
|
f43afa |
+compilation can be done beforehand as well to avoid having to compile during
|
|
|
f43afa |
+boot by using the \fB-r\fR option:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap compile myscript -r <NEW_KERNEL_VERSION>
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B IMPORTING COMPILED SCRIPTS
|
|
|
f43afa |
+For environments which lack compilation infrastructure (e.g. no compilers or
|
|
|
f43afa |
+debuginfo), such as a production system, the scripts can be compiled on another
|
|
|
f43afa |
+(development) machine and then transferred over to the production system:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap compile myscript -r \\
|
|
|
f43afa |
+.br
|
|
|
f43afa |
+> <KERNEL_VERSION_OF_TARGET_MACHINE>
|
|
|
f43afa |
+\fB#\fR tar czf stap-scripts-<kernel-version>.tar.gz \\
|
|
|
f43afa |
+.br
|
|
|
f43afa |
+> /var/cache/systemtap/<kernel-version> \\
|
|
|
f43afa |
+.br
|
|
|
f43afa |
+> /etc/systemtap/conf.d/<configfile>
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+And then copy this package to the target machine and extract it.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B STARTING SCRIPTS DURING EARLY-BOOT
|
|
|
f43afa |
+The initscript also allows us to start scripts earlier during the boot process
|
|
|
f43afa |
+by creating an initramfs containing the script's module. The system must be
|
|
|
f43afa |
+dracut-based for this to work. Starting a script at this stage gives access to
|
|
|
f43afa |
+information otherwise very hard to obtain.
|
|
|
f43afa |
+
|
|
|
f43afa |
+We first install the script by copying it into the script directory as usual and
|
|
|
f43afa |
+setting whatever options we'd like:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR cp myscript.stp /etc/systemtap/script.d
|
|
|
f43afa |
+\fB#\fR vi /etc/systemtap/conf.d/myscript.conf
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+To add the script to the initramfs, we use the \fBonboot\fR command:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap onboot myscript
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+If the script is not already compiled and cached, it will be done at this point.
|
|
|
f43afa |
+A new initramfs will then be created at the default location. We can use the
|
|
|
f43afa |
+\fB-b\fR option to ensure that the existing initramfs is backed up. We can then
|
|
|
f43afa |
+restart the system.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B USING A DIFFERENT INITRAMFS
|
|
|
f43afa |
+If we would prefer to only start the script for one boot and not others, it
|
|
|
f43afa |
+might be easier to instead use the \fB-o\fR option to specify a different
|
|
|
f43afa |
+initramfs output file:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap onboot myscript \\
|
|
|
f43afa |
+> -o /boot/special_initramfs.img
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+Once the initramfs is created, it's simply a matter of changing the command-line
|
|
|
f43afa |
+options at boot-time so that the new image is used rather than the usual one.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B CREATING AN INITRAMFS FOR A DIFFERENT KERNEL
|
|
|
f43afa |
+Just like the compile command, we can use the \fB-r\fR option to specify the
|
|
|
f43afa |
+kernel for which we want to create the initramfs. This is useful when we are
|
|
|
f43afa |
+about to upgrade and would like to prepare in advance. For example:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap onboot myscript \\
|
|
|
f43afa |
+> -r 3.12.6-200.fc19.x86_64
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B REMOVING SCRIPTS FROM THE INITRAMFS
|
|
|
f43afa |
+Finally, to remove all script from the initramfs, we simple run the \fBonboot\fR
|
|
|
f43afa |
+command without specifying any scripts:
|
|
|
f43afa |
+.SAMPLE
|
|
|
f43afa |
+\fB#\fR service systemtap onboot
|
|
|
f43afa |
+.ESAMPLE
|
|
|
f43afa |
+This will simply create a standard initramfs without any SystemTap modules
|
|
|
f43afa |
+inserted.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.TP
|
|
|
f43afa |
+.B TROUBLESHOOTING EARLY-BOOT ISSUES
|
|
|
f43afa |
+There can be many reasons for which the module didn't insert or did not work as
|
|
|
f43afa |
+expected. It may be useful to turn on dracut debugging by adding 'rdinitdebug'
|
|
|
f43afa |
+to the kernel command-line and checking dmesg/journalctl -ae. Also, the stderr
|
|
|
f43afa |
+output of staprun can be captured by setting the LOG_BOOT_ERR option to
|
|
|
f43afa |
+\fByes\fR.
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH SEE ALSO
|
|
|
f43afa |
+.IR stap (1)
|
|
|
f43afa |
+
|
|
|
f43afa |
+.SH BUGS
|
|
|
f43afa |
+Use the Bugzilla link of the project web page or our mailing list.
|
|
|
f43afa |
+.nh
|
|
|
f43afa |
+.BR http://sourceware.org/systemtap/ ", " <systemtap@sourceware.org> .
|
|
|
f43afa |
+.hy
|
|
|
f43afa |
+
|
|
|
f43afa |
diff --git a/systemtap.spec b/systemtap.spec
|
|
|
f43afa |
index 41945bd..41c746d 100644
|
|
|
f43afa |
--- a/systemtap.spec
|
|
|
f43afa |
+++ b/systemtap.spec
|
|
|
f43afa |
@@ -940,7 +940,7 @@ done
|
|
|
f43afa |
%config(noreplace) %{_sysconfdir}/systemtap/config
|
|
|
f43afa |
%dir %{_localstatedir}/cache/systemtap
|
|
|
f43afa |
%ghost %{_localstatedir}/run/systemtap
|
|
|
f43afa |
-%doc initscript/README.systemtap
|
|
|
f43afa |
+%{_mandir}/man8/systemtap.8*
|
|
|
f43afa |
%if %{with_dracut}
|
|
|
f43afa |
%dir %{dracutstap}
|
|
|
f43afa |
%{dracutstap}/*
|
|
|
f43afa |
--
|
|
|
f43afa |
1.8.3.1
|
|
|
f43afa |
|