LP #954990: pt-stalk --nostalk does not work

Description

**Reported in Launchpad by Jay Janssen last update 10-08-2012 18:16:49

~/percona/percona-toolkit-2.0.4# ~/bin/pt-stalk --version
pt-stalk 2.0.4
~/percona/percona-toolkit-2.0.4# ~/bin/pt-stalk --nostalk
Unknown option: --nostalk

Usage: pt-stalk [OPTIONS] [-- MYSQL OPTIONS]

For more information, 'man pt-stalk' or 'perldoc /root/bin/pt-stalk'.

Quoth the changelog:
Changelog for Percona Toolkit

v2.0.4 released 2012-03-07
...

  • Added --[no]stalk to pt-stalk (bug 932331)

Environment

None

Smart Checklist

Activity

Show:

lpjirasync January 24, 2018 at 5:17 PM

**Comment from Launchpad by: Daniel Nichter on: 21-07-2012 18:08:55

--nofoo now works like --no-foo.

lpjirasync January 24, 2018 at 5:17 PM

**Comment from Launchpad by: Daniel Nichter on: 21-07-2012 17:42:55

The --help yes/no is now fixed: it shows TRUE/FALSE like the Perl tools:

--config (No value)
--help TRUE
--read-samples (No value)
--save-samples (No value)
--sleep 5
--summarize-mounts TRUE
--summarize-network TRUE
--summarize-processes TRUE
--version FALSE

lpjirasync January 24, 2018 at 5:17 PM

**Comment from Launchpad by: Olivier Doucet on: 01-05-2012 14:11:38

I also have problems with no-stalk but different error (maybe this is a different bug ?) :

./pt-stalk --no-stalk
2012_05_01_16_09_23 Starting ./pt-stalk --function=status --variable=Threads_running --threshold=25 --match= --cycles=0 --interval=0 --iterations=1 --run-time=30 --sleep=0 --dest=/var/lib/pt-stalk --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=/var/run/pt-stalk.pid
2012_05_01_16_09_23 Not stalking; collect triggered immediately
2012_05_01_16_09_23 Collect triggered
./pt-stalk: line 524: 100 - : syntax error: operand expected (error token is " ")

./pt-stalk --version
pt-stalk 2.1.1
perl -v
This is perl, v5.8.8 built for x86_64-linux-thread-multi

lpjirasync January 24, 2018 at 5:17 PM

**Comment from Launchpad by: Baron Schwartz on: 17-04-2012 15:20:44

It's probably best if we fix the option-parsing library so that negatable options can't take a value. I still have the complaint that the tool prints out "yes" and "no" instead of matching the Perl tools' TRUE/FALSE.

lpjirasync January 24, 2018 at 5:17 PM

**Comment from Launchpad by: Bill Karwin on: 15-04-2012 16:32:48

The current version of pt-stalk (2.1.1) usage match neither the current documentation nor the suggested usage Baron described above.

$ ./pt-stalk --version
pt-stalk 2.1.1

$ ./pt-stalk --help
...
Command line options:
--stalk Watch the server and wait for the trigger to occur.
...
Options and values after processing arguments:
--stalk yes
...

$ ./pt-stalk --stalk no --dest ~/collected --pid ./pt-stalk.pid
2012_04_15_09_21_20 Starting ./pt-stalk --function=status --variable=Threads_running --threshold=25 --match= --cycles=5 --interval=1 --iterations= --run-time=30 --sleep=300 --dest=/home/bill/collected --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=./pt-stalk.pid
2012_04_15_09_21_20 Not running with root privileges!
2012_04_15_09_21_20 Check results: Threads_running=1, matched=no, cycles_true=0
2012_04_15_09_21_21 Check results: Threads_running=1, matched=no, cycles_true=0
...

$ ./pt-stalk --stalk false --dest ~/collected --pid ./pt-stalk.pid
2012_04_15_09_21_41 Starting ./pt-stalk --function=status --variable=Threads_running --threshold=25 --match= --cycles=5 --interval=1 --iterations= --run-time=30 --sleep=300 --dest=/home/bill/collected --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=./pt-stalk.pid
2012_04_15_09_21_41 Not running with root privileges!
2012_04_15_09_21_41 Check results: Threads_running=1, matched=no, cycles_true=0
2012_04_15_09_21_42 Check results: Threads_running=1, matched=no, cycles_true=0
...

$ ./pt-stalk --nostalk --dest ~/collected --pid ./pt-stalk.pid
Unknown option: --nostalk

$ ./pt-stalk --no-stalk --dest ~/collected --pid ./pt-stalk.pid
2012_04_15_09_22_16 Starting ./pt-stalk --function=status --variable=Threads_running --threshold=25 --match= --cycles=0 --interval=0 --iterations=1 --run-time=30 --sleep=0 --dest=/home/bill/collected --prefix= --notify-by-email= --log=/var/log/pt-stalk.log --pid=./pt-stalk.pid
2012_04_15_09_22_16 Not running with root privileges!
2012_04_15_09_22_16 Not stalking; collect triggered immediately
...

As shown above, I found through experimentation that the --stalk option can be negated ONLY with "--no-stalk", but this is not clear from the documentation. I suggest the following perldoc rewrite to make it more clear:

...
--stalk
default: yes; negatable: yes

Watch the server and wait for the trigger to occur.

You can make the tool gather one sample of diagnostic data immediately by negating this option in the form "--no-stalk". This is useful for example if a problem is currently happening, but pt-stalk is not stalking. If you negate stalking, "--daemonize", "--log", "--pid", and other stalking-related options have no effect; the tool simply collects diagnostic data once and exits. The tool still respects safeguard options, such as "--disk-bytes-free" and "--disk-pct-free".

See also "--collect".
...

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 5:17 PM
Updated January 24, 2018 at 5:17 PM
Resolved January 24, 2018 at 5:17 PM