pikt
(NOTE: Some of the techniques shown or described on this page--marked in purple--require new features in the latest official PIKT 1.19.0 release (pikt-current.tar.gz) that are unavailable in any previous version.)
pikt is the Pikt script interpreter. It takes the following command-line arguments:
Usage: pikt [-cGhTUVz] [+M "The -c option forces a syntax check. Before .alt, .obj, and program files are installed on the clients, piktc syntax checks the central .cfg files for errors. piktc catches most, but not all, syntax errors. It does not check, for example, if a script uses a reserved function name as a variable. pikt, on the other hand, does a thorough check of client-side config file syntax, and some semantic checking as well. It will catch many errors that piktc misses (including the one cited above), but it will not detect all possible errors. It will not determine whether a function has the appropriate number and type of function arguments, which is only detected at run time. (We will be extending the pikt syntax checks in the future.) (There is, in fact, another pikt command option: -C. This is for when piktc calls pikt to do a syntax doublecheck. All -C does is to tell the invoked pikt to look in the piktc staging directory for the checked files; the pikt syntax check is the same Thus, it makes no sense to do a "pikt -C" on a slave system. "pikt -C" is really reserved for piktc's use.)"] [+L " "] [+C " "] [+A|S ] -c syntax check alarm script file -G run in debug mode -h show program help -T run in test mode -U run in urgent mode -V show version info -z run in 'make check' mode +C pikt command +M mail command +L print command +A|S alert/script
The -G option turns on debugging. When run interactively, pikt sends debug messages to stderr. When invoked via piktd, pikt outputs debug messages to =piktdir/var/log/
If an .alt file fails a syntax/partial-semantics check, pikt logs the error, then dies. (You may use other Pikt scripts to check the pikt alert logs for such errors.) During a pikt run, other semantic errors might cause a particular alarm script to abort (with such errors also logged), but the pikt session doesn't die; the rest of the alarm scripts still run. These error logs, especially when combined with Pikt scripts combing the log files for error statements, are extremely useful in determining the cause of breakdowns.
The -h option shows program help (shown above).
The -T option runs pikt in test mode. For example, 'pikt -T +A Critical' effectively forces a 'status testing' across all alarms in the Critical alert group (and therefore command strings are reported and/or logged rather than executed).
The -z option runs pikt in 'make check' mode. You ordinarily wouldn't do this outside the installation 'make check'.
The +C option allows you to run Pikt command sequences at the command line. For example,
vienna# pikt +C 'output $checksum(4,"/usr/bin/login")' c03df7329470a15e7312a7f48d12217a 29292 /usr/bin/loginAnother example:
vienna# pikt +C 'output $groupmembers("adm")' root,adm,daemonYou might use this feature to access Pikt functions from within programs written in other scripting languages, e.g.,
$today = `pikt +C 'output \$dayname()'`;Perhaps more importantly, 'piktc +C' allows you to do some interesting things with your PIKT config files. (See #exec, #piktexec, #pexec.)
The +M option precedes a quoted string specifying the mail command (and subject and recipients) to be used with the current alert. The +M and mail command are optional.
The +L option precedes a quoted string specifying the print command (and printer) to be used with the current alert. This, too, is optional (if no alarms output to a printer).
If neither mail nor print commands are specified, pikt outputs to stdout. In this way, you may run Pikt scripts at the command line. This is especially useful when developing and debugging Pikt scripts.
The +A option precedes an unquoted alert identifier.
In pikt commands, 'A' (for alerts) and 'S' (for scripts) are effectively synonymous. You might prefer to use 'A' when processing alerts, and 'S' when processing non-alert scripts.
When a pikt session starts, it writes a lock file, for example, "Urgent.lock", in the =piktdir/etc directory. This is to prevent concurrent pikt runs for the same alert. pikt removes this lock file on script completion. When and if pikt dies unnaturally, you will have to remove the
When a Pikt script does an 'exec wait' (or 'doexec wait'), it writes a lock file for that script in the =piktdir/etc directory. The lock file contains the command string being exec'ed. If an alert hangs or becomes blocked, inspecting an exec wait lock file can sometimes explain the blockage.
The -U option runs pikt in so-called "urgent" (or "unblocked") mode.
If a command-line pikt operation fails with the complaint
May 4 00:30:57 vienna pikt[29017]: [ID 2902 ERROR] (../../../src/piktd/pikt.c, line 239, main()) /pikt/etc/ScanDmesg.alt.lock found! Another ScanDmesg pikt run may be in progress. Try again later (else rm the /pikt/etc/ScanDmesg.alt.lock lockfile).that indicates a competing (and previous) ScanDmesg run is blocking your command. But what if you have an urgent needed to run ScanDmesg, no matter what? Or what if you are confident that in no way should your current command-line pikt operation interfere with another one (perhaps run by another sysadmin in your organization)?
Or suppose that, while Pikt scripts are launching automatically in the background (by way of the PIKT scheduling daemon, piktd), you want to run a Pikt script interactively at the command line, say
# pikt +A DownSystems(a script to poll all systems for signs of crashes or network downages)? A script running in the background might interfere with the current DownSystems run attempt, and a similar error message would appear on-screen announcing the run failure and warning of a blocking lock file.
You may overcome these lock file blocks using the '-U' option. So, for example, you might do
# pikt -U +A DownSystemsand the DownSystems script would run, regardless of any other PIKT activity on the system.
Note that you should not get in the habit of using '-U' in a knee-jerk fashion or unthinkingly. Often there are good reasons to block concurrent pikt operations. Try to use '-U' only in situations of special urgency or where you are fully confident that forging full speed ahead will not get you into trouble.
The -V option will output version information, e.g., "PIKT pikt version 1.19.0".
pikt dies a natural death after processing all current alert scripts. You can force pikt to die prematurely by use of the "die" command within a Pikt script.
pikt logs all warnings and errors to the current alert's log file. When run interactively (without the +M or +L options), pikt also logs to the current alert's log file.
prev page | 1st page | next page |